Unique constraint by 2 columns where one has a specific value
I have a problem with UNIQUE CONSTRAINT
.
I have a problem with UNIQUE CONSTRAINT
.
I started by googling and found the article How to write INSERT if NOT EXISTS queries in standard SQL which talks about mutex tables.
I have an email column that I want to be unique. But I also want it to accept null values. Can my database have 2 null emails that way?
I have an already existing table with a field that should be unique but is not. I only know this because an entry was made into the table that had the same value as another, already existing, entry and this caused problems.
I’m trying to remove duplicates from a MySQL table using ALTER IGNORE TABLE + an UNIQUE KEY. The MySQL documentation says:
I’m trying to populate a SQL table with a list of words. The table itself it pretty simple:
So I know in MySQL it’s possible to insert multiple rows in one query like so:
My question will use emails as an example, but this could apply to anything.
I have two tables, parent
and child
, the child
table has a FK on the parent
table using the parent_id
column. When adding this FK I can see that the child
table has both the FK and an index to represent that FK.