SQL interview questions
Advanced SQL for data and AI roles: window functions, joins, aggregation, and writing correct, efficient queries against real schemas.
14 questions9 free to practice5 company-verified (Pro)
Free to practice
- Window Functions for Order Analytics
- PostgreSQL Analytics Performance Issue
- Joining Postgres, Stripe, and Salesforce for Analytics
- RANGE vs ROWS window frames: ROWS uses physical row count, RANGE uses value-based ordering.
- 95th percentile trailing value across 1000 orders per row
- Identify sequence gaps: return first and last missing ID
- Rank transactions by amount within user partitions, ties broken by timestamp
- Employee hierarchy with full management chain as array
- Longest consecutive daily login streak per user
Company-verified Pro
Real SQL questions reported from interviews at 50+ AI companies, with the golden answer and full production scoring. Unlock with Pro →
- Users with session count growth for three consecutive months
- Product Daily Revenue Rolling 30-Day Percentile Rank Calculation
- User purchase median interval calculation with window functions
- Seven Day Rolling Average Daily Active Users Including Zero Days
- User lifetime net revenue and distinct active months count
Ready to practice SQL?
Answer real questions in the browser and get scored on correctness, architecture, token efficiency, and security against a golden answer — not just pass/fail. Free to start.
Start practicing free →