I often work in command line mysql. A common need is to take a query's results and import them into a Numbers document (similar to an Excel document).
What is the fastest method for doing this?
Method 1: Select into outfile
You can select into an outfile directly from MySQL, but this takes several steps.
- export your query with all the necessary arguments to make it a CSV format, like
FIELDS OPTIONALY ENCLOSED BY
andDELIMITED BY
. - sftp into the server and grab the file
- delete the file from the server
Method 2: Copy/paste
I tend to do this method. For me it seems a little faster but that's mostly because I don't remember how to construct the SELECT INTO OUTFILE
query from above and have to look it up.
- Copy/paste to a local text file
- Open in a text editor and replace | with ,
- Save as a CSV and open in Numbers.