I want to create a table in MySQL that will have a Unique constrant, however I also want the option of putting in NULL. In other words when inserting data into this column it allows me to enter NULL or other then that it has to be unique data.
I am sorry, but you cannot do this with RDBMS. Every value has to be unique, and NULL is a value of its own, so two NULLS will be a duplicate key failure. You can either make the column a Unique contraint, or a NULL, but they are mutually exclusive.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.