Spaces:
Sleeping
Sleeping
Download data/medium.json from skillissue04/sql-repair-env: direct link, hf CLI and curl.
- Browser
- Download file 11 kB
-
https://huggingface.co/spaces/skillissue04/sql-repair-env/resolve/refs%2Fpr%2F1/data/medium.json
- Command line
-
hf download hf://spaces/skillissue04/sql-repair-env@refs/pr/1/data/medium.json
-
curl -L -o medium.json https://huggingface.co/spaces/skillissue04/sql-repair-env/resolve/refs%2Fpr%2F1/data/medium.json
11 kB
| [ | |
| { | |
| "id": "medium_001", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "users(id, name, email, age, city, active)", | |
| "orders(id, user_id, product_id, amount, status, created_at)" | |
| ] | |
| }, | |
| "intent": "Get names of users who have placed at least one order", | |
| "broken_query": "SELECT name FROM users, orders WHERE users.id = orders.id", | |
| "correct_query": "SELECT DISTINCT u.name FROM users u JOIN orders o ON u.id = o.user_id", | |
| "error_type": "join", | |
| "min_turns_expected": 2, | |
| "clarification_answers": { | |
| "join column in orders": "user_id links to users.id", | |
| "orders foreign key": "orders.user_id references users.id" | |
| } | |
| }, | |
| { | |
| "id": "medium_002", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "users(id, name, email, age, city, active)", | |
| "orders(id, user_id, product_id, amount, status, created_at)" | |
| ] | |
| }, | |
| "intent": "Find total amount spent per user, show user name and total", | |
| "broken_query": "SELECT name, SUM(amount) FROM users JOIN orders ON users.id = orders.id GROUP BY name", | |
| "correct_query": "SELECT u.name, SUM(o.amount) AS total FROM users u JOIN orders o ON u.id = o.user_id GROUP BY u.id, u.name", | |
| "error_type": "join", | |
| "min_turns_expected": 2, | |
| "clarification_answers": { | |
| "join key": "orders.user_id = users.id", | |
| "amount column": "in orders table, type REAL" | |
| } | |
| }, | |
| { | |
| "id": "medium_003", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "users(id, name, email, age, city, active)", | |
| "orders(id, user_id, product_id, amount, status, created_at)" | |
| ] | |
| }, | |
| "intent": "Get users who have never placed an order", | |
| "broken_query": "SELECT * FROM users WHERE id NOT IN (SELECT id FROM orders)", | |
| "correct_query": "SELECT * FROM users WHERE id NOT IN (SELECT user_id FROM orders)", | |
| "error_type": "logic", | |
| "min_turns_expected": 2, | |
| "clarification_answers": { | |
| "orders column for user": "user_id, not id" | |
| } | |
| }, | |
| { | |
| "id": "medium_004", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "users(id, name, email, age, city, active)", | |
| "orders(id, user_id, product_id, amount, status, created_at)" | |
| ] | |
| }, | |
| "intent": "Find all delivered orders with the buyer's name", | |
| "broken_query": "SELECT users.name, orders.amount FROM users RIGHT JOIN orders WHERE status = 'delivered'", | |
| "correct_query": "SELECT u.name, o.amount FROM users u JOIN orders o ON u.id = o.user_id WHERE o.status = 'delivered'", | |
| "error_type": "join", | |
| "min_turns_expected": 2, | |
| "clarification_answers": { | |
| "status values": "pending, shipped, delivered, cancelled", | |
| "join syntax": "ON u.id = o.user_id" | |
| } | |
| }, | |
| { | |
| "id": "medium_005", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "users(id, name, email, age, city, active)", | |
| "orders(id, user_id, product_id, amount, status, created_at)" | |
| ] | |
| }, | |
| "intent": "Count orders per user only for active users", | |
| "broken_query": "SELECT user_id, COUNT(*) FROM orders GROUP BY user_id WHERE active = 1", | |
| "correct_query": "SELECT o.user_id, COUNT(*) FROM orders o JOIN users u ON o.user_id = u.id WHERE u.active = 1 GROUP BY o.user_id", | |
| "error_type": "logic", | |
| "min_turns_expected": 2, | |
| "clarification_answers": { | |
| "where vs having": "WHERE must come before GROUP BY", | |
| "active column location": "active is in users table" | |
| } | |
| }, | |
| { | |
| "id": "medium_006", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "orders(id, user_id, product_id, amount, status, created_at)", | |
| "products(id, name, category, price, stock)" | |
| ] | |
| }, | |
| "intent": "Get product names and total revenue for electronics category", | |
| "broken_query": "SELECT name, SUM(amount) FROM products JOIN orders ON products.id = orders.id WHERE category = 'electronics'", | |
| "correct_query": "SELECT p.name, SUM(o.amount) AS revenue FROM products p JOIN orders o ON p.id = o.product_id WHERE p.category = 'electronics' GROUP BY p.id, p.name", | |
| "error_type": "join", | |
| "min_turns_expected": 2, | |
| "clarification_answers": { | |
| "join key for products and orders": "orders.product_id = products.id", | |
| "category values": "stationery, electronics, furniture" | |
| } | |
| }, | |
| { | |
| "id": "medium_007", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "orders(id, user_id, product_id, amount, status, created_at)", | |
| "products(id, name, category, price, stock)" | |
| ] | |
| }, | |
| "intent": "Find products that have never been ordered", | |
| "broken_query": "SELECT * FROM products WHERE id NOT IN (SELECT id FROM orders)", | |
| "correct_query": "SELECT * FROM products WHERE id NOT IN (SELECT product_id FROM orders)", | |
| "error_type": "logic", | |
| "min_turns_expected": 2, | |
| "clarification_answers": { | |
| "orders column for product": "product_id, not id" | |
| } | |
| }, | |
| { | |
| "id": "medium_008", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "users(id, name, email, age, city, active)", | |
| "orders(id, user_id, product_id, amount, status, created_at)" | |
| ] | |
| }, | |
| "intent": "Get total amount of cancelled orders per city", | |
| "broken_query": "SELECT city, SUM(amount) FROM orders WHERE status = 'cancelled' GROUP BY city", | |
| "correct_query": "SELECT u.city, SUM(o.amount) AS cancelled_total FROM users u JOIN orders o ON u.id = o.user_id WHERE o.status = 'cancelled' GROUP BY u.city", | |
| "error_type": "join", | |
| "min_turns_expected": 2, | |
| "clarification_answers": { | |
| "city column location": "city is in the users table", | |
| "cancelled status spelling": "cancelled with double l" | |
| } | |
| }, | |
| { | |
| "id": "medium_009", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "users(id, name, email, age, city, active)", | |
| "orders(id, user_id, product_id, amount, status, created_at)" | |
| ] | |
| }, | |
| "intent": "Find users who placed more than 2 orders", | |
| "broken_query": "SELECT name FROM users JOIN orders ON users.id = orders.user_id WHERE COUNT(*) > 2", | |
| "correct_query": "SELECT u.name FROM users u JOIN orders o ON u.id = o.user_id GROUP BY u.id, u.name HAVING COUNT(*) > 2", | |
| "error_type": "logic", | |
| "min_turns_expected": 2, | |
| "clarification_answers": { | |
| "aggregate filter": "use HAVING not WHERE for aggregate conditions" | |
| } | |
| }, | |
| { | |
| "id": "medium_010", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "orders(id, user_id, product_id, amount, status, created_at)", | |
| "products(id, name, category, price, stock)" | |
| ] | |
| }, | |
| "intent": "Get the most expensive product that has been ordered at least once", | |
| "broken_query": "SELECT * FROM products ORDER BY price DESC WHERE id IN (SELECT product_id FROM orders) LIMIT 1", | |
| "correct_query": "SELECT * FROM products WHERE id IN (SELECT product_id FROM orders) ORDER BY price DESC LIMIT 1", | |
| "error_type": "syntax", | |
| "min_turns_expected": 2, | |
| "clarification_answers": { | |
| "clause order": "WHERE must come before ORDER BY" | |
| } | |
| }, | |
| { | |
| "id": "medium_011", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "users(id, name, email, age, city, active)", | |
| "orders(id, user_id, product_id, amount, status, created_at)" | |
| ] | |
| }, | |
| "intent": "Get the average order amount per active user", | |
| "broken_query": "SELECT AVG(amount) FROM orders WHERE user_id IN (SELECT id FROM users WHERE active = 1) GROUP user_id", | |
| "correct_query": "SELECT o.user_id, AVG(o.amount) FROM orders o WHERE o.user_id IN (SELECT id FROM users WHERE active = 1) GROUP BY o.user_id", | |
| "error_type": "syntax", | |
| "min_turns_expected": 2, | |
| "clarification_answers": {} | |
| }, | |
| { | |
| "id": "medium_012", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "users(id, name, email, age, city, active)", | |
| "orders(id, user_id, product_id, amount, status, created_at)" | |
| ] | |
| }, | |
| "intent": "List all users with their most recent order date, include users with no orders", | |
| "broken_query": "SELECT u.name, MAX(o.created_at) FROM users u JOIN orders o ON u.id = o.user_id GROUP BY u.name", | |
| "correct_query": "SELECT u.name, MAX(o.created_at) AS last_order FROM users u LEFT JOIN orders o ON u.id = o.user_id GROUP BY u.id, u.name", | |
| "error_type": "join", | |
| "min_turns_expected": 2, | |
| "clarification_answers": { | |
| "include users with no orders": "use LEFT JOIN to keep all users", | |
| "created_at type": "TEXT, ISO date format YYYY-MM-DD" | |
| } | |
| }, | |
| { | |
| "id": "medium_013", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "orders(id, user_id, product_id, amount, status, created_at)", | |
| "products(id, name, category, price, stock)" | |
| ] | |
| }, | |
| "intent": "Get each category and number of distinct products ordered", | |
| "broken_query": "SELECT category, COUNT(orders.id) FROM products JOIN orders ON products.id = orders.product_id GROUP BY category", | |
| "correct_query": "SELECT p.category, COUNT(DISTINCT p.id) AS products_ordered FROM products p JOIN orders o ON p.id = o.product_id GROUP BY p.category", | |
| "error_type": "logic", | |
| "min_turns_expected": 2, | |
| "clarification_answers": { | |
| "distinct products": "use COUNT(DISTINCT product_id) to avoid counting same product multiple times" | |
| } | |
| }, | |
| { | |
| "id": "medium_014", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "users(id, name, email, age, city, active)", | |
| "orders(id, user_id, product_id, amount, status, created_at)" | |
| ] | |
| }, | |
| "intent": "Get users who placed orders in both January and March 2024", | |
| "broken_query": "SELECT DISTINCT u.name FROM users u JOIN orders o ON u.id = o.user_id WHERE o.created_at LIKE '2024-01%' AND o.created_at LIKE '2024-03%'", | |
| "correct_query": "SELECT u.name FROM users u JOIN orders o1 ON u.id = o1.user_id AND o1.created_at LIKE '2024-01%' JOIN orders o2 ON u.id = o2.user_id AND o2.created_at LIKE '2024-03%'", | |
| "error_type": "logic", | |
| "min_turns_expected": 3, | |
| "clarification_answers": { | |
| "created_at format": "YYYY-MM-DD string", | |
| "how to match both months": "join orders table twice, once per month" | |
| } | |
| }, | |
| { | |
| "id": "medium_015", | |
| "difficulty": "medium", | |
| "schema": { | |
| "tables": [ | |
| "users(id, name, email, age, city, active)", | |
| "orders(id, user_id, product_id, amount, status, created_at)" | |
| ] | |
| }, | |
| "intent": "Find users whose total order amount exceeds 400", | |
| "broken_query": "SELECT name FROM users u JOIN orders o ON u.id = o.user_id WHERE SUM(o.amount) > 400", | |
| "correct_query": "SELECT u.name FROM users u JOIN orders o ON u.id = o.user_id GROUP BY u.id, u.name HAVING SUM(o.amount) > 400", | |
| "error_type": "logic", | |
| "min_turns_expected": 2, | |
| "clarification_answers": { | |
| "aggregate in WHERE": "SUM cannot be used in WHERE; use HAVING after GROUP BY" | |
| } | |
| } | |
| ] | |