Revision
3. Number data types - revision

Instruction

Great! Let's move on to number data types. We've learned the following:

  • INTEGER, used for storing integer numbers,
  • DOUBLE and REAL, used for storing floating point numbers and
  • DECIMAL used for precise calculations with money. For instance, DECIMAL(5,3) means that there will be 5 digits altogether, of which 3 are after the decimal sign.

Exercise

XYZ Bank is very unfortunate - they experienced several acts of embezzlement in the past. They want to keep record of these events.

Let's create a table fraud with the following columns:

  • employee_id (an integer),
  • amount (money value with 10 digits altogether and two after the decimal sign).

Stuck? Here's a hint!

Type

CREATE TABLE fraud (
   employee_id int,
   amount decimal(10,2)
);

Console

Code editor

Result

TableConsole