{"tasks":[{"task_id":"easy_1","difficulty":"easy","bug_category":"syntax","description":"Fix syntax errors. Return name, department, salary of active Engineering employees earning over $80,000, ordered by salary DESC.","broken_query":"SELCT name, department, salary FORM employees WERE department = 'Engineering' AND salary > 80000 AND status = 'active' ORDR BY salary DESC","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"easy_2","difficulty":"easy","bug_category":"syntax","description":"Fix syntax error. Return department names and budgets over 250000, ordered by budget DESC.","broken_query":"SELECT name, budget FROM departments WHERE budget > 250000 ORER BY budget DESC","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"easy_3","difficulty":"easy","bug_category":"syntax","description":"Fix syntax error. Count active employees per department.","broken_query":"SELECT department, CONT(*) AS emp_count FROM employees WHERE status = 'active' GROUB BY department","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"easy_4","difficulty":"easy","bug_category":"syntax","description":"Fix syntax error. Return names and budgets of all active projects.","broken_query":"SELCT name, budget FEOM projects WHERE status = 'active'","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"easy_5","difficulty":"easy","bug_category":"syntax","description":"Fix syntax error. Return employee names and salaries hired after 2020, ordered by hire_date.","broken_query":"SELECT name, salary, hire_date FROM employees WHER hire_date > '2020-12-31' ORDER BE hire_date","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"easy_6","difficulty":"easy","bug_category":"syntax","description":"Fix syntax error. Return the total budget across all departments.","broken_query":"SELEC SUM(budget) AS total_budget FORM departments","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"easy_7","difficulty":"easy","bug_category":"syntax","description":"Fix syntax error. Return distinct product categories, ordered alphabetically.","broken_query":"SELECT DESTINCT category FORM products ORDRE BY category","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"medium_1","difficulty":"medium","bug_category":"join","description":"Fix the JOIN. Return each employee name, their project name, and hours_worked, ordered by employee name.","broken_query":"SELECT e.name, p.name AS project_name, ep.hours_worked\nFROM employees e\nJOIN employee_projects ep ON e.id = ep.project_id\nJOIN projects p ON ep.employee_id = p.id\nORDER BY e.name","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"medium_2","difficulty":"medium","bug_category":"having","description":"Fix WHERE/HAVING. Return departments with average salary above $85,000.","broken_query":"SELECT department, COUNT(*) AS emp_count, AVG(salary) AS avg_salary\nFROM employees\nGROUP BY department\nWHERE AVG(salary) > 85000\nORDER BY avg_salary DESC","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"medium_3","difficulty":"medium","bug_category":"join","description":"Fix the JOIN. Return project names with department names and locations.","broken_query":"SELECT p.name AS project_name, d.name AS dept_name, d.location\nFROM projects p\nJOIN departments d ON p.id = d.id\nORDER BY p.name","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"medium_4","difficulty":"medium","bug_category":"subquery","description":"Fix the subquery. Return employees who earn more than the AVERAGE salary of their department.","broken_query":"SELECT e.name, e.department, e.salary\nFROM employees e\nWHERE e.salary > (\n    SELECT MAX(salary) FROM employees\n    WHERE department = e.department\n)\nORDER BY e.department, e.salary DESC","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"medium_5","difficulty":"medium","bug_category":"join","description":"Fix the JOIN. Return each salesperson name with their total sales amount.","broken_query":"SELECT e.name, SUM(s.amount) AS total_sales\nFROM employees e\nJOIN sales s ON s.id = e.id\nGROUP BY e.name\nORDER BY total_sales DESC","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"medium_6","difficulty":"medium","bug_category":"join","description":"Fix the JOIN. Return employee names with their 2023 performance review ratings.","broken_query":"SELECT e.name, pr.rating, pr.year\nFROM employees e\nJOIN performance_reviews pr ON pr.reviewer_id = e.id\nWHERE pr.year = 2023\nORDER BY pr.rating DESC","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"medium_7","difficulty":"medium","bug_category":"having","description":"Fix HAVING clause. Return product categories where total stock exceeds 200 units.","broken_query":"SELECT category, SUM(stock) AS total_stock, COUNT(*) AS product_count\nFROM products\nGROUP BY category\nWHERE SUM(stock) > 200\nORDER BY total_stock DESC","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"hard_1","difficulty":"hard","bug_category":"join_type","description":"Fix the JOIN type. Return departments with their total active project budget and count. Include only departments with active projects.","broken_query":"SELECT d.name, SUM(p.budget) AS total_budget, COUNT(p.id) AS project_count\nFROM departments d\nLEFT JOIN projects p ON d.id = p.department_id\nWHERE p.status = 'active'\nGROUP BY d.name\nHAVING COUNT(p.id) > 0\nORDER BY total_budget DESC","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"hard_2","difficulty":"hard","bug_category":"self_join","description":"Fix the self-join. Return each employee's name and their manager's name. Employees without managers show NULL.","broken_query":"SELECT e.name AS employee_name, m.name AS manager_name\nFROM employees e\nJOIN employees m ON m.id = e.id\nORDER BY e.name","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"hard_3","difficulty":"hard","bug_category":"group_by","description":"Fix the GROUP BY error. Return the top earning employee in each department with their salary.","broken_query":"SELECT department, name, MAX(salary) AS max_salary\nFROM employees\nGROUP BY department\nORDER BY max_salary DESC","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"hard_4","difficulty":"hard","bug_category":"having","description":"Fix. Return total sales per region per product, only where total exceeds 5000.","broken_query":"SELECT region, product, SUM(amount) AS total_sales\nFROM sales\nWHERE SUM(amount) > 5000\nGROUP BY region, product\nORDER BY total_sales DESC","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"hard_5","difficulty":"hard","bug_category":"duplicate_count","description":"Fix multi-table query. Return each department name, total salary cost, and total project budget. Include all departments.","broken_query":"SELECT d.name,\n       SUM(e.salary) AS total_salary,\n       SUM(p.budget) AS total_project_budget\nFROM departments d\nJOIN employees e ON e.department = d.name\nJOIN projects p ON p.department_id = d.id\nGROUP BY d.name\nORDER BY total_salary DESC","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}},{"task_id":"hard_6","difficulty":"hard","bug_category":"having","description":"Fix. Return employees who have worked on MORE THAN ONE project, with their project count.","broken_query":"SELECT e.name, COUNT(ep.project_id) AS project_count\nFROM employees e\nJOIN employee_projects ep ON ep.employee_id = e.id\nWHERE COUNT(ep.project_id) > 1\nGROUP BY e.name\nORDER BY project_count DESC","action_schema":{"sql_query":"string — your corrected SQL query (graded)","diagnostic":"string — optional: run any SQL to explore the DB for free","explanation":"string — optional reasoning"}}],"total":20,"difficulty_breakdown":{"easy":7,"medium":7,"hard":6},"bug_categories":{"syntax":"Misspelled SQL keywords","join":"Wrong JOIN column references","having":"WHERE used instead of HAVING with aggregates","subquery":"Wrong aggregate function in correlated subquery","join_type":"Wrong JOIN type (LEFT vs INNER) with WHERE filter","self_join":"Self-join with wrong column and missing LEFT JOIN","group_by":"Non-aggregated column in SELECT with GROUP BY","duplicate_count":"Duplicate rows from multi-table join — needs SUM(DISTINCT)"},"action_schema":{"sql_query":"string (required for grading) — your corrected SQL query","diagnostic":"string (optional, free) — any SQL to explore the DB without using an attempt","explanation":"string (optional) — your reasoning"}}