File size: 9,521 Bytes
a778809 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | {"answer": [[20, 158226], [31, 157905], [22, 135087], [29, 127309]], "answer_rows": 4, "difficulty": "hard", "gold_sql": "SELECT o.customer_id, SUM(o.qty*p.price_cents) AS spend FROM orders o JOIN products p ON p.id=o.product_id GROUP BY o.customer_id ORDER BY spend DESC, o.customer_id ASC LIMIT 4;", "id": "sq1-0000", "question": "List the top 4 customer ids by total spend in cents (qty times price_cents), highest first, ties broken by lower id. Return id and spend.", "template": "top_cust"}
{"answer": [[13]], "answer_rows": 1, "difficulty": "easy", "gold_sql": "SELECT COUNT(*) FROM customers WHERE joined < '2025-07-01';", "id": "sq1-0001", "question": "How many customers joined before 2025-07-01?", "template": "joined"}
{"answer": [[9]], "answer_rows": 1, "difficulty": "easy", "gold_sql": "SELECT COUNT(*) FROM customers WHERE city = 'Glen';", "id": "sq1-0002", "question": "How many customers live in Glen?", "template": "count_city"}
{"answer": [[4]], "answer_rows": 1, "difficulty": "easy", "gold_sql": "SELECT COUNT(*) FROM customers WHERE city = 'Cedar';", "id": "sq1-0003", "question": "How many customers live in Cedar?", "template": "count_city"}
{"answer": [[1]], "answer_rows": 1, "difficulty": "medium", "gold_sql": "SELECT COUNT(*) FROM customers WHERE city = 'Avon' AND tier = 'free';", "id": "sq1-0004", "question": "How many 'free' tier customers live in Avon?", "template": "city_tier"}
{"answer": [[1], [52], [89], [144], [158]], "answer_rows": 5, "difficulty": "easy", "gold_sql": "SELECT id FROM orders WHERE customer_id = 35 ORDER BY id;", "id": "sq1-0005", "question": "List the order ids placed by customer 35, sorted ascending.", "template": "cust_orders"}
{"answer": [[23]], "answer_rows": 1, "difficulty": "easy", "gold_sql": "SELECT COUNT(*) FROM orders WHERE substr(order_date,1,7) = '2026-04';", "id": "sq1-0006", "question": "How many orders were placed in 2026-04?", "template": "month"}
{"answer": [[9, 8902], [11, 9892], [21, 9520], [27, 9084], [29, 9373]], "answer_rows": 5, "difficulty": "easy", "gold_sql": "SELECT id, price_cents FROM products WHERE price_cents > 8500 ORDER BY id;", "id": "sq1-0007", "question": "List product ids and price_cents for products priced above 8500 cents, sorted by id.", "template": "price"}
{"answer": [[72]], "answer_rows": 1, "difficulty": "medium", "gold_sql": "SELECT COALESCE(SUM(o.qty),0) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.city = 'Harbor';", "id": "sq1-0008", "question": "What is the total qty ordered by customers in Harbor?", "template": "city_qty"}
{"answer": [[595389]], "answer_rows": 1, "difficulty": "medium", "gold_sql": "SELECT COALESCE(SUM(o.qty*p.price_cents),0) FROM orders o JOIN products p ON p.id=o.product_id WHERE p.category = 'audio';", "id": "sq1-0009", "question": "What is the total revenue in cents from products in category 'audio' (qty times price_cents)?", "template": "rev_cat"}
{"answer": [[22]], "answer_rows": 1, "difficulty": "hard", "gold_sql": "SELECT COALESCE(SUM(o.qty),0) FROM orders o JOIN customers c ON c.id=o.customer_id JOIN products p ON p.id=o.product_id WHERE c.city = 'Brook' AND p.category = 'kitchen';", "id": "sq1-0010", "question": "What total qty of 'kitchen' products was ordered by customers in Brook?", "template": "city_cat"}
{"answer": [[2.7083]], "answer_rows": 1, "difficulty": "medium", "gold_sql": "SELECT ROUND(AVG(o.qty),4) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.tier = 'pro';", "id": "sq1-0011", "question": "What is the average order qty for customers in tier 'pro', rounded to 4 decimals?", "template": "tier_avg"}
{"answer": [[2.7222]], "answer_rows": 1, "difficulty": "medium", "gold_sql": "SELECT ROUND(AVG(o.qty),4) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.tier = 'free';", "id": "sq1-0012", "question": "What is the average order qty for customers in tier 'free', rounded to 4 decimals?", "template": "tier_avg"}
{"answer": [[1, 8477], [3, 6069], [6, 5955], [9, 8902], [11, 9892], [17, 8483], [21, 9520], [23, 7890], [24, 6986], [26, 7018], [27, 9084], [29, 9373]], "answer_rows": 12, "difficulty": "easy", "gold_sql": "SELECT id, price_cents FROM products WHERE price_cents > 5750 ORDER BY id;", "id": "sq1-0013", "question": "List product ids and price_cents for products priced above 5750 cents, sorted by id.", "template": "price"}
{"answer": [[194]], "answer_rows": 1, "difficulty": "medium", "gold_sql": "SELECT id FROM orders WHERE order_date BETWEEN '2026-07-17' AND '2026-07-23' ORDER BY id;", "id": "sq1-0014", "question": "List the ids of orders placed from 2026-07-17 to 2026-07-23 inclusive, sorted ascending.", "template": "range"}
{"answer": [[11]], "answer_rows": 1, "difficulty": "hard", "gold_sql": "SELECT COALESCE(SUM(o.qty),0) FROM orders o JOIN customers c ON c.id=o.customer_id JOIN products p ON p.id=o.product_id WHERE c.city = 'Dover' AND p.category = 'audio';", "id": "sq1-0015", "question": "What total qty of 'audio' products was ordered by customers in Dover?", "template": "city_cat"}
{"answer": [[26]], "answer_rows": 1, "difficulty": "easy", "gold_sql": "SELECT COUNT(*) FROM orders WHERE substr(order_date,1,7) = '2026-05';", "id": "sq1-0016", "question": "How many orders were placed in 2026-05?", "template": "month"}
{"answer": [[6]], "answer_rows": 1, "difficulty": "easy", "gold_sql": "SELECT COUNT(*) FROM customers WHERE city = 'Elm';", "id": "sq1-0017", "question": "How many customers live in Elm?", "template": "count_city"}
{"answer": [[34]], "answer_rows": 1, "difficulty": "medium", "gold_sql": "SELECT COALESCE(SUM(o.qty),0) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.city = 'Avon';", "id": "sq1-0018", "question": "What is the total qty ordered by customers in Avon?", "template": "city_qty"}
{"answer": [[73]], "answer_rows": 1, "difficulty": "medium", "gold_sql": "SELECT COALESCE(SUM(o.qty),0) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.city = 'Elm';", "id": "sq1-0019", "question": "What is the total qty ordered by customers in Elm?", "template": "city_qty"}
{"answer": [[20, 158226], [31, 157905], [22, 135087]], "answer_rows": 3, "difficulty": "hard", "gold_sql": "SELECT o.customer_id, SUM(o.qty*p.price_cents) AS spend FROM orders o JOIN products p ON p.id=o.product_id GROUP BY o.customer_id ORDER BY spend DESC, o.customer_id ASC LIMIT 3;", "id": "sq1-0020", "question": "List the top 3 customer ids by total spend in cents (qty times price_cents), highest first, ties broken by lower id. Return id and spend.", "template": "top_cust"}
{"answer": [[1]], "answer_rows": 1, "difficulty": "medium", "gold_sql": "SELECT COUNT(*) FROM customers WHERE city = 'Avon' AND tier = 'plus';", "id": "sq1-0021", "question": "How many 'plus' tier customers live in Avon?", "template": "city_tier"}
{"answer": [[1], [2], [3], [4], [5], [8], [9], [11], [13], [14], [16], [17], [19], [21], [22], [27], [28], [30], [31], [32], [33], [35], [36], [39], [40]], "answer_rows": 25, "difficulty": "hard", "gold_sql": "SELECT id FROM customers WHERE id NOT IN (SELECT o.customer_id FROM orders o JOIN products p ON p.id=o.product_id WHERE p.category = 'toys') ORDER BY id;", "id": "sq1-0022", "question": "Which customer ids never ordered a product in category 'toys'? Sort ascending.", "template": "never"}
{"answer": [[24]], "answer_rows": 1, "difficulty": "easy", "gold_sql": "SELECT COUNT(*) FROM orders WHERE substr(order_date,1,7) = '2026-02';", "id": "sq1-0023", "question": "How many orders were placed in 2026-02?", "template": "month"}
{"answer": [[3], [6], [7], [11], [13], [14], [15], [17], [18], [20], [23], [24], [25], [26], [27], [36], [37], [39]], "answer_rows": 18, "difficulty": "hard", "gold_sql": "SELECT id FROM customers WHERE id NOT IN (SELECT o.customer_id FROM orders o JOIN products p ON p.id=o.product_id WHERE p.category = 'garden') ORDER BY id;", "id": "sq1-0024", "question": "Which customer ids never ordered a product in category 'garden'? Sort ascending.", "template": "never"}
{"answer": [[2.96]], "answer_rows": 1, "difficulty": "medium", "gold_sql": "SELECT ROUND(AVG(o.qty),4) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.tier = 'plus';", "id": "sq1-0025", "question": "What is the average order qty for customers in tier 'plus', rounded to 4 decimals?", "template": "tier_avg"}
{"answer": [[293504]], "answer_rows": 1, "difficulty": "medium", "gold_sql": "SELECT COALESCE(SUM(o.qty*p.price_cents),0) FROM orders o JOIN products p ON p.id=o.product_id WHERE p.category = 'toys';", "id": "sq1-0026", "question": "What is the total revenue in cents from products in category 'toys' (qty times price_cents)?", "template": "rev_cat"}
{"answer": [[84], [98], [178], [180]], "answer_rows": 4, "difficulty": "easy", "gold_sql": "SELECT id FROM orders WHERE customer_id = 24 ORDER BY id;", "id": "sq1-0027", "question": "List the order ids placed by customer 24, sorted ascending.", "template": "cust_orders"}
{"answer": [[1]], "answer_rows": 1, "difficulty": "medium", "gold_sql": "SELECT COUNT(*) FROM customers WHERE city = 'Harbor' AND tier = 'plus';", "id": "sq1-0028", "question": "How many 'plus' tier customers live in Harbor?", "template": "city_tier"}
{"answer": [[11]], "answer_rows": 1, "difficulty": "medium", "gold_sql": "SELECT COUNT(DISTINCT o.customer_id) FROM orders o JOIN products p ON p.id=o.product_id WHERE p.category = 'tools';", "id": "sq1-0029", "question": "How many distinct customers ordered at least one 'tools' product?", "template": "cat_distinct"}
|