Skip to main content

SQL Problems

Source: Problem prompts adapted from Ace the Data Science Interview — Chapter 8 Easy set (Huo & Singh). Seeds, SQLite solutions, and model answers here are original for this course.

Thirteen query drills plus eight short design/systems write-ups. Each SQL exercise ships its own seed database (≥15 rows per table where the prompt allows). Open the Data tab, write only a SELECT / WITH … SELECT, then Check. Runtime is SQLite via the wrap-seed runner — use CASE instead of Postgres IF, strftime / date() instead of DATE_TRUNC / INTERVAL when you need date math, and prefer LEFT JOIN over RIGHT JOIN.

Hints: restating the metric (“CTR = clicks / impressions in 2019”) before coding beats jumping into GROUP BY. Column names match the prompt schemas below.

Query problems (8.1–8.13)​

Design & concepts (8.14–8.21)​

Written answers — use the keywords when shown, then compare to the model answer.

0/8 solved
8.14Facebook

Using “view” and “query”, explain:

What is a database view? Name advantages views can have compared with base tables.

Minimum 3 words. Your answer must include: “view”, “query”.

0 words/ 3 min

Meet the writing requirements, then you can open the model answer.

Next: SQL problems — Medium for retention, rolling windows, co-purchase, and MapReduce design prompts.