Instruction
Okay, time to wrap things up! What did we learn?
- You can add a
UNIQUEconstraint to a single column, placing it after the column type:CREATE TABLE board_game ( id integer PRIMARY KEY, name varchar(32) UNIQUE );
- You can add a
UNIQUEconstraint to a group of columns, placing it after the column definitions:CREATE TABLE board_game ( id integer PRIMARY KEY, name varchar(32), genre varchar(32), UNIQUE (name, genre) );
- You can add a
UNIQUEconstraint to an existing table:ALTER TABLE video_game ADD CONSTRAINT video_game_unique UNIQUE (name, platform);
- You can remove a
UNIQUEconstraint from an existing table:ALTER TABLE group_game DROP CONSTRAINT group_game_name_key;
How about a quick quiz now?
Exercise
Click to continue.



