Why These 25?
Hand-curated for maximum interview ROI.
Subqueries First, CTEs Second
A deliberate inversion of how most courses teach this. You start with EXISTS, NOT IN, scalar and correlated subqueries — then graduate to single CTE → multi-CTE → multi-step business scorecards. You learn why CTEs win.
Multi-CTE Business Scorecards
The capstone stage drills the 2–4 CTE multi-step pipelines that appear in real DS/DA onsite questions — CTE + window function combos, set intersection/difference, multi-tier classification. Industry-grade schemas, real ambiguity, the actual interview shape.
Both Dialects, Same Editor
Toggle SQLite and PostgreSQL on any problem. CTE syntax is portable, but the small dialect quirks (aggregation in HAVING, type coercion in scalar subqueries) catch candidates off guard in real interviews — you see them side-by-side here.
Skill Coverage
How the 25 problems distribute across SQL topics.
FAQ
Helpful but not required.
If you can write basic SELECT/JOIN/GROUP BY and have seen the WITH keyword in passing, start here.
Stage 1 begins with simple scalar subqueries to ease you in.
Ready to Master SQL?
Start with Stage 1 — graded instantly in your browser.
All company names, logos, and trademarks are the property of their respective owners. Their use is for identification purposes only and does not imply endorsement.
LDS SQL CTE & Subqueries 25 — 25 Curated SQL Problems
A 5-stage progression from scalar subqueries and EXISTS / NOT EXISTS through single-CTE reference-value patterns up to the multi-CTE business scorecard you'll write at staff level. Twenty-five problems on 15 production-grade schemas — the query shape that turns a raw fact table into a board-ready metric in one statement.
Problems included in LDS SQL CTE & Subqueries 25
- Campaigns Above Average Spend
- Portfolios Above Average Value
- Restaurants Above Average Rating
- Merchants Above Average Charge Amount
- Properties Priced Above Average
- Providers with Denied Claims
- Guests Booking Direct and OTA
- Riders Who Used Economy and Premium
- Watchlisted but Never Watched
- Plans Never Subscribed
- Properties Above Average Revenue
- Public Posts Above Average Reactions
- Customers With Above-Average Daily Usage
- Securities Above Sector Average P/E
- Categories With Above-Average Revenue
- Delinquent Customers With No Suspicious Activity
- Users With Positions But No Recent Trades
- Refund Reason Analysis
- Products Outperforming Average Revenue
- High Ticket Volume Customers
- Campaign ROAS by Attribution Model
- Property Investment Scorecard
- Revenue Summary With Rank via CTE
- Warehouse Revenue With Rank via CTE
- User Engagement Score Pipeline