Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
CHECK constraints with a simple condition
CHECK constraints with complex conditions
9. CHECK – practice
Adding CHECK constraints to existing tables
Summary

Instruction

Just as we expected! The update failed because the new value for the price column didn't meet the criterion.

How about trying something on your own?

Exercise

Let's leave the gaming community for now. Create a table called salary with the following columns:

  1. employee_id – A unique integer number.
  2. monthly – A decimal of up to 10 digits, with 2 digits after the decimal point.
  3. annual – A decimal of up to 10 digits, with 2 digits after the decimal point.

Add the following CHECK constraint: The annual field must equal the monthly field times 12.

Stuck? Here's a hint!

Make sure that monthly * 12 = annual.