Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
UNIQUE
4. UNIQUE - Adding rows with the same value
NOT NULL
CHECK
DEFAULT
Summary

Instruction

Excellent! As you can see, the new board game had a unique name and so we were able to add the new row successfully. But what would happen if we wanted to enter a row with the same value?

Exercise

Pretend to be an absent-minded user who didn't notice that Monopoly is already there.

Try to insert the game:

  • name is Monopoly,
  • genre is business,
  • min_players is 2,
  • min_age equals 10,
  • price is estimated at 35.20.

Stuck? Here's a hint!

Type

INSERT INTO board_game (name, genre, min_players, min_age, price) 
VALUES ('Monopoly', 'business', 2, 10, 35.20);