CodeBlanks Logo Icon CodeBlanks

Summary - Partitioning

Build a monthly event table with range partitioning.

Summary - Partitioning

Partitioning splits a table: RANGE by range, LIST by value, HASH by hash. Pruning speeds up.

CREATE TABLE sales (...) PARTITION BY RANGE (sale_date);

Summary partitioning query.

The table sales is created.

Practice Summary - Partitioning

Summary: partition the sales table with RANGE.

Starter code

query.sql
-- summary partitioning
CREATE TABLE sales

Sample solution

query.sql
CREATE TABLE sales (id INT, sale_date DATE, amount DECIMAL)
PARTITION BY RANGE (sale_date);

Expected output

Tablo oluşturuldu

Questions and answers

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

1 What partitions by date?

  • LIST
  • ROUND
  • HASH
  • RANGE Correct answer

Explanation: RANGE is ideal for date partitions.

2 Summary - Partitioning: match the terms

Term Meaning
RANGE range
LIST list
HASH hash
pruning pruning

All lessons in Advanced