Layout
DSCONCEPTS · INTERVIEW PRACTICE

Practice SQL questions.

Prepare for interviews with ecommerce and finance SQL questions. Write and run queries on Northstar’s orders, payments, and refunds—from basic aggregations to window functions and first-order cohorts.

12 basic + 12 advanced problems6 inspectable tablesDuckDB SQL · runs in your browser
Start with the basics
01 · Inspect

Read the business definition and explore the table schema and sample rows.

02 · Query

Write your SQL from scratch and run it locally against the practice data.

03 · Check

Compare results against a reference on the visible data and an amount variation—not against query text.

SECTION 01

Build the foundations.

Filters, dates, joins, aggregation, and financial grain.

SECTION 02

Go beyond GROUP BY.

ROW_NUMBER, RANK, DENSE_RANK, LEAD, LAG, running totals, and cohorts.

Explore the Northstar dataset before starting

Data & schema

customer_id
INTEGER · PK
customer_name
VARCHAR
country
VARCHAR
email
VARCHAR
signup_date
DATE
Table notes & relationships

Buyer accounts. Some buyers have no orders, and some email addresses are NULL.

Fictional teaching data. Money is USD cents; timestamps are UTC.