SQL, Pandas and Python interview questions for product and data analysts
Problems from our practice set, on data from Carrot, a made-up grocery delivery app. Read one here, then solve it free in your browser — code checks your answer. “Find the bugs” problems give you a colleague’s code to fix.
SQL
- Second-highest price in each groupEasy · Nth-highest value
- Top 3 categories in each cityMedium · Top-N per group
- Day-1 retention by channelMedium · Retention
- Find the bugs in a churn queryMedium · Code review
- Find the bugs in a revenue queryMedium · Code review
Pandas
- Rolling 7-day revenueEasy · Rolling aggregates
- Cart-to-order conversionMedium · Funnels and conversion
- Find the bugs in an average order value notebookEasy · Code review
Python
Open all 220+ problems
Free, in your browser. No sign-up needed.
Data rules
The same in every SQL and Pandas problem. If a problem differs, it says so.
- All times are UTC. “In August” means Aug 1, 00:00 to Sep 1, 00:00 UTC. Weeks start on Monday.
- SQL filter for August:
created_at >= '2026-08-01' AND created_at < '2026-09-01'. - Only delivered orders count: in order counts, revenue, average order value, customers, and first or n-th orders.
- No need to round: answers are checked with a small tolerance. Give shares as 0–1 (0.25, not 25).
- Row order doesn’t matter; column names must match the problem exactly.
- The data ends on Sep 28, 2026, 5:00 AM UTC, so Sep 28 is a partial day.
- Pandas: tables are loaded as DataFrames with the same names; times are UTC strings. Put the answer in
result.