File size: 10,150 Bytes
02edc38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
/*
{
  "qid": "027",
  "task_type": "ambig",
  "has_intended_resolution": true,
  "language": "SQLite",
  "db": "professional_basketball",
  "question": "List all teams with low points allowed from the Western conference that have made the playoffs.",
  "gold_ambiguity_points": [
    {
      "id": "A",
      "phrase": "low points allowed",
      "type": "finite",
      "ambiguity_type": "semantic_computation",
      "interpretations": [
        "low total points allowed",
        "low points allowed per season",
        "low points allowed per game"
      ],
      "intended_interpretation_idx": 2
    },
    {
      "id": "B",
      "phrase": "low points allowed",
      "type": "infinite",
      "ambiguity_type": "semantic_value",
      "parameter_name": "points_allowed_threshold",
      "parameter_dtype": "int",
      "parameter_sample_operators": [
        "<",
        "<="
      ],
      "parameter_sample_values": [
        8200
      ],
      "intended_parameter_operator": "<",
      "intended_parameter_value": 8200
    },
    {
      "id": "C",
      "phrase": "made the playoffs",
      "type": "finite",
      "ambiguity_type": "semantic_computation",
      "interpretations": [
        "teams.playoff is not null",
        "appeared in the series_post table"
      ],
      "intended_interpretation_idx": 0
    }
  ],
  "gold_intended_query_id": "GQRY-A.2-C.0",
  "extra_info": {}
}
*/


----- START OF GOLD QUERY `GQRY-A.0-C.0` -----
/*
{
  "id": "GQRY-A.0-C.0",
  "parameter_names": [
    "points_allowed_threshold"
  ],
  "parameter_values": {
    "points_allowed_threshold": 8200
  },
  "other_exec_results": [],
  "required_columns": [
    1
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] made the playoffs": "teams.playoff is not null",
      "[B] low points allowed": "low total points allowed",
      "[C] low points allowed": ":points_allowed_threshold"
    }
  }
}
*/
SELECT t1.tmID, t1.name, SUM(t1.d_pts) AS total_points_allowed
FROM teams t1
WHERE t1.tmID IN (
SELECT DISTINCT tmID
FROM teams
WHERE confID = 'WC' AND playoff IS NOT NULL
)
GROUP BY t1.tmID, t1.name
HAVING SUM(t1.d_pts) < :points_allowed_threshold
ORDER BY SUM(t1.d_pts) ASC;
/* EXEC RESULT
Empty DataFrame
Columns: [tmID, name, total_points_allowed]
Index: []
*/
----- END OF GOLD QUERY -----


----- START OF GOLD QUERY `GQRY-A.0-C.1` -----
/*
{
  "id": "GQRY-A.0-C.1",
  "parameter_names": [
    "points_allowed_threshold"
  ],
  "parameter_values": {
    "points_allowed_threshold": 8200
  },
  "other_exec_results": [],
  "required_columns": [
    1
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] made the playoffs": "appeared in the series_post table",
      "[B] low points allowed": "low total points allowed",
      "[C] low points allowed": ":points_allowed_threshold"
    }
  }
}
*/
SELECT t1.tmID, t1.name, SUM(t1.d_pts) AS total_points_allowed
FROM teams t1
WHERE t1.tmID IN (
SELECT DISTINCT sp.tmIDWinner
FROM series_post sp
JOIN teams t ON sp.tmIDWinner = t.tmID AND sp.year = t.year
WHERE t.confID = 'WC'
UNION
SELECT DISTINCT sp.tmIDLoser
FROM series_post sp
JOIN teams t ON sp.tmIDLoser = t.tmID AND sp.year = t.year
WHERE t.confID = 'WC'
)
GROUP BY t1.tmID, t1.name
HAVING AVG(t1.d_pts) < :points_allowed_threshold
ORDER BY SUM(t1.d_pts) ASC;
/* EXEC RESULT
tmID                   name  total_points_allowed
 OKC  Oklahoma City Thunder                 31171
 NOH    New Orleans Hornets                 60759
 MEM      Memphis Grizzlies                 87032
 MIN Minnesota Timberwolves                183983
 UTA              Utah Jazz                267618
 SAS      San Antonio Spurs                294308
*/
----- END OF GOLD QUERY -----


----- START OF GOLD QUERY `GQRY-A.1-C.0` -----
/*
{
  "id": "GQRY-A.1-C.0",
  "parameter_names": [
    "points_allowed_threshold"
  ],
  "parameter_values": {
    "points_allowed_threshold": 8200
  },
  "other_exec_results": [],
  "required_columns": [
    1
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] made the playoffs": "teams.playoff is not null",
      "[B] low points allowed": "low points allowed per season",
      "[C] low points allowed": ":points_allowed_threshold"
    }
  }
}
*/
SELECT t1.tmID, t1.name, AVG(t1.d_pts) AS avg_points_allowed_per_season
FROM teams t1
WHERE t1.tmID IN (
SELECT DISTINCT tmID
FROM teams
WHERE confID = 'WC' AND playoff IS NOT NULL
)
GROUP BY t1.tmID, t1.name
HAVING AVG(t1.d_pts) < :points_allowed_threshold
ORDER BY AVG(t1.d_pts) ASC;
/* EXEC RESULT
tmID                   name  avg_points_allowed_per_season
 NOH    New Orleans Hornets                    7594.875000
 OKC  Oklahoma City Thunder                    7792.750000
 MEM      Memphis Grizzlies                    7912.000000
 MIN Minnesota Timberwolves                    7999.260870
 UTA              Utah Jazz                    8109.636364
 SAS      San Antonio Spurs                    8175.222222
*/
----- END OF GOLD QUERY -----


----- START OF GOLD QUERY `GQRY-A.1-C.1` -----
/*
{
  "id": "GQRY-A.1-C.1",
  "parameter_names": [
    "points_allowed_threshold"
  ],
  "parameter_values": {
    "points_allowed_threshold": 8200
  },
  "other_exec_results": [],
  "required_columns": [
    1
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] made the playoffs": "appeared in the series_post table",
      "[B] low points allowed": "low points allowed per season",
      "[C] low points allowed": ":points_allowed_threshold"
    }
  }
}
*/
SELECT t1.tmID, t1.name, AVG(t1.d_pts) AS avg_points_allowed_per_season
FROM teams t1
WHERE t1.tmID IN (
SELECT DISTINCT sp.tmIDWinner
FROM series_post sp
JOIN teams t ON sp.tmIDWinner = t.tmID AND sp.year = t.year
WHERE t.confID = 'WC'
UNION
SELECT DISTINCT sp.tmIDLoser
FROM series_post sp
JOIN teams t ON sp.tmIDLoser = t.tmID AND sp.year = t.year
WHERE t.confID = 'WC'
)
GROUP BY t1.tmID, t1.name
HAVING SUM(t1.d_pts) * 1.0 / SUM(t1.games) < :points_allowed_threshold
ORDER BY AVG(t1.d_pts) ASC;
/* EXEC RESULT
tmID                   name  avg_points_allowed_per_season
 NOH    New Orleans Hornets                    7594.875000
 OKC  Oklahoma City Thunder                    7792.750000
 MEM      Memphis Grizzlies                    7912.000000
 MIN Minnesota Timberwolves                    7999.260870
 UTA              Utah Jazz                    8109.636364
... TRUNCATED ...
 KCO         KC-Omaha Kings                    8689.333333
 DEN         Denver Nuggets                    8701.444444
 GSW  Golden State Warriors                    8708.609756
 KCK      Kansas City Kings                    9002.800000
 SFW San Francisco Warriors                    9227.888889
*/
----- END OF GOLD QUERY -----


----- START OF GOLD QUERY `GQRY-A.2-C.0` -----
/*
{
  "id": "GQRY-A.2-C.0",
  "parameter_names": [
    "points_allowed_threshold"
  ],
  "parameter_values": {
    "points_allowed_threshold": 8200
  },
  "other_exec_results": [],
  "required_columns": [
    1
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] made the playoffs": "teams.playoff is not null",
      "[B] low points allowed": "low points allowed per game",
      "[C] low points allowed": ":points_allowed_threshold"
    }
  }
}
*/
SELECT t1.tmID, t1.name, SUM(t1.d_pts) * 1.0 / SUM(t1.games) AS avg_points_allowed_per_game
FROM teams t1
WHERE t1.tmID IN (
SELECT DISTINCT tmID
FROM teams
WHERE confID = 'WC' AND playoff IS NOT NULL
)
GROUP BY t1.tmID, t1.name
HAVING SUM(t1.d_pts) * 1.0 / SUM(t1.games) < :points_allowed_threshold
ORDER BY SUM(t1.d_pts) * 1.0 / SUM(t1.games) ASC;
/* EXEC RESULT
tmID                  name  avg_points_allowed_per_game
 SEA   Seattle Supersonics                   104.656156
 KCO        KC-Omaha Kings                   105.967480
 CHI         Chicago Bulls                   108.236759
 KCK     Kansas City Kings                   109.790244
 SAS     San Antonio Spurs                   110.062827
... TRUNCATED ...
 SAC      Sacramento Kings                   116.392045
 DEN        Denver Nuggets                   117.147345
 MEM     Memphis Grizzlies                   132.670732
 NOH   New Orleans Hornets                   148.192683
 OKC Oklahoma City Thunder                   380.134146
*/
----- END OF GOLD QUERY -----


----- START OF GOLD QUERY `GQRY-A.2-C.1` -----
/*
{
  "id": "GQRY-A.2-C.1",
  "parameter_names": [
    "points_allowed_threshold"
  ],
  "parameter_values": {
    "points_allowed_threshold": 8200
  },
  "other_exec_results": [],
  "required_columns": [
    1
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] made the playoffs": "appeared in the series_post table",
      "[B] low points allowed": "low points allowed per game",
      "[C] low points allowed": ":points_allowed_threshold"
    }
  }
}
*/
SELECT t1.tmID, t1.name, SUM(t1.d_pts) * 1.0 / SUM(t1.games) AS avg_points_allowed_per_game
FROM teams t1
WHERE t1.tmID IN (
SELECT DISTINCT sp.tmIDWinner
FROM series_post sp
JOIN teams t ON sp.tmIDWinner = t.tmID AND sp.year = t.year
WHERE t.confID = 'WC'
UNION
SELECT DISTINCT sp.tmIDLoser
FROM series_post sp
JOIN teams t ON sp.tmIDLoser = t.tmID AND sp.year = t.year
WHERE t.confID = 'WC'
)
GROUP BY t1.tmID, t1.name
HAVING SUM(t1.d_pts) * 1.0 / SUM(t1.games) < :points_allowed_threshold
ORDER BY SUM(t1.d_pts) * 1.0 / SUM(t1.games) ASC;
/* EXEC RESULT
tmID                  name  avg_points_allowed_per_game
 SEA   Seattle Supersonics                   104.656156
 KCO        KC-Omaha Kings                   105.967480
 CHI         Chicago Bulls                   108.236759
 KCK     Kansas City Kings                   109.790244
 SAS     San Antonio Spurs                   110.062827
... TRUNCATED ...
 SAC      Sacramento Kings                   116.392045
 DEN        Denver Nuggets                   117.147345
 MEM     Memphis Grizzlies                   132.670732
 NOH   New Orleans Hornets                   148.192683
 OKC Oklahoma City Thunder                   380.134146
*/
----- END OF GOLD QUERY -----