Last Updated: February 25, 2016
·
847
· code_arts

Ensure all fields defined in a unique index cannot be set to NULL

In MySQL, NULL is treated as a unique value — which is why you cannot use comparisons such as value = NULL and need to use value IS NULL.

If you try to do a multi-column index in which one column allows NULL values, each NULL value is treated as unique and the index would become useless.

http://www.sitepoint.com/use-unique-indexes-mysql-databases/