In MySQL given a table and an index:
CREATE table table_1 (col1 int, col2 int);
create UNIQUE INDEX index_1_2 on table_1 (col1, col2);
We start filling the table with data executing following queries one after another, top to bottom. Select all queries that will execute correctly.
It is obvious that fifth query will fail because of UNIQUE constraint violation.
What is not obvious though is that forth query will be executed correctly. The thing is that UNIQUE constraint allows multiple NULL values to be inserted.

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Зареєструйся Зараз
або Підпишись на майбутні тести