My Oracle Support Banner

How To Load empty strings Into MySQL Tables as Null (Doc ID 2626215.1)

Last updated on JANUARY 13, 2020

Applies to:

MySQL Server - Version 5.7 and later
Information in this document applies to any platform.


It is quite common that some GUI tools export NULL data as ,, (nothing between two commas) in the CSV files. When loading them to MySQL, the 'LOAD DATA' command will create empty strings from it not NULL.

In MySQL, empty string is not equivalent to NULL. Thus it may break some SQL queries.

As shown in the example below:

1. Table structure



To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.