Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
UNIQUE
NOT NULL
12. NOT NULL - Creating tables
CHECK
DEFAULT
Summary

Instruction

You probably guessed right. It's impossible to add a game without a name. The value must be provided for every new row in the table.

Exercise

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

  • id - identity and the primary key,
  • name of up to 32 characters which must be unique and must not be a NULL,
  • genre of up to 32 characters,
  • and three integer columns: classes_no, complexity, min_players.

Stuck? Here's a hint!

Type

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