SQL: Learn SQL in 24 Hours or Less - A Beginner’s Guide To Learning SQL Programming Now (SQL, SQL Programming, SQL Course) by Robert Dwight

SQL: Learn SQL in 24 Hours or Less - A Beginner’s Guide To Learning SQL Programming Now (SQL, SQL Programming, SQL Course) by Robert Dwight
Author: Robert Dwight [Dwight, Robert]
Language: eng
Format: epub
Published: 2016-04-10

Now, the AUTHOR_NAME and BOOK_TITLE columns must have unique values for the table to accept a new entry.

As you've read earlier, the UNIQUE constraint makes sure that one or more columns won't take duplicate values. That is an important rule to remember. However, you should also know that UNIQUE doesn't work on “null.” Thus, a column will accept any number of null values even if you have set a UNIQUE constraint on it.

If you want to set your columns so that they will not accept a null value, you must use NOT NULL. Let's apply NOT NULL on the column definition of BOOK_TITLE: