Skip to content
Justice Tech School

Data Types

Common types: INT for whole numbers, DECIMAL(10,2) for exact money values, FLOAT for approximate numbers, VARCHAR(n) or TEXT for text, DATE, TIME and DATETIME (TIMESTAMP) for dates, and BOOLEAN for true or false.

Use DECIMAL for money because floats can round badly. SQLite is flexible and stores only a few kinds (INTEGER, REAL, TEXT, BLOB, NULL), whatever you declare.

Example
CREATE TABLE payments (
  id INTEGER PRIMARY KEY,
  amount DECIMAL(10,2),
  paid_on DATE,
  note VARCHAR(100)
);
INSERT INTO payments VALUES (1, 4500.50, '2026-05-01', 'Python course');
SELECT amount, typeof(amount) AS stored_as FROM payments;

Result

amount | stored_as
4500.5 | real

Exercise

Which type should store money exactly?

amount (10,2)

Quiz Test

Which type is best for money?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.