Previous Section  < Day Day Up >  Next Section

9.4 Importing and Exporting NULL Values

A NULL value indicates the absence of a value or an unknown value, which is difficult to represent literally in a datafile. For import and export purposes, MySQL uses the convention of representing NULL values by \N:

  • For LOAD DATA INFILE, a \N appearing unquoted by itself as a column value is interpreted as NULL. MySQL users sometimes assume that an empty value in an input file will be handled as a NULL value, but that isn't true. MySQL converts an empty input value to 0, an empty string, or a "zero" temporal value, depending on the type of the corresponding table column.

  • For SELECT … INTO OUTFILE, MySQL writes NULL values to the output file as \N.

    Previous Section  < Day Day Up >  Next Section