Full-stack dev quiz question #59
Null values in relational databases are special in many ways. Do two nulls violate uniqueness? Check fifty ninth question of full-stack dev quiz to check if you know how to play with null values.
Consider a table BOOKS with BOOK_HASH column created in MySQL. There is a unique constraint created on the BOOK_HASH column. It is the only column in that unique constraint.
Which sentences are true? Choose all valid answers.
- null value is defined as the absence of any data value by ISO SQL standard
- two null values can be inserted to the BOOK_HASH column if the column is numeric
- two null values can be inserted to the BOOK_HASH column if the column is varchar
- unique constraint allows two null values, but a unique index does not
- the BOOK_HASH column cannot contain any null value, because all values must be unique, but null can mean any value
- a unique index is automatically created on the BOOK_HASH column by MySQL engine, because it has a unique constraint
For the correct answer scroll down
The correct answer is: a, b, c, f. If you would like to read more, check MySQL unique index with null values article.