DHDataHọc

Practice datasets

Six relational datasets reused across every exercise and lesson example. Inspect the schema, try a sample query, then jump into practice.

6 datasets · 17 tables

01E-commerce

Retail

Customers, products, orders and order items — the standard dataset for multi-table JOINs, revenue by category and order analysis.

Table schema

customers

ColumnType
idinteger
nametext
emailtext
citytext
signup_datedate
segmenttext

products

ColumnType
idinteger
nametext
categorytext
pricenumeric(12, 2)
stockinteger

orders

ColumnType
idinteger
customer_idinteger → customers.id
order_datedate
statustext

order_items

ColumnType
idinteger
order_idinteger → orders.id
product_idinteger → products.id
quantityinteger
unit_pricenumeric(12, 2)

Sample query

select c.city, count(*) as so_don
from orders o
join customers c on c.id = o.customer_id
where o.status <> 'cancelled'
group by c.city
order by so_don desc;
02SaaS

Subscription

Subscribers, plans and payments — use it for churn, recurring revenue and renewal-rate questions.

Table schema

subscribers

ColumnType
idinteger
nametext
signup_datedate
countrytext

subscriptions

ColumnType
idinteger
subscriber_idinteger → subscribers.id
plantext
started_ondate
ended_ondate
monthly_pricenumeric(12, 2)

payments

ColumnType
idinteger
subscription_idinteger → subscriptions.id
paid_ondate
amountnumeric(12, 2)
statustext

Sample query

select plan, count(*) as so_nguoi_dang_dung
from subscriptions
where ended_on is null
group by plan
order by so_nguoi_dang_dung desc;
03Finance

Banking

Branches, accounts and transactions — practise aggregating by transaction type, balances and branch activity.

Table schema

branches

ColumnType
idinteger
nametext
citytext

accounts

ColumnType
idinteger
account_notext
customer_nametext
branch_idinteger → branches.id
opened_ondate
balancenumeric(14, 2)

transactions

ColumnType
idinteger
account_idinteger → accounts.id
txn_datedate
typetext
amountnumeric(14, 2)

Sample query

select type, sum(amount) as tong_tien
from transactions
group by type
order by tong_tien desc;
04Operations

HR

Departments and employees with salary, title and hire date — practise GROUP BY, AVG and comparing pay across teams.

Table schema

departments

ColumnType
idinteger
nametext

employees

ColumnType
idinteger
nametext
department_idinteger → departments.id
titletext
salarynumeric(12, 2)
hire_datedate

Sample query

select d.name as phong_ban, avg(e.salary) as luong_trung_binh
from employees e
join departments d on d.id = e.department_id
group by d.name
order by luong_trung_binh desc;
05Healthcare

Hospital

Patients and visits with fees and departments — practise counting visits, totalling fees and analysing patient groups.

Table schema

patients

ColumnType
idinteger
nametext
dobdate
gendertext
citytext

visits

ColumnType
idinteger
patient_idinteger → patients.id
visit_datedate
departmenttext
feenumeric(12, 2)

Sample query

select department, count(*) as so_lan_kham, sum(fee) as tong_phi
from visits
group by department
order by tong_phi desc;
06EdTech

Education

Students, courses and enrolments — practise completion rates, course revenue and learning-behaviour analysis.

Table schema

edu_students

ColumnType
idinteger
nametext
signup_datedate
countrytext

edu_courses

ColumnType
idinteger
titletext
pricenumeric(12, 2)

edu_enrollments

ColumnType
idinteger
student_idinteger → edu_students.id
course_idinteger → edu_courses.id
enrolled_ondate
completed_ondate

Sample query

select c.title, count(e.student_id) as so_hoc_vien
from edu_courses c
left join edu_enrollments e on e.course_id = c.id
group by c.title
order by so_hoc_vien desc;

How the data works

  • Every practice run gets its own copy of the dataset, so you can experiment freely without touching the source data.
  • Data is rebuilt from the seed script before each run, so results are always consistent.
  • The sample query below can be copied into the practice editor and run as-is.