sql
Pivot monthly revenue into columns
SQL & Data Modeling · Pivoting · medium · Original Uplift question · PostgreSQL · 10 min
Return one row per category with three columns of revenue: Jan, Feb, and Mar 2026.
Fixture
sales
category, order_date, amount
create table sales (category text, order_date date, amount numeric);
insert into sales values
('books','2026-01-10',100),('books','2026-02-05',150),('toys','2026-01-20',300),
('toys','2026-03-01',200);Evaluation criteria
- Groups by category
- Uses conditional aggregation (FILTER or CASE) per month
- Correct month boundaries
- Missing months resolve to 0 or null sensibly
Detailed grading feedback appears after you submit.
Source
Original Uplift question based on a common interview pattern.
Your answer
You get one graded attempt here without an account. Create a free account for unlimited attempts, saved progress and community write-ups.
Answers stay hidden until you ask. Reveal the full model write-up when you are ready to compare.