MYSQL – Create CSV File With Fieldnames For Headers

October 19, 2014

Recently, I went to dump a MYSQL table into a CSV file, with the fieldnames in the first line of the file.

MYSQL Logo

MYSQL Logo

 

This simple enough in Oracle’s SQLPLUS, so I did some internet searches to determine the syntax.

Instead of the simple MYSQL syntax, I found a number of relatively complex solutions. Some involved MYSQL scripts, and others utilized Unix string parsing commands.

However, I came up with a much simpler solution using one simple MYSQL command:

Read the rest of this entry »


%d bloggers like this: