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/
Written by Pradeep
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mysql
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#