File size: 8,009 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
/*
{
  "qid": "030",
  "task_type": "ambig",
  "has_intended_resolution": true,
  "language": "SQLite",
  "db": "professional_basketball",
  "question": "Compute the total post-season offensive rebounds and games played in their career for each player born in Oklahoma.",
  "gold_ambiguity_points": [
    {
      "id": "A",
      "phrase": "total post-season offensive rebounds and games played",
      "type": "finite",
      "ambiguity_type": "syntactic_column",
      "interpretations": [
        "total post-season offensive rebounds and post-season games played",
        "total post-season offensive rebounds and all games played"
      ],
      "intended_interpretation_idx": 1
    },
    {
      "id": "B",
      "phrase": "Oklahoma",
      "type": "finite",
      "ambiguity_type": "semantic_column",
      "interpretations": [
        "Oklahoma State",
        "Oklahoma City"
      ],
      "intended_interpretation_idx": 1
    }
  ],
  "gold_intended_query_id": "GQRY-A.1-B.1",
  "extra_info": {}
}
*/


----- START OF GOLD QUERY `GQRY-A.0-B.0` -----
/*
{
  "id": "GQRY-A.0-B.0",
  "parameter_names": [],
  "parameter_values": {},
  "other_exec_results": [],
  "required_columns": [
    1,
    2,
    3,
    4
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] total post-season offensive rebounds and games played": "total post-season offensive rebounds and post-season games played",
      "[B] Oklahoma": "Oklahoma State"
    }
  }
}
*/
SELECT
p.playerID,
p.firstName,
p.lastName,
SUM(pt.PostoRebounds) AS total_post_offensive_rebounds,
COALESCE(SUM(pt.PostGP), 0) AS total_post_games_played
FROM players p
JOIN players_teams pt ON p.playerID = pt.playerID
WHERE p.birthState = 'OK'
GROUP BY p.playerID, p.firstName, p.lastName;
/* EXEC RESULT
 playerID firstName lastName  total_post_offensive_rebounds  total_post_games_played
beaslch01   Charles  Beasley                              1                       23
boonero01    Ronald    Boone                            131                       84
bowiean01   Anthony    Bowie                              7                       40
bradljo01    Joseph  Bradley                              0                        0
 carran01   Antoine     Carr                             94                      107
... TRUNCATED ...
 udohek01  Ekpedeme     Udoh                              0                        0
 vannbr01     Bryce     Vann                              0                        4
vaughda02     David   Vaughn                              0                        1
voskuja01    Robert  Voskuhl                              9                        6
willish02   Shelden Williams                              2                        8
*/
----- END OF GOLD QUERY -----


----- START OF GOLD QUERY `GQRY-A.0-B.1` -----
/*
{
  "id": "GQRY-A.0-B.1",
  "parameter_names": [],
  "parameter_values": {},
  "other_exec_results": [],
  "required_columns": [
    1,
    2,
    3,
    4
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] total post-season offensive rebounds and games played": "total post-season offensive rebounds and post-season games played",
      "[B] Oklahoma": "Oklahoma City"
    }
  }
}
*/
SELECT
p.playerID,
p.firstName,
p.lastName,
SUM(pt.PostoRebounds) AS total_post_offensive_rebounds,
COALESCE(SUM(pt.PostGP), 0) AS total_post_games_played
FROM players p
JOIN players_teams pt ON p.playerID = pt.playerID
WHERE p.birthCity = 'Oklahoma City'
GROUP BY p.playerID, p.firstName, p.lastName;
/* EXEC RESULT
 playerID firstName lastName  total_post_offensive_rebounds  total_post_games_played
boonero01    Ronald    Boone                            131                       84
 carran01   Antoine     Carr                             94                      107
combsle01     Edwin    Combs                              0                        0
darcehe01     Henry   Darcey                              0                        0
farmemi01       Don   Farmer                              0                       27
... TRUNCATED ...
griffta01    Taylor  Griffin                              0                        0
jacksda01   Darnell  Jackson                              0                        5
mooretr01     Tracy    Moore                              0                        0
ortonda01    Daniel    Orton                              0                        4
willish02   Shelden Williams                              2                        8
*/
----- END OF GOLD QUERY -----


----- START OF GOLD QUERY `GQRY-A.1-B.0` -----
/*
{
  "id": "GQRY-A.1-B.0",
  "parameter_names": [],
  "parameter_values": {},
  "other_exec_results": [],
  "required_columns": [
    1,
    2,
    3,
    4
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] total post-season offensive rebounds and games played": "total post-season offensive rebounds and all games played",
      "[B] Oklahoma": "Oklahoma State"
    }
  }
}
*/
SELECT
p.playerID,
p.firstName,
p.lastName,
SUM(pt.PostoRebounds) AS total_post_offensive_rebounds,
SUM(pt.GP) + COALESCE(SUM(pt.PostGP), 0) AS total_games_played
FROM players p
JOIN players_teams pt ON p.playerID = pt.playerID
WHERE p.birthState = 'OK'
GROUP BY p.playerID, p.firstName, p.lastName;
/* EXEC RESULT
 playerID firstName lastName  total_post_offensive_rebounds  total_games_played
beaslch01   Charles  Beasley                              1                 304
boonero01    Ronald    Boone                            131                1125
bowiean01   Anthony    Bowie                              7                 501
bradljo01    Joseph  Bradley                              0                  80
 carran01   Antoine     Carr                             94                1094
... TRUNCATED ...
 udohek01  Ekpedeme     Udoh                              0                 119
 vannbr01     Bryce     Vann                              0                 111
vaughda02     David   Vaughn                              0                 119
voskuja01    Robert  Voskuhl                              9                 456
willish02   Shelden Williams                              2                 294
*/
----- END OF GOLD QUERY -----


----- START OF GOLD QUERY `GQRY-A.1-B.1` -----
/*
{
  "id": "GQRY-A.1-B.1",
  "parameter_names": [],
  "parameter_values": {},
  "other_exec_results": [],
  "required_columns": [
    1,
    2,
    3,
    4
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] total post-season offensive rebounds and games played": "total post-season offensive rebounds and all games played",
      "[B] Oklahoma": "Oklahoma City"
    }
  }
}
*/
SELECT
p.playerID,
p.firstName,
p.lastName,
SUM(pt.PostoRebounds) AS total_post_offensive_rebounds,
SUM(pt.GP) + COALESCE(SUM(pt.PostGP), 0) AS total_games_played
FROM players p
JOIN players_teams pt ON p.playerID = pt.playerID
WHERE p.birthCity = 'Oklahoma City'
GROUP BY p.playerID, p.firstName, p.lastName;
/* EXEC RESULT
 playerID firstName lastName  total_post_offensive_rebounds  total_games_played
boonero01    Ronald    Boone                            131                1125
 carran01   Antoine     Carr                             94                1094
combsle01     Edwin    Combs                              0                  48
darcehe01     Henry   Darcey                              0                  12
farmemi01       Don   Farmer                              0                 517
... TRUNCATED ...
griffta01    Taylor  Griffin                              0                   8
jacksda01   Darnell  Jackson                              0                 143
mooretr01     Tracy    Moore                              0                 119
ortonda01    Daniel    Orton                              0                  20
willish02   Shelden Williams                              2                 294
*/
----- END OF GOLD QUERY -----