One of the most universal data interchange formats in the world is the CSV file. Data professionals use CSV’s without a thought. Equally, those not even in the ‘data field’ use CSV’s on a daily basis. Do you have the SQL query results for that report and need to share them in CSV format? Using the Oracle SQL Developer IDE, it is a breeze…
If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!
There are times as an SQL Professional you have to go deep in the thick of it to get that data and those insights out of the database. Providing information from data is part of our jobs. Taking it a step further, oftentimes others’ in the workflow need that same data and those same insights to do their best work. And what is one of the most understood and easiest ways to share data?
The CSV file.
If you are working with the Oracle database and using SQL Developer, the IDE has an easy-to-use interface for exporting data. You can export query results to various formats however, in this post, we will look at saving them to a CSV file.
Export Query Results to CSV
For the examples in this post I am using this fictitious FRIENDS table and data:
The Newsletter for PHP and MySQL Developers
Step 1: Query Results for export
Right-click anywhere on the query results you wish to save to a CSV file and choose Export as shown in the following screenshot:
Once Export is clicked, an Export Wizard dialogue opens (shown in the next section).
Step 2: Configure export options
Follow these steps in the opened Export Wizard:
- Select csv from the list of choices in the Format: dropdown.
- Use the Browse button and choose a destination to save the CSV file to. Also, name the file at this step as well and it is shown in the File: section.
- Click the Next button to proceed to the 2nd dialogue interface.
(Note: I mostly leave all other settings to their defaults here. One thing you may do differently is un select the Header checkbox if you do not want a header row of column names in the exported CSV file.)
Are you a Medium member? If so, receive an email notification each time I publish a blog post if you prefer the Medium platform. Not a member? No worries! Use my sign-up link (I will get a commission at no extra cost to you) and join. I really enjoy reading all the great content there and I know you will too!!!
Step 3: Finish export and view CSV file
All that is left to do is review the individual steps of the provided Export Summary (if desired) and click the Finish button.
Opening up the saved friend_export.csv file in LibreOffice, we can see the same query results from SQL Developer now saved into a CSV file.
How simple is that?
As always, if you have any questions or see any mistakes in the code, please let me know via the comments. Constructive comments help me provide accurate blog posts and are much appreciated.
Similar blog posts and tutorials covering CSV’s
I have written several other blog posts covering various SQL implementations’ and their IDE’s/GUI’s steps to either import or export CSV data. For more great content, check them out from the list below!
- Import CSV file with Oracle SQL Developer
- Import CSV file with MySQL Workbench
- Export MySQL data to CSV with phpMyAdmin
- Import CSV file data into MySQL table with phpMyAdmin
- MySQL SELECT INTO Syntax Part 2 – Saving to OUTFILE with examples
Consider making a donation as I continue to provide valuable content here on my blog. Thank you so much!!! Every bit is much appreciated and helps tremendously!
Like what you have read? See anything incorrect? Please comment below and thank you for reading!!!
A Call To Action!
Thank you for taking the time to read this post. I truly hope you discovered something interesting and enlightening. Please share your findings here, with someone else you know who would get the same value out of it as well.
Visit the Portfolio-Projects page to see blog posts/technical writing I have completed for clients.
Be sure and visit the “Best Of” page for a collection of my best blog posts.
Josh Otwell has a passion to study and grow as a SQL Developer and blogger. Other favorite activities find him with his nose buried in a good book, article, or the Linux command line. Among those, he shares a love of tabletop RPG games, reading fantasy novels, and spending time with his wife and two daughters.
Disclaimer: The examples presented in this post are hypothetical ideas of how to achieve similar types of results. They are not the utmost best solution(s). The majority, if not all, of the examples provided, are performed on a personal development/learning workstation environment and should not be considered production quality or ready. Your particular goals and needs may vary. Use those practices that best benefit your needs and goals. Opinions are my own.