File size: 4,671 Bytes
f812d5b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
[
  {
    "id": "easy_001",
    "category": "syntax",
    "description": "Fix the SQL syntax error: missing comma in SELECT clause.",
    "buggy_query": "SELECT id name email FROM users WHERE active = 1",
    "fixed_query": "SELECT id, name, email FROM users WHERE active = 1",
    "error_message": "ERROR: syntax error at or near 'name'",
    "database_schema": {
      "users": ["id INT PRIMARY KEY", "name VARCHAR(100)", "email VARCHAR(100)", "active INT"]
    },
    "expected_output": [
      {"id": 1, "name": "Alice", "email": "alice@example.com"},
      {"id": 2, "name": "Bob",   "email": "bob@example.com"}
    ],
    "error_type": "syntax",
    "error_location": "SELECT clause",
    "fix_description": "Add missing commas between column names in SELECT clause",
    "estimated_fix_steps": 2,
    "partial_credit_hints": {
      "identifies_location": 0.2,
      "identifies_error_type": 0.2,
      "correct_fix": 0.5,
      "explanation": 0.1
    }
  },
  {
    "id": "easy_002",
    "category": "syntax",
    "description": "Fix the SQL syntax error: missing WHERE keyword.",
    "buggy_query": "SELECT * FROM orders id = 101",
    "fixed_query": "SELECT * FROM orders WHERE id = 101",
    "error_message": "ERROR: syntax error at or near 'id'",
    "database_schema": {
      "orders": ["id INT PRIMARY KEY", "user_id INT", "total DECIMAL", "status VARCHAR(20)"]
    },
    "expected_output": [
      {"id": 101, "user_id": 5, "total": 250.00, "status": "shipped"}
    ],
    "error_type": "syntax",
    "error_location": "FROM clause",
    "fix_description": "Add missing WHERE keyword before the filter condition",
    "estimated_fix_steps": 2,
    "partial_credit_hints": {
      "identifies_location": 0.2,
      "identifies_error_type": 0.2,
      "correct_fix": 0.5,
      "explanation": 0.1
    }
  },
  {
    "id": "easy_003",
    "category": "syntax",
    "description": "Fix the SQL syntax error: unclosed string literal.",
    "buggy_query": "SELECT * FROM products WHERE category = 'electronics",
    "fixed_query": "SELECT * FROM products WHERE category = 'electronics'",
    "error_message": "ERROR: unterminated quoted string at or near \"'electronics\"",
    "database_schema": {
      "products": ["id INT PRIMARY KEY", "name VARCHAR(100)", "category VARCHAR(50)", "price DECIMAL"]
    },
    "expected_output": [
      {"id": 3, "name": "Laptop", "category": "electronics", "price": 999.99}
    ],
    "error_type": "syntax",
    "error_location": "WHERE clause string literal",
    "fix_description": "Close the single quote at the end of 'electronics'",
    "estimated_fix_steps": 1,
    "partial_credit_hints": {
      "identifies_location": 0.2,
      "identifies_error_type": 0.2,
      "correct_fix": 0.5,
      "explanation": 0.1
    }
  },
  {
    "id": "easy_004",
    "category": "syntax",
    "description": "Fix the SQL syntax error: wrong keyword ORDER used instead of ORDER BY.",
    "buggy_query": "SELECT id, name, price FROM products ORDER price DESC",
    "fixed_query": "SELECT id, name, price FROM products ORDER BY price DESC",
    "error_message": "ERROR: syntax error at or near 'price'",
    "database_schema": {
      "products": ["id INT PRIMARY KEY", "name VARCHAR(100)", "category VARCHAR(50)", "price DECIMAL"]
    },
    "expected_output": [
      {"id": 7, "name": "TV", "price": 1200.00},
      {"id": 3, "name": "Laptop", "price": 999.99}
    ],
    "error_type": "syntax",
    "error_location": "ORDER clause",
    "fix_description": "Replace ORDER with ORDER BY",
    "estimated_fix_steps": 1,
    "partial_credit_hints": {
      "identifies_location": 0.2,
      "identifies_error_type": 0.2,
      "correct_fix": 0.5,
      "explanation": 0.1
    }
  },
  {
    "id": "easy_005",
    "category": "syntax",
    "description": "Fix the SQL syntax error: GROUP used instead of GROUP BY.",
    "buggy_query": "SELECT department, COUNT(*) FROM employees GROUP department",
    "fixed_query": "SELECT department, COUNT(*) FROM employees GROUP BY department",
    "error_message": "ERROR: syntax error at or near 'department'",
    "database_schema": {
      "employees": ["id INT PRIMARY KEY", "name VARCHAR(100)", "department VARCHAR(50)", "salary DECIMAL"]
    },
    "expected_output": [
      {"department": "Engineering", "count": 12},
      {"department": "Marketing",   "count": 8}
    ],
    "error_type": "syntax",
    "error_location": "GROUP clause",
    "fix_description": "Replace GROUP with GROUP BY",
    "estimated_fix_steps": 1,
    "partial_credit_hints": {
      "identifies_location": 0.2,
      "identifies_error_type": 0.2,
      "correct_fix": 0.5,
      "explanation": 0.1
    }
  }
]