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
Обратная Связь
Зарегистрируйся сейчас
или Подпишись на будущие тесты