Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Primary keys – the basics
Single-column primary keys
Multi-column primary keys
NOT NULL
19. NOT NULL – Creating tables
Review

Instruction

As you probably guessed, it's impossible to add a game without a name. Indeed, a name value must be provided for every new row in the table.

Exercise

It's your turn to create the rpg_game table with a NOT NULL column. Our table rpg_game should have the following columns:

  1. id – identity and the primary key.
  2. name – up to 32 characters that must be unique and must not be a NULL.
  3. genre – up to 32 characters.
  4. Three integer columns: classes_no, complexity, min_players.

Stuck? Here's a hint!

Type:

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