Introduction
UNIQUE
NOT NULL
17. NULL in ERD diagrams
CHECK
DEFAULT
Summary

Instruction

Good! The last thing we want to show you about the NULL constraint is the way we mark it in ERD diagrams. Take a look:

The board_game table

Have you noticed the N signs on the right? This way, we can stress that a certain column may be NULL. Any other column without this mark is not allowed to be NULL.

Exercise

Use the ERD diagram to write the proper instruction for creating the table.

The rpg_game table

Stuck? Here's a hint!

Type

CREATE TABLE rpg_game (
    id IDENTITY PRIMARY KEY,
    name varchar(32) NOT NULL,
    genre varchar(32) NOT NULL,
    classes_no int NULL,
    complexity int NULL,
    min_players int NULL
);

Console

Code editor

Result

TableConsole