Create beginner Works with: Any AI

SQL Practice Questions With Answers on Joins, Aggregation and Subqueries

Structured brief

Self-study set built on a small invented schema.

The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.

[VERIFY] is an editorial flag, not a blank to fill. Wherever the prompt shows [VERIFY], check that item against a reliable source before you use it.

Rate this prompt

Loading ratings…

Create SQL practice questions. A small invented schema of customers, orders and products with a few rows described in text: [SCHEMA_AND_ROWS]. My level and the topics I want to practise: [LEVEL_AND_TOPICS].

Provide the sample data in full so answers can be checked: five customers (1 to 5), six orders with amounts 100, 50, 75, 200, 30 and 60, and eight order lines. Write twelve questions of increasing difficulty covering joins (inner, left), aggregation with GROUP BY and HAVING, date filtering, subqueries, and rows with no matches. Write the first four in full with hint, answer query and the expected result table computed from the sample rows (for example total revenue 515, customers with no orders 1), and the remaining eight as prompts with answer outlines. Include two common-mistake questions where a join duplicates rows, such as why summing the order amount after joining to order lines gives a larger number, with arithmetic. Explain how to check answers by counting rows and totals. The expected results must be correct for the sample data. Mark dialect differences [VERIFY].

Fill in before use

Optional: type your details and the prompt above updates. Nothing is saved or sent.

Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.

Related prompts