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.




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 »

Why I Like The Merge Statement

November 22, 2010

Over the past few years, I’ve stopped using the Update statement, and  started using the Merge statement for updates instead.  While many use it to do both inserts and updates at the same time, you can use Merge for only updates, or inserts.

Say I want to update some fields in the SCOTT schema.  Traditionally, I would first do the analysis by looking at the data.
Read the rest of this entry »

%d bloggers like this: