Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Quiz

Instruction

Yes, that's right! Now, let's take a closer look at various constraints.

Exercise

A forex agency needs a simple table to keep track of the currency exchanges they perform.

Create a table called exchange with the following columns:

  • id - an integer which is the primary key,
  • currency_from - exactly three characters,
  • currency_to - exactly three characters,
  • quantity - a decimal field of 10 digits, 2 out of which are after the decimal point,
  • rate - a decimal field of 6 digits, 2 out of which are after the decimal point,
  • time - a field with date and time.

Mind the following requirements:

  • No column can be a NULL.
  • The columns quantity and rate must be greater than zero.
  • If no value is provided, the default quantity is 100.00.

Stuck? Here's a hint!

We discussed constraints in Part 5. Take a look back to refresh your memory.