Recently, I went to dump a MYSQL table into a CSV file, with the fieldnames in the first line of the file.
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: