CodeBlanks Logo Icon CodeBlanks

Summary - Data types

Combine columns of different types in one table.

Summary - Data types

In this group you learned integer, decimal, text, date and boolean types. Choosing the right type matters for storage and accuracy.

CREATE TABLE products (
  id INT,
  price DECIMAL(10,2),
  name VARCHAR(100),
  in_stock BOOLEAN
);

Each column gets the right type.

The table products is created.

Practice Summary - Data types

Create products with id INT, price DECIMAL(10,2), name VARCHAR(100).

Starter code

query.sql
-- create the table
CREATE TABLE products

Sample solution

query.sql
CREATE TABLE products (
  id INT,
  price DECIMAL(10, 2),
  name VARCHAR(100)
)

Expected output

Tablo oluşturuldu

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which type suits money?

  • DECIMAL Correct answer
  • FLOAT
  • INT
  • TEXT

Explanation: DECIMAL keeps exact values.

2 Summary - Data types: match the terms

Term Meaning
INT integer
DECIMAL money
VARCHAR text
DATE date

All lessons in Beginner