Primary keys - the basics
6. Primary keys - NULL values
Single-column primary keys
Multicolumn primary keys
Auto-increment columns and sequences
Revision

Instruction

Fine! As you can see, you failed and that's the correct result. The database won't allow you to duplicate the primary key column because it must always be unique.

Now, what will happen if we try to insert a NULL value instead?

Exercise

Add a new movie with a NULL id value. You can use the template code we prepared for you or you can write your own.

Console

Code editor

Result

TableConsole