db_id
stringclasses 69
values | question
stringlengths 24
325
| evidence
stringlengths 0
673
| SQL
stringlengths 23
804
| db_schema_T
stringlengths 79
5k
| db_schema
stringclasses 69
values | difficulty
stringclasses 1
value | question_id
int64 0
9.43k
| __index_level_0__
int64 0
9.43k
| db_schema_TC
stringlengths 41
1.68k
| sql_constructs
listlengths 2
17
| sql_complexity
int64 2
46
| sql_complexity_buckets
stringclasses 3
values | few_shots
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
talkingdata
|
Indicate the location of all the events that occurred on April 30, 2016.
|
location = longitude, latitude; on April 30, 2016 refers timestamp BETWEEN '2016-04-30 00:00:00' AND '2016-04-30 23:59:59';
|
SELECT longitude, latitude FROM events WHERE date(timestamp) = '2016-04-30'
|
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,201 | 1,201 |
CREATE TABLE `events`
(
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL
)
|
[
"-",
"SELECT",
"FROM"
] | 4 |
simple
|
{
"case_1": [
222,
554
],
"case_2": [
222,
554
],
"case_3": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
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,
360,
361,
362,
363,
364,
365,
366,
367,
368,
369,
370,
371,
372,
373,
374,
375,
376,
377,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
396,
397,
398,
399,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
410,
411,
412,
413,
414,
415,
416,
417,
418,
419,
420,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
439,
440,
441,
442,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
461,
462,
463,
464,
465,
466,
467,
468,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
481,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
492,
493,
494,
495,
496,
497,
498,
499,
500,
501,
502,
503,
504,
505,
506,
507,
508,
509,
510,
511,
512,
513,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
525,
526,
527,
528,
529,
530,
531,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
543,
544,
545,
546,
547,
548,
549,
550,
551,
552,
553,
554,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
568,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
585,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
598,
599,
600,
601,
602,
603,
604,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
617,
618,
619,
620,
621,
622,
623,
624,
625,
626,
627,
628,
629,
630,
631,
632,
633,
634,
635,
636,
637,
638,
639,
640,
641,
642,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
664,
665,
666,
667,
668,
669,
670,
671,
672,
673,
674,
675,
676,
677,
678,
679,
680,
681,
682,
683,
684,
685,
686,
687,
688,
689,
690,
691,
692,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
707,
708,
709,
710,
711,
712,
713,
714,
715,
716,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
729,
730,
731,
732,
733,
734,
735,
736,
737,
738,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
757,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
770,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
785,
786,
787,
788,
789,
790,
791,
792,
793,
794,
795,
796,
797,
798,
799,
800,
801,
802,
803,
804,
805,
806,
807,
808,
809,
810,
811,
812,
813,
814,
815,
816,
817,
818,
819,
820,
821,
822,
823,
824,
825,
826,
827,
828,
829,
830,
831,
832,
833,
834,
835,
836,
837,
838,
839,
840,
841,
842,
843,
844,
845,
846,
847,
848,
849,
850,
851,
852,
853,
854,
855,
856,
857,
858,
859,
860,
861,
862,
863,
864,
865,
866,
867,
868,
869,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
883,
884,
885,
886,
887,
888,
889,
890,
891,
892,
893,
894,
895,
896,
897,
898,
899,
900,
901,
902,
903,
904,
905,
906,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
919,
920,
921,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
933,
934,
935,
936,
937,
938,
939,
940,
941,
942,
943,
944,
945,
946,
947,
948,
949,
950,
951,
952,
953,
954,
955,
956,
957,
958,
959,
960,
961,
962,
963,
964,
965,
966,
967,
968,
969,
970,
971,
972,
973,
974,
975,
976,
977,
978,
979,
980,
981,
982,
983,
984,
985,
986,
987,
988,
989,
990,
991,
992,
993,
994,
995,
996,
997,
998,
999,
1000,
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1018,
1019,
1020,
1021,
1022,
1023,
1024,
1025,
1026,
1027,
1028,
1029,
1030,
1031,
1032,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1040,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1053,
1054,
1055,
1056,
1057,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1074,
1075,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1083,
1084,
1085,
1086,
1087,
1088,
1089,
1090,
1091,
1092,
1093,
1094,
1095,
1096,
1097,
1098,
1099,
1100,
1101,
1102,
1103,
1104,
1105,
1106,
1107,
1108,
1109,
1110,
1111,
1112,
1113,
1114,
1115,
1116,
1117,
1118,
1119,
1120,
1121,
1122,
1123,
1124,
1125,
1126,
1127,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1138,
1139,
1140,
1141
]
}
|
talkingdata
|
How many different models does the HTC brand have?
|
models refers to device_model; HTC brand refers to phone_brand = 'HTC';
|
SELECT COUNT(device_model) FROM phone_brand_device_model2 WHERE phone_brand = 'HTC'
|
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,202 | 1,202 |
CREATE TABLE `phone_brand_device_model2`
(
CREATE TABLE `phone_brand_device_model2`
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL, `phone_brand`, `device_model`
)
|
[
"COUNT",
"SELECT",
"FROM"
] | 3 |
simple
|
{
"case_1": [
157,
506
],
"case_2": [
157,
506
],
"case_3": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
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,
360,
361,
362,
363,
364,
365,
366,
367,
368,
369,
370,
371,
372,
373,
374,
375,
376,
377,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
396,
397,
398,
399,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
410,
411,
412,
413,
414,
415,
416,
417,
418,
419,
420,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
439,
440,
441,
442,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
461,
462,
463,
464,
465,
466,
467,
468,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
481,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
492,
493,
494,
495,
496,
497,
498,
499,
500,
501,
502,
503,
504,
505,
506,
507,
508,
509,
510,
511,
512,
513,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
525,
526,
527,
528,
529,
530,
531,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
543,
544,
545,
546,
547,
548,
549,
550,
551,
552,
553,
554,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
568,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
585,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
598,
599,
600,
601,
602,
603,
604,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
617,
618,
619,
620,
621,
622,
623,
624,
625,
626,
627,
628,
629,
630,
631,
632,
633,
634,
635,
636,
637,
638,
639,
640,
641,
642,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
664,
665,
666,
667,
668,
669,
670,
671,
672,
673,
674,
675,
676,
677,
678,
679,
680,
681,
682,
683,
684,
685,
686,
687,
688,
689,
690,
691,
692,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
707,
708,
709,
710,
711,
712,
713,
714,
715,
716,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
729,
730,
731,
732,
733,
734,
735,
736,
737,
738,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
757,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
770,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
785,
786,
787,
788,
789,
790,
791,
792,
793,
794,
795,
796,
797,
798,
799,
800,
801,
802,
803,
804,
805,
806,
807,
808,
809,
810,
811,
812,
813,
814,
815,
816,
817,
818,
819,
820,
821,
822,
823,
824,
825,
826,
827,
828,
829,
830,
831,
832,
833,
834,
835,
836,
837,
838,
839,
840,
841,
842,
843,
844,
845,
846,
847,
848,
849,
850,
851,
852,
853,
854,
855,
856,
857,
858,
859,
860,
861,
862,
863,
864,
865,
866,
867,
868,
869,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
883,
884,
885,
886,
887,
888,
889,
890,
891,
892,
893,
894,
895,
896,
897,
898,
899,
900,
901,
902,
903,
904,
905,
906,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
919,
920,
921,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
933,
934,
935,
936,
937,
938,
939,
940,
941,
942,
943,
944,
945,
946,
947,
948,
949,
950,
951,
952,
953,
954,
955,
956,
957,
958,
959,
960,
961,
962,
963,
964,
965,
966,
967,
968,
969,
970,
971,
972,
973,
974,
975,
976,
977,
978,
979,
980,
981,
982,
983,
984,
985,
986,
987,
988,
989,
990,
991,
992,
993,
994,
995,
996,
997,
998,
999,
1000,
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1018,
1019,
1020,
1021,
1022,
1023,
1024,
1025,
1026,
1027,
1028,
1029,
1030,
1031,
1032,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1040,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1053,
1054,
1055,
1056,
1057,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1074,
1075,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1083,
1084,
1085,
1086,
1087,
1088,
1089,
1090,
1091,
1092,
1093,
1094,
1095,
1096,
1097,
1098,
1099,
1100,
1101,
1102,
1103,
1104,
1105,
1106,
1107,
1108,
1109,
1110,
1111,
1112,
1113,
1114,
1115,
1116,
1117,
1118,
1119,
1120,
1121,
1122,
1123,
1124,
1125,
1126,
1127,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1138,
1139,
1140,
1141
]
}
|
talkingdata
|
Identify all installed and activated apps by their id.
|
installed refers to is_installed = 1; activated refers to is_active = 1; id refers to app_id;
|
SELECT app_id FROM app_events WHERE is_active = 1 AND is_installed = 1
|
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,203 | 1,203 |
CREATE TABLE `app_events`
(
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL, `app_id`
)
|
[
"AND",
"SELECT",
"FROM"
] | 3 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
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,
360,
361,
362,
363,
364,
365,
366,
367,
368,
369,
370,
371,
372,
373,
374,
375,
376,
377,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
396,
397,
398,
399,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
410,
411,
412,
413,
414,
415,
416,
417,
418,
419,
420,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
439,
440,
441,
442,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
461,
462,
463,
464,
465,
466,
467,
468,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
481,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
492,
493,
494,
495,
496,
497,
498,
499,
500,
501,
502,
503,
504,
505,
506,
507,
508,
509,
510,
511,
512,
513,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
525,
526,
527,
528,
529,
530,
531,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
543,
544,
545,
546,
547,
548,
549,
550,
551,
552,
553,
554,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
568,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
585,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
598,
599,
600,
601,
602,
603,
604,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
617,
618,
619,
620,
621,
622,
623,
624,
625,
626,
627,
628,
629,
630,
631,
632,
633,
634,
635,
636,
637,
638,
639,
640,
641,
642,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
664,
665,
666,
667,
668,
669,
670,
671,
672,
673,
674,
675,
676,
677,
678,
679,
680,
681,
682,
683,
684,
685,
686,
687,
688,
689,
690,
691,
692,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
707,
708,
709,
710,
711,
712,
713,
714,
715,
716,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
729,
730,
731,
732,
733,
734,
735,
736,
737,
738,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
757,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
770,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
785,
786,
787,
788,
789,
790,
791,
792,
793,
794,
795,
796,
797,
798,
799,
800,
801,
802,
803,
804,
805,
806,
807,
808,
809,
810,
811,
812,
813,
814,
815,
816,
817,
818,
819,
820,
821,
822,
823,
824,
825,
826,
827,
828,
829,
830,
831,
832,
833,
834,
835,
836,
837,
838,
839,
840,
841,
842,
843,
844,
845,
846,
847,
848,
849,
850,
851,
852,
853,
854,
855,
856,
857,
858,
859,
860,
861,
862,
863,
864,
865,
866,
867,
868,
869,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
883,
884,
885,
886,
887,
888,
889,
890,
891,
892,
893,
894,
895,
896,
897,
898,
899,
900,
901,
902,
903,
904,
905,
906,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
919,
920,
921,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
933,
934,
935,
936,
937,
938,
939,
940,
941,
942,
943,
944,
945,
946,
947,
948,
949,
950,
951,
952,
953,
954,
955,
956,
957,
958,
959,
960,
961,
962,
963,
964,
965,
966,
967,
968,
969,
970,
971,
972,
973,
974,
975,
976,
977,
978,
979,
980,
981,
982,
983,
984,
985,
986,
987,
988,
989,
990,
991,
992,
993,
994,
995,
996,
997,
998,
999,
1000,
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1018,
1019,
1020,
1021,
1022,
1023,
1024,
1025,
1026,
1027,
1028,
1029,
1030,
1031,
1032,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1040,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1053,
1054,
1055,
1056,
1057,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1074,
1075,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1083,
1084,
1085,
1086,
1087,
1088,
1089,
1090,
1091,
1092,
1093,
1094,
1095,
1096,
1097,
1098,
1099,
1100,
1101,
1102,
1103,
1104,
1105,
1106,
1107,
1108,
1109,
1110,
1111,
1112,
1113,
1114,
1115,
1116,
1117,
1118,
1119,
1120,
1121,
1122,
1123,
1124,
1125,
1126,
1127,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1138,
1139,
1140,
1141
]
}
|
talkingdata
|
How many apps are labeled 7?
|
labeled 7 refers to label_id = 7;
|
SELECT COUNT(app_id) FROM app_labels WHERE label_id = 7
|
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,204 | 1,204 |
CREATE TABLE `app_labels`
(
CREATE TABLE `app_labels`
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY `label_id` REFERENCES `label_categories` `label_id` ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY `app_id` REFERENCES `app_all` `app_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"COUNT",
"SELECT",
"FROM"
] | 3 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
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,
360,
361,
362,
363,
364,
365,
366,
367,
368,
369,
370,
371,
372,
373,
374,
375,
376,
377,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
396,
397,
398,
399,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
410,
411,
412,
413,
414,
415,
416,
417,
418,
419,
420,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
439,
440,
441,
442,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
461,
462,
463,
464,
465,
466,
467,
468,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
481,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
492,
493,
494,
495,
496,
497,
498,
499,
500,
501,
502,
503,
504,
505,
506,
507,
508,
509,
510,
511,
512,
513,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
525,
526,
527,
528,
529,
530,
531,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
543,
544,
545,
546,
547,
548,
549,
550,
551,
552,
553,
554,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
568,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
585,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
598,
599,
600,
601,
602,
603,
604,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
617,
618,
619,
620,
621,
622,
623,
624,
625,
626,
627,
628,
629,
630,
631,
632,
633,
634,
635,
636,
637,
638,
639,
640,
641,
642,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
664,
665,
666,
667,
668,
669,
670,
671,
672,
673,
674,
675,
676,
677,
678,
679,
680,
681,
682,
683,
684,
685,
686,
687,
688,
689,
690,
691,
692,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
707,
708,
709,
710,
711,
712,
713,
714,
715,
716,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
729,
730,
731,
732,
733,
734,
735,
736,
737,
738,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
757,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
770,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
785,
786,
787,
788,
789,
790,
791,
792,
793,
794,
795,
796,
797,
798,
799,
800,
801,
802,
803,
804,
805,
806,
807,
808,
809,
810,
811,
812,
813,
814,
815,
816,
817,
818,
819,
820,
821,
822,
823,
824,
825,
826,
827,
828,
829,
830,
831,
832,
833,
834,
835,
836,
837,
838,
839,
840,
841,
842,
843,
844,
845,
846,
847,
848,
849,
850,
851,
852,
853,
854,
855,
856,
857,
858,
859,
860,
861,
862,
863,
864,
865,
866,
867,
868,
869,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
883,
884,
885,
886,
887,
888,
889,
890,
891,
892,
893,
894,
895,
896,
897,
898,
899,
900,
901,
902,
903,
904,
905,
906,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
919,
920,
921,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
933,
934,
935,
936,
937,
938,
939,
940,
941,
942,
943,
944,
945,
946,
947,
948,
949,
950,
951,
952,
953,
954,
955,
956,
957,
958,
959,
960,
961,
962,
963,
964,
965,
966,
967,
968,
969,
970,
971,
972,
973,
974,
975,
976,
977,
978,
979,
980,
981,
982,
983,
984,
985,
986,
987,
988,
989,
990,
991,
992,
993,
994,
995,
996,
997,
998,
999,
1000,
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1018,
1019,
1020,
1021,
1022,
1023,
1024,
1025,
1026,
1027,
1028,
1029,
1030,
1031,
1032,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1040,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1053,
1054,
1055,
1056,
1057,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1074,
1075,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1083,
1084,
1085,
1086,
1087,
1088,
1089,
1090,
1091,
1092,
1093,
1094,
1095,
1096,
1097,
1098,
1099,
1100,
1101,
1102,
1103,
1104,
1105,
1106,
1107,
1108,
1109,
1110,
1111,
1112,
1113,
1114,
1115,
1116,
1117,
1118,
1119,
1120,
1121,
1122,
1123,
1124,
1125,
1126,
1127,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1138,
1139,
1140,
1141
]
}
|
talkingdata
|
Identify by their id all the devices that are used by women who are in the age range of 29 to 31 years.
|
id refers to device_id; women refers to gender = 'F'; age range of 29 to 31 years refers to age between 29 and 31;
|
SELECT device_id FROM gender_age_train WHERE age BETWEEN 29 AND 31 AND gender = 'F'
|
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,205 | 1,205 |
CREATE TABLE `gender_age_train`
(
CREATE TABLE `gender_age_train`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`
)
|
[
"BETWEEN",
"AND",
"SELECT",
"FROM"
] | 5 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
244,
319,
382,
424,
515,
554,
595,
608,
671,
675,
687,
756,
768,
849,
1067
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
2,
4,
5,
8,
10,
12,
19,
20,
21,
22,
24,
26,
30,
32,
33,
37,
38,
39,
40,
43,
44,
45,
47,
50,
51,
52,
53,
56,
57,
63,
66,
67,
68,
69,
71,
73,
74,
75,
76,
79,
85,
88,
90,
93,
95,
96,
98,
99,
100,
109,
111,
112,
113,
115,
116,
117,
118,
119,
125,
127,
128,
129,
131,
138,
141,
142,
143,
144,
146,
152,
154,
158,
160,
163,
164,
168,
169,
170,
172,
173,
175,
176,
177,
180,
183,
184,
187,
197,
200,
214,
219,
223,
227,
230,
239,
240,
244,
255,
256,
258,
259,
262,
265,
266,
267,
268,
270,
272,
275,
276,
277,
278,
282,
294,
296,
301,
305,
314,
315,
317,
319,
325,
330,
339,
341,
350,
356,
361,
362,
367,
368,
370,
374,
376,
382,
383,
385,
391,
393,
395,
398,
399,
402,
403,
405,
406,
408,
413,
414,
416,
417,
418,
419,
421,
424,
425,
426,
427,
428,
433,
436,
437,
438,
439,
440,
444,
446,
448,
451,
452,
455,
463,
464,
469,
470,
475,
476,
477,
480,
482,
490,
492,
493,
494,
496,
497,
498,
500,
507,
510,
512,
514,
515,
516,
519,
520,
522,
524,
526,
528,
529,
530,
533,
537,
539,
541,
544,
551,
554,
557,
558,
559,
561,
562,
563,
581,
582,
584,
586,
588,
589,
591,
594,
595,
599,
601,
605,
608,
610,
612,
613,
615,
618,
622,
624,
625,
626,
627,
632,
633,
637,
641,
643,
648,
651,
656,
663,
666,
667,
668,
671,
675,
677,
678,
679,
680,
683,
684,
685,
686,
687,
690,
692,
693,
697,
699,
702,
707,
712,
714,
715,
716,
718,
719,
726,
727,
730,
734,
735,
739,
740,
741,
743,
746,
747,
749,
753,
754,
756,
758,
760,
763,
765,
767,
768,
773,
775,
776,
777,
780,
783,
785,
788,
793,
794,
797,
798,
799,
800,
804,
806,
807,
808,
810,
814,
817,
819,
820,
824,
825,
829,
830,
831,
832,
835,
838,
840,
843,
844,
848,
849,
851,
853,
855,
858,
859,
860,
861,
864,
867,
870,
873,
877,
878,
879,
886,
888,
892,
895,
896,
902,
903,
905,
907,
917,
920,
923,
924,
928,
930,
931,
932,
935,
944,
945,
949,
953,
954,
956,
958,
961,
965,
969,
974,
985,
986,
991,
996,
998,
1000,
1001,
1008,
1009,
1014,
1017,
1018,
1019,
1020,
1022,
1023,
1027,
1031,
1039,
1042,
1044,
1046,
1058,
1059,
1061,
1063,
1064,
1067,
1068,
1071,
1072,
1073,
1079,
1080,
1081,
1084,
1086,
1092,
1100,
1101,
1103,
1104,
1105,
1109,
1115,
1117,
1119,
1121,
1123,
1126,
1128,
1131,
1136
]
}
|
talkingdata
|
Identify by their id all the apps that belong to the game-stress reliever category.
|
id refers to device_id;
|
SELECT T2.app_id FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T1.category = 'game-stress reliever'
|
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,206 | 1,206 |
CREATE TABLE `app_labels`
(
CREATE TABLE `app_labels`
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY `label_id` REFERENCES `label_categories` `label_id` ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY `app_id` REFERENCES `app_all` `app_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `label_categories`
(
CREATE TABLE `label_categories`
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY `label_id`
)
|
[
"AS",
"SELECT",
"-",
"INNER JOIN",
"ON",
"FROM"
] | 7 |
simple
|
{
"case_1": [
357,
484,
839,
938
],
"case_2": [
357,
484,
611,
839,
938
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1070,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
On what date were the most events logged on devices for 40-year-old male users?
|
date refers to timestamp; most events refers to MAX(COUNT(event_id)); 40-year-old refers to age = 40; male refers to gender = 'M';
|
SELECT T.timestamp FROM ( SELECT T2.timestamp, COUNT(T2.event_id) AS num FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'M' AND T1.age = 40 GROUP BY T2.timestamp ) AS T ORDER BY T.num DESC LIMIT 1
|
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,207 | 1,207 |
CREATE TABLE `events_relevant`
(
CREATE TABLE `events_relevant`
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
PRIMARY KEY `event_id`,
FOREIGN KEY `device_id` REFERENCES `gender_age` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"GROUP BY",
"AS",
"AND",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"COUNT",
"FROM"
] | 16 |
challenging
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
244,
319,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
4,
5,
6,
8,
10,
11,
12,
13,
15,
16,
19,
20,
21,
22,
24,
26,
27,
28,
29,
30,
33,
36,
37,
38,
39,
44,
45,
47,
49,
51,
52,
53,
55,
57,
59,
62,
63,
66,
68,
69,
71,
73,
74,
75,
76,
77,
78,
82,
85,
86,
88,
89,
90,
91,
93,
95,
96,
98,
99,
106,
108,
111,
112,
113,
115,
116,
117,
118,
119,
121,
125,
126,
127,
128,
129,
131,
138,
140,
141,
142,
143,
144,
146,
148,
150,
152,
154,
158,
159,
160,
162,
163,
164,
167,
169,
170,
172,
173,
175,
176,
177,
179,
180,
183,
184,
185,
187,
188,
189,
190,
191,
196,
197,
199,
200,
202,
206,
212,
213,
214,
219,
225,
226,
227,
229,
233,
234,
239,
240,
243,
244,
247,
252,
254,
256,
258,
261,
262,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
281,
282,
285,
286,
291,
296,
299,
301,
309,
311,
313,
314,
315,
316,
317,
319,
320,
323,
324,
325,
329,
330,
334,
335,
336,
338,
339,
341,
342,
344,
345,
348,
349,
352,
353,
354,
356,
358,
359,
360,
361,
364,
365,
368,
370,
371,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
408,
409,
411,
412,
413,
414,
416,
417,
419,
424,
425,
426,
427,
428,
429,
433,
434,
435,
436,
437,
438,
440,
444,
445,
446,
448,
451,
452,
454,
455,
460,
462,
463,
464,
465,
467,
469,
470,
471,
473,
475,
476,
477,
478,
480,
482,
484,
487,
488,
490,
493,
494,
495,
496,
497,
498,
500,
505,
507,
509,
514,
515,
516,
519,
520,
522,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
541,
542,
544,
547,
548,
552,
557,
558,
559,
560,
561,
562,
563,
564,
566,
567,
573,
578,
579,
580,
581,
582,
584,
586,
588,
589,
590,
592,
595,
596,
597,
605,
606,
608,
610,
611,
612,
613,
615,
620,
621,
624,
625,
626,
627,
630,
632,
633,
634,
637,
638,
641,
643,
645,
646,
648,
649,
651,
654,
657,
658,
659,
662,
663,
664,
665,
666,
668,
669,
671,
675,
677,
678,
681,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
696,
697,
698,
699,
701,
702,
703,
705,
712,
714,
715,
719,
720,
721,
726,
727,
733,
734,
735,
736,
739,
740,
741,
743,
746,
747,
748,
749,
750,
751,
752,
753,
754,
756,
758,
759,
760,
762,
763,
765,
767,
768,
769,
772,
773,
775,
776,
777,
778,
779,
780,
783,
787,
788,
790,
793,
796,
797,
799,
800,
802,
803,
804,
806,
807,
808,
810,
812,
813,
814,
818,
819,
823,
824,
825,
827,
829,
830,
832,
835,
838,
839,
841,
844,
848,
849,
850,
851,
853,
857,
858,
859,
860,
861,
866,
867,
869,
870,
873,
874,
876,
877,
878,
879,
882,
886,
888,
889,
891,
892,
893,
895,
896,
897,
898,
901,
902,
905,
907,
909,
911,
912,
915,
917,
918,
922,
923,
924,
926,
927,
928,
929,
930,
931,
932,
934,
935,
943,
944,
949,
950,
951,
953,
954,
956,
958,
961,
962,
963,
966,
967,
969,
970,
972,
973,
974,
975,
977,
981,
983,
985,
986,
987,
991,
993,
994,
996,
1000,
1001,
1004,
1005,
1006,
1010,
1013,
1015,
1017,
1019,
1022,
1023,
1025,
1027,
1030,
1031,
1034,
1037,
1038,
1039,
1042,
1043,
1044,
1046,
1047,
1049,
1050,
1051,
1056,
1057,
1058,
1061,
1062,
1063,
1064,
1065,
1067,
1068,
1071,
1072,
1076,
1077,
1078,
1080,
1082,
1084,
1086,
1087,
1091,
1092,
1094,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1112,
1115,
1119,
1123,
1124,
1128,
1131,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
On which brand of phone are the most applications installed?
|
brand of phone refers to phone_brand; most applications are installed refers to MAX(COUNT(is_installed = 1));
|
SELECT T.phone_brand FROM ( SELECT T1.phone_brand, COUNT(T4.is_active) AS num FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id INNER JOIN events_relevant AS T3 ON T2.device_id = T3.device_id INNER JOIN app_events_relevant AS T4 ON T3.event_id = T4.event_id WHERE T4.is_active = 1 GROUP BY T1.phone_brand ) AS T ORDER BY T.num DESC LIMIT 1
|
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,208 | 1,208 |
CREATE TABLE `app_events_relevant`
(
CREATE TABLE `app_events_relevant`
`event_id` INTEGER NOT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`,
FOREIGN KEY `event_id` REFERENCES `events_relevant` `event_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events_relevant`
(
CREATE TABLE `events_relevant`
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`,
FOREIGN KEY `device_id` REFERENCES `gender_age` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2`
(
CREATE TABLE `phone_brand_device_model2`
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY `device_id`, `phone_brand`, `device_model`
)
|
[
"GROUP BY",
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"COUNT",
"FROM"
] | 21 |
challenging
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
244,
319,
382,
424,
445,
484,
515,
595,
608,
611,
671,
687,
756,
768,
839,
849,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
4,
6,
10,
11,
13,
15,
16,
20,
22,
27,
28,
29,
30,
36,
37,
47,
49,
51,
53,
55,
59,
62,
63,
68,
69,
73,
74,
75,
77,
78,
82,
86,
88,
89,
91,
93,
96,
98,
106,
108,
113,
115,
117,
118,
119,
121,
125,
126,
131,
138,
140,
142,
143,
146,
148,
150,
152,
159,
160,
162,
163,
164,
167,
169,
170,
173,
175,
179,
183,
184,
185,
187,
188,
189,
190,
191,
196,
197,
199,
200,
202,
206,
212,
213,
214,
225,
226,
227,
229,
233,
234,
239,
243,
244,
247,
252,
254,
256,
261,
262,
267,
268,
269,
275,
276,
277,
278,
281,
285,
286,
291,
299,
301,
309,
311,
313,
314,
316,
317,
319,
320,
323,
324,
325,
329,
330,
334,
335,
336,
338,
339,
341,
342,
344,
345,
348,
349,
352,
353,
354,
356,
358,
359,
360,
364,
365,
370,
371,
373,
374,
375,
378,
379,
381,
382,
383,
384,
385,
391,
392,
394,
395,
401,
403,
406,
409,
411,
412,
416,
417,
424,
426,
428,
429,
434,
435,
436,
444,
445,
448,
451,
454,
460,
462,
464,
465,
467,
469,
471,
473,
476,
477,
478,
482,
484,
487,
488,
490,
493,
495,
497,
500,
505,
509,
515,
516,
519,
520,
526,
530,
532,
535,
536,
537,
538,
542,
544,
547,
548,
552,
558,
559,
560,
563,
564,
566,
567,
573,
578,
579,
580,
581,
582,
584,
586,
590,
592,
595,
596,
597,
606,
608,
611,
613,
620,
621,
625,
626,
627,
630,
632,
633,
634,
637,
638,
641,
645,
646,
649,
651,
654,
657,
658,
659,
662,
663,
664,
665,
668,
669,
671,
681,
687,
688,
690,
691,
694,
696,
698,
701,
703,
705,
712,
714,
719,
720,
721,
727,
733,
734,
735,
736,
739,
740,
743,
748,
749,
750,
751,
752,
753,
756,
759,
760,
762,
768,
769,
772,
778,
779,
787,
790,
796,
797,
799,
800,
802,
803,
804,
810,
812,
813,
814,
818,
819,
823,
824,
827,
830,
838,
839,
841,
849,
850,
851,
853,
857,
861,
866,
867,
869,
870,
874,
876,
877,
882,
886,
888,
889,
891,
893,
896,
897,
898,
901,
902,
909,
911,
912,
915,
917,
918,
922,
923,
924,
926,
927,
929,
930,
932,
934,
935,
943,
950,
951,
953,
954,
956,
958,
961,
962,
963,
966,
967,
969,
970,
972,
973,
975,
977,
981,
983,
985,
986,
987,
993,
994,
996,
1004,
1005,
1006,
1010,
1013,
1015,
1017,
1022,
1023,
1025,
1030,
1034,
1037,
1038,
1042,
1043,
1047,
1049,
1050,
1051,
1056,
1057,
1058,
1062,
1064,
1065,
1067,
1068,
1071,
1072,
1076,
1077,
1078,
1082,
1084,
1086,
1087,
1091,
1094,
1100,
1101,
1103,
1104,
1106,
1112,
1119,
1123,
1124,
1128,
1131,
1133,
1134,
1135,
1137
]
}
|
talkingdata
|
How many men under the age of 23 have apps installed but are not active on their devices?
|
men refers to gender = 'M'; under the age of 23 refers to age < 23; installed refers to is_installed = 1; not active refers to is_active = 0;
|
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id INNER JOIN app_events_relevant AS T3 ON T2.event_id = T3.event_id WHERE T1.gender = 'M' AND T3.is_active = 0 AND T1.age < 23
|
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,209 | 1,209 |
CREATE TABLE `app_events_relevant`
(
CREATE TABLE `app_events_relevant`
`event_id` INTEGER NOT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`,
FOREIGN KEY `event_id` REFERENCES `events_relevant` `event_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events_relevant`
(
CREATE TABLE `events_relevant`
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`,
FOREIGN KEY `device_id` REFERENCES `gender_age` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 12 |
medium
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
554,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
How many women have apps from the game-Finding fault category installed on their device?
|
women refers to gender = 'F'; installed refers to is_installed = 1;
|
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id INNER JOIN app_events_relevant AS T3 ON T2.event_id = T3.event_id WHERE T1.age < 23 AND T1.gender = 'F' AND T3.is_active = 0 AND T3.is_installed = 1
|
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,210 | 1,210 |
CREATE TABLE `app_events_relevant`
(
CREATE TABLE `app_events_relevant`
`event_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`,
FOREIGN KEY `event_id` REFERENCES `events_relevant` `event_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events_relevant`
(
CREATE TABLE `events_relevant`
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`,
FOREIGN KEY `device_id` REFERENCES `gender_age` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 13 |
medium
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
554,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
Which gender logged in the most to an event in the first 10 days of May 2016?
|
gender that logged in the most refers to MAX(COUNT(gender)); first 10 days of May 2016 refers to timestamp BETWEEN '2016-05-01 00:00:00' AND '2016-05-10 23:59:59';
|
SELECT T.gender FROM ( SELECT T1.gender, COUNT(T1.device_id) AS num FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE date(T2.timestamp) BETWEEN '2016-05-01' AND '2016-05-10' GROUP BY T1.gender ) AS T ORDER BY T.num DESC LIMIT 1
|
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,211 | 1,211 |
CREATE TABLE `events_relevant`
(
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
FOREIGN KEY `device_id` REFERENCES `gender_age` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"GROUP BY",
"AS",
"AND",
"SELECT",
"ORDER BY",
"LIMIT",
"-",
"INNER JOIN",
"ON",
"DESC",
"COUNT",
"BETWEEN",
"FROM"
] | 21 |
challenging
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
244,
319,
382,
424,
445,
515,
595,
608,
611,
671,
675,
687,
756,
768,
849,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
1,
2,
4,
10,
11,
13,
15,
20,
21,
22,
28,
29,
30,
36,
37,
39,
43,
45,
47,
49,
51,
53,
55,
59,
62,
63,
68,
69,
73,
74,
75,
76,
78,
85,
86,
88,
89,
93,
96,
98,
108,
112,
113,
115,
117,
118,
119,
121,
125,
126,
128,
131,
138,
140,
141,
142,
143,
146,
148,
150,
152,
154,
158,
159,
160,
162,
163,
164,
167,
169,
170,
172,
173,
175,
179,
180,
183,
184,
187,
188,
189,
191,
197,
199,
200,
202,
206,
213,
214,
227,
229,
233,
239,
240,
244,
247,
252,
256,
262,
267,
268,
272,
275,
276,
277,
278,
281,
286,
296,
301,
309,
311,
313,
314,
317,
319,
320,
324,
325,
329,
330,
334,
336,
339,
341,
342,
344,
345,
348,
349,
352,
353,
356,
359,
364,
365,
368,
370,
371,
373,
374,
378,
379,
381,
382,
383,
385,
391,
392,
393,
394,
395,
403,
406,
409,
411,
416,
417,
424,
425,
426,
428,
429,
434,
435,
436,
444,
445,
446,
448,
451,
454,
460,
462,
463,
464,
469,
473,
476,
477,
482,
490,
493,
495,
496,
497,
498,
500,
505,
507,
509,
514,
515,
516,
519,
520,
522,
526,
529,
530,
532,
536,
537,
538,
542,
544,
548,
552,
558,
559,
560,
562,
563,
566,
567,
578,
579,
580,
581,
582,
584,
586,
590,
592,
595,
608,
611,
613,
621,
624,
625,
626,
627,
630,
632,
633,
634,
637,
638,
641,
643,
645,
649,
651,
654,
657,
659,
663,
664,
665,
668,
669,
671,
675,
677,
681,
684,
686,
687,
688,
690,
691,
693,
696,
698,
701,
703,
712,
714,
719,
721,
727,
733,
734,
735,
739,
740,
743,
746,
748,
749,
752,
753,
754,
756,
758,
759,
760,
768,
777,
778,
779,
788,
790,
797,
798,
799,
800,
803,
804,
810,
814,
818,
819,
823,
824,
827,
829,
830,
835,
838,
849,
850,
851,
853,
858,
861,
866,
867,
869,
870,
876,
877,
878,
882,
886,
888,
889,
891,
893,
896,
901,
902,
905,
911,
917,
918,
922,
923,
924,
927,
929,
930,
932,
934,
935,
943,
950,
951,
953,
954,
956,
958,
961,
962,
963,
966,
967,
969,
970,
972,
973,
974,
975,
977,
981,
985,
986,
993,
994,
996,
1005,
1006,
1010,
1013,
1017,
1022,
1023,
1025,
1030,
1031,
1034,
1037,
1038,
1042,
1043,
1047,
1049,
1050,
1051,
1056,
1057,
1058,
1064,
1065,
1067,
1068,
1071,
1072,
1076,
1077,
1078,
1084,
1086,
1092,
1094,
1100,
1101,
1103,
1104,
1106,
1119,
1123,
1124,
1128,
1131,
1135,
1137
]
}
|
talkingdata
|
What age group is the most using SM-T2558 model phones?
|
age group using SM-T2558 model phones the most refers to MAX(COUNT(group WHERE device_model = 'SM-T2558')); SM-T2558 model phones refers to device_model = 'SM-T2558';
|
SELECT T.`group` FROM ( SELECT T1.`group`, COUNT(T1.device_id) AS num FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'SM-T2558' GROUP BY T1.`group` ) AS T ORDER BY T.num DESC LIMIT 1
|
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,212 | 1,212 |
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2`
(
CREATE TABLE `phone_brand_device_model2`
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY `device_id`, `phone_brand`, `device_model`
)
|
[
"GROUP BY",
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"-",
"INNER JOIN",
"ON",
"DESC",
"COUNT",
"FROM"
] | 16 |
challenging
|
{
"case_1": [
319,
445,
595
],
"case_2": [
88,
160,
188,
319,
445,
515,
595,
608,
671,
687,
849
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
319,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
3,
4,
6,
10,
11,
13,
15,
16,
20,
21,
22,
27,
28,
29,
30,
34,
36,
37,
39,
42,
45,
47,
49,
51,
53,
55,
59,
62,
63,
68,
69,
73,
74,
75,
77,
78,
82,
85,
86,
88,
89,
91,
93,
96,
97,
98,
105,
106,
108,
112,
113,
115,
117,
118,
119,
121,
125,
126,
128,
131,
135,
138,
140,
141,
142,
143,
146,
148,
150,
152,
154,
158,
159,
160,
162,
163,
164,
167,
169,
170,
172,
173,
175,
179,
180,
183,
184,
185,
187,
188,
189,
190,
191,
196,
197,
199,
200,
202,
206,
212,
213,
214,
225,
226,
227,
228,
229,
233,
234,
239,
240,
243,
244,
247,
252,
254,
256,
261,
262,
267,
268,
269,
272,
275,
276,
277,
278,
281,
285,
286,
291,
296,
299,
300,
301,
309,
311,
313,
314,
316,
317,
319,
320,
323,
324,
325,
329,
330,
334,
335,
336,
338,
339,
341,
342,
344,
345,
348,
349,
352,
353,
354,
356,
358,
359,
360,
364,
365,
368,
370,
371,
373,
374,
375,
378,
379,
381,
382,
383,
384,
385,
391,
392,
393,
394,
395,
401,
403,
406,
409,
411,
412,
416,
417,
424,
425,
426,
428,
429,
434,
435,
436,
444,
445,
446,
448,
451,
454,
460,
462,
464,
465,
467,
469,
471,
473,
476,
477,
478,
482,
484,
487,
488,
489,
490,
493,
495,
496,
497,
498,
500,
503,
505,
507,
509,
514,
515,
516,
519,
520,
522,
526,
529,
530,
532,
535,
536,
537,
538,
542,
544,
547,
548,
550,
552,
558,
559,
560,
562,
563,
564,
566,
567,
573,
578,
579,
580,
581,
582,
584,
586,
590,
592,
595,
596,
597,
606,
608,
611,
613,
620,
621,
624,
625,
626,
627,
630,
632,
633,
634,
637,
638,
641,
643,
645,
646,
647,
649,
651,
654,
657,
658,
659,
660,
662,
663,
664,
665,
668,
669,
671,
675,
677,
681,
684,
687,
688,
690,
691,
693,
694,
695,
696,
698,
701,
703,
705,
712,
714,
719,
720,
721,
727,
733,
734,
735,
736,
739,
740,
743,
746,
748,
749,
750,
751,
752,
753,
754,
756,
758,
759,
760,
762,
768,
769,
772,
777,
778,
779,
787,
788,
790,
796,
797,
799,
800,
802,
803,
804,
805,
810,
812,
813,
814,
818,
819,
823,
824,
827,
829,
830,
835,
838,
839,
841,
849,
850,
851,
853,
857,
858,
861,
866,
867,
869,
870,
874,
876,
877,
878,
882,
886,
888,
889,
891,
893,
896,
897,
898,
901,
902,
905,
909,
911,
912,
915,
917,
918,
922,
923,
924,
925,
926,
927,
929,
930,
932,
934,
935,
943,
950,
951,
953,
954,
956,
958,
959,
961,
962,
963,
966,
967,
969,
970,
972,
973,
974,
975,
977,
980,
981,
983,
985,
986,
987,
993,
994,
996,
1004,
1005,
1006,
1010,
1013,
1015,
1017,
1022,
1023,
1025,
1030,
1031,
1034,
1037,
1038,
1042,
1043,
1047,
1049,
1050,
1051,
1052,
1056,
1057,
1058,
1062,
1064,
1065,
1067,
1068,
1070,
1071,
1072,
1074,
1076,
1077,
1078,
1082,
1084,
1086,
1087,
1091,
1092,
1094,
1100,
1101,
1103,
1104,
1106,
1111,
1112,
1119,
1123,
1124,
1128,
1131,
1132,
1133,
1134,
1135,
1137
]
}
|
talkingdata
|
How many people over the age of 50 do not have HTC One M8 Eye phones?
|
over the age of 50 refers to age > 50; do not have HTC One M8 Eye phones refers to phone_brand ! = 'HTC' AND device_model ! = 'One M8 Eye';
|
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.age > 50 AND T2.device_model != 'One M8 Eye' AND T2.phone_brand != 'HTC'
|
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,213 | 1,213 |
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2`
(
CREATE TABLE `phone_brand_device_model2`
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY `device_id`, `phone_brand`, `device_model`
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 9 |
simple
|
{
"case_1": [
88,
160,
515,
608,
671,
687,
849
],
"case_2": [
88,
160,
188,
319,
445,
515,
595,
608,
671,
687,
849
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
554,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
Locate all events on devices of women under 30 years old.
|
locate = longitude, latitude; women refers to gender = 'F'; under 30 years old refers to age < 30;
|
SELECT T1.device_id FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'F' AND T1.age < 30
|
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,214 | 1,214 |
CREATE TABLE `events_relevant`
(
`device_id` INTEGER DEFAULT NULL,
FOREIGN KEY `device_id` REFERENCES `gender_age` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 7 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
What percentage of women do not have applications installed on their mobile with respect to men?
|
percentage = MULTIPLY(DIVIDE(SUM(gender = 'F'), SUM(gender = 'M')), 1.0); women refers to gender = 'F'; not installed refers to is_installed = 0; men refers to gender = 'M';
|
SELECT SUM(IIF(T1.gender = 'F', 1, 0)) / SUM(IIF(T1.gender = 'M', 1, 0)) AS per FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id INNER JOIN app_events_relevant AS T3 ON T2.event_id = T3.event_id WHERE T3.is_installed = 0
|
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,215 | 1,215 |
CREATE TABLE `app_events_relevant`
(
CREATE TABLE `app_events_relevant`
`event_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`,
FOREIGN KEY `event_id` REFERENCES `events_relevant` `event_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events_relevant`
(
CREATE TABLE `events_relevant`
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`,
FOREIGN KEY `device_id` REFERENCES `gender_age` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"AS",
"SELECT",
"SUM",
"INNER JOIN",
"ON",
"FROM"
] | 12 |
medium
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
506,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
Calculate the average age of people who have apps installed but are not active on their devices.
|
average age = AVG(age); installed refers to is_installed = 1; not active refers to is_active = 0;
|
SELECT AVG(T1.age) FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id INNER JOIN app_events_relevant AS T3 ON T2.event_id = T3.event_id WHERE T3.is_installed = 1 AND T3.is_active = 0
|
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,216 | 1,216 |
CREATE TABLE `app_events_relevant`
(
CREATE TABLE `app_events_relevant`
`event_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`,
FOREIGN KEY `event_id` REFERENCES `events_relevant` `event_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events_relevant`
(
CREATE TABLE `events_relevant`
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`,
FOREIGN KEY `device_id` REFERENCES `gender_age` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"AVG",
"FROM"
] | 11 |
medium
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
79,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
864,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1081,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
Please list any three events that happened on the 1st of May 2016 that have the same latitude of 31.
|
on the 1st of May 2016 refers to timestamp like '2016-05-01%';
|
SELECT event_id FROM events WHERE timestamp LIKE '2016-05-01%' AND latitude = 31 LIMIT 3
|
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,217 | 1,217 |
CREATE TABLE `events`
(
CREATE TABLE `events`
`event_id` INTEGER NOT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY `event_id`
)
|
[
"AND",
"SELECT",
"LIKE",
"LIMIT",
"-",
"FROM"
] | 7 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
187,
244,
319,
382,
445,
595,
675,
756,
768,
1067
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
2,
3,
10,
20,
21,
26,
32,
38,
39,
43,
45,
57,
59,
69,
73,
74,
75,
79,
85,
90,
98,
112,
115,
125,
127,
128,
131,
138,
141,
146,
154,
158,
163,
168,
172,
173,
179,
180,
183,
184,
187,
197,
199,
200,
202,
239,
240,
244,
247,
258,
259,
262,
272,
275,
277,
278,
296,
314,
315,
319,
325,
339,
341,
348,
356,
362,
368,
373,
382,
383,
385,
391,
393,
394,
395,
402,
403,
409,
416,
421,
425,
428,
433,
436,
438,
444,
445,
446,
448,
451,
452,
469,
476,
482,
496,
497,
498,
507,
510,
514,
520,
522,
529,
530,
532,
544,
557,
559,
562,
584,
586,
591,
595,
601,
624,
625,
626,
637,
643,
666,
667,
675,
677,
679,
681,
684,
690,
693,
719,
735,
740,
743,
746,
747,
749,
754,
756,
758,
760,
768,
777,
785,
788,
798,
800,
804,
810,
817,
829,
830,
832,
835,
838,
844,
850,
851,
858,
861,
864,
870,
878,
879,
886,
905,
907,
917,
918,
922,
924,
930,
944,
953,
954,
956,
974,
979,
980,
985,
1000,
1017,
1018,
1019,
1022,
1031,
1042,
1057,
1064,
1067,
1068,
1070,
1092,
1101,
1111,
1117,
1123,
1128
]
}
|
talkingdata
|
Please list any three events that have the longitude and latitude of 0.
|
SELECT event_id FROM events WHERE longitude = 0 AND latitude = 0 LIMIT 3
|
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,218 | 1,218 |
CREATE TABLE `events`
(
CREATE TABLE `events`
`event_id` INTEGER NOT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY `event_id`
)
|
[
"LIMIT",
"AND",
"SELECT",
"FROM"
] | 4 |
simple
|
{
"case_1": [
554
],
"case_2": [
554
],
"case_3": [
88,
110,
143,
160,
187,
188,
244,
319,
382,
424,
445,
515,
554,
555,
595,
608,
611,
671,
675,
687,
756,
768,
849,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
1,
2,
4,
5,
8,
10,
11,
12,
13,
15,
17,
19,
20,
21,
22,
24,
26,
28,
29,
30,
32,
33,
36,
37,
38,
39,
40,
43,
44,
45,
47,
49,
50,
51,
52,
53,
55,
56,
57,
59,
62,
63,
66,
67,
68,
69,
71,
73,
74,
75,
76,
78,
79,
85,
86,
88,
89,
90,
93,
95,
96,
98,
99,
100,
108,
109,
110,
111,
112,
113,
115,
116,
117,
118,
119,
121,
125,
127,
128,
129,
131,
133,
138,
141,
142,
143,
144,
146,
150,
152,
154,
158,
159,
160,
162,
163,
164,
167,
168,
169,
170,
172,
173,
174,
175,
176,
177,
179,
180,
181,
183,
184,
185,
187,
188,
197,
199,
200,
202,
206,
208,
213,
214,
219,
223,
227,
229,
230,
233,
239,
240,
244,
247,
252,
255,
256,
258,
259,
262,
265,
266,
267,
268,
270,
272,
275,
276,
277,
278,
281,
282,
285,
286,
291,
294,
296,
301,
305,
309,
311,
313,
314,
315,
317,
319,
320,
324,
325,
328,
329,
330,
334,
336,
337,
339,
341,
342,
345,
348,
349,
350,
352,
353,
356,
359,
361,
362,
364,
365,
367,
368,
370,
371,
373,
374,
376,
378,
379,
381,
382,
383,
385,
391,
393,
394,
395,
398,
399,
400,
402,
403,
404,
405,
406,
408,
409,
411,
413,
414,
416,
417,
418,
419,
421,
424,
425,
426,
427,
428,
429,
433,
434,
435,
436,
437,
438,
439,
440,
444,
445,
446,
448,
451,
452,
454,
455,
460,
462,
463,
464,
469,
470,
475,
476,
477,
480,
482,
490,
492,
493,
494,
495,
496,
497,
498,
500,
505,
507,
510,
512,
514,
515,
516,
519,
520,
522,
524,
526,
528,
529,
530,
532,
533,
534,
536,
537,
538,
539,
541,
542,
544,
548,
551,
552,
554,
555,
557,
558,
559,
560,
561,
562,
563,
566,
567,
576,
578,
579,
581,
582,
583,
584,
586,
588,
589,
590,
591,
592,
594,
595,
599,
601,
605,
608,
610,
611,
612,
613,
615,
618,
619,
621,
622,
624,
625,
626,
627,
632,
633,
634,
637,
638,
641,
643,
645,
648,
651,
654,
656,
657,
659,
663,
664,
665,
666,
667,
668,
669,
671,
675,
677,
678,
679,
680,
681,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
697,
698,
699,
701,
702,
703,
707,
708,
712,
713,
714,
715,
716,
718,
719,
726,
727,
730,
732,
733,
734,
735,
739,
740,
741,
743,
746,
747,
748,
749,
752,
753,
754,
756,
758,
759,
760,
763,
765,
767,
768,
773,
775,
776,
777,
778,
780,
783,
785,
788,
790,
793,
794,
797,
798,
799,
800,
803,
804,
806,
807,
808,
810,
814,
815,
817,
818,
819,
820,
823,
824,
825,
827,
829,
830,
831,
832,
835,
836,
838,
840,
843,
844,
848,
849,
850,
851,
853,
855,
858,
859,
860,
861,
864,
866,
867,
869,
870,
873,
876,
877,
878,
879,
886,
888,
889,
891,
892,
893,
895,
896,
901,
902,
903,
905,
907,
911,
917,
918,
920,
923,
924,
927,
928,
929,
930,
931,
932,
934,
935,
944,
945,
946,
949,
950,
951,
953,
954,
956,
958,
961,
962,
963,
965,
966,
967,
969,
970,
972,
973,
974,
975,
977,
981,
983,
985,
986,
987,
989,
991,
994,
996,
998,
1000,
1001,
1004,
1005,
1006,
1008,
1009,
1010,
1013,
1014,
1017,
1018,
1019,
1020,
1022,
1023,
1024,
1025,
1027,
1030,
1031,
1034,
1037,
1038,
1039,
1042,
1044,
1046,
1047,
1049,
1050,
1051,
1056,
1057,
1058,
1059,
1061,
1063,
1064,
1065,
1067,
1068,
1071,
1072,
1073,
1075,
1076,
1077,
1079,
1080,
1081,
1083,
1084,
1086,
1092,
1094,
1100,
1101,
1103,
1104,
1105,
1109,
1115,
1117,
1119,
1121,
1123,
1124,
1126,
1128,
1131,
1136,
1137,
1139,
1141
]
}
|
|
talkingdata
|
What is the difference between the events of device number -9222956879900150000 that can be located and those that are unable to be located?
|
difference = SUBTRACT(SUM(latitude! = 0 and longitude! = 0), SUM(latitude = 0 and longitude = 0)); device number refers to device_id; device_id = -922956879900150000; can be location refers to latitude ! = 0 and longitude ! = 0; unable to be location refers to latitude = 0 and longitude = 0;
|
SELECT SUM(IIF(latitude != 0 AND longitude != 0, 1, 0)) - SUM(IIF(latitude = 0 AND longitude = 0, 1, 0)) AS diff FROM events WHERE device_id = '-922956879900150000'
|
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,219 | 1,219 |
CREATE TABLE `events`
(
`device_id` INTEGER DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL
)
|
[
"AS",
"AND",
"SELECT",
"SUM",
"FROM"
] | 7 |
simple
|
{
"case_1": [
554
],
"case_2": [
554
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
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,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
104,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
122,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
168,
169,
170,
171,
172,
173,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
205,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
245,
246,
247,
248,
250,
254,
255,
256,
257,
258,
259,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
270,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
285,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
350,
353,
354,
356,
357,
358,
360,
361,
362,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
418,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
439,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
492,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
508,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
551,
552,
554,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
599,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
622,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
679,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
709,
710,
711,
712,
714,
715,
716,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
785,
786,
787,
788,
790,
792,
793,
794,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
840,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
855,
857,
858,
859,
860,
861,
862,
863,
864,
866,
867,
868,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
920,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
939,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
978,
979,
980,
981,
982,
985,
986,
987,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1008,
1009,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1018,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1074,
1075,
1078,
1079,
1080,
1081,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1093,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1110,
1111,
1112,
1113,
1114,
1115,
1116,
1117,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
Please list any three devices that are owned by female users.
|
female refers to gender = 'F';
|
SELECT device_id FROM gender_age WHERE gender = 'F' LIMIT 3
|
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,220 | 1,220 |
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"LIMIT",
"SELECT",
"FROM"
] | 3 |
simple
|
{
"case_1": [
110,
842,
1138
],
"case_2": [
110,
842,
1138
],
"case_3": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
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,
360,
361,
362,
363,
364,
365,
366,
367,
368,
369,
370,
371,
372,
373,
374,
375,
376,
377,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
396,
397,
398,
399,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
410,
411,
412,
413,
414,
415,
416,
417,
418,
419,
420,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
439,
440,
441,
442,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
461,
462,
463,
464,
465,
466,
467,
468,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
481,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
492,
493,
494,
495,
496,
497,
498,
499,
500,
501,
502,
503,
504,
505,
506,
507,
508,
509,
510,
511,
512,
513,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
525,
526,
527,
528,
529,
530,
531,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
543,
544,
545,
546,
547,
548,
549,
550,
551,
552,
553,
554,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
568,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
585,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
598,
599,
600,
601,
602,
603,
604,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
617,
618,
619,
620,
621,
622,
623,
624,
625,
626,
627,
628,
629,
630,
631,
632,
633,
634,
635,
636,
637,
638,
639,
640,
641,
642,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
664,
665,
666,
667,
668,
669,
670,
671,
672,
673,
674,
675,
676,
677,
678,
679,
680,
681,
682,
683,
684,
685,
686,
687,
688,
689,
690,
691,
692,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
707,
708,
709,
710,
711,
712,
713,
714,
715,
716,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
729,
730,
731,
732,
733,
734,
735,
736,
737,
738,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
757,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
770,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
785,
786,
787,
788,
789,
790,
791,
792,
793,
794,
795,
796,
797,
798,
799,
800,
801,
802,
803,
804,
805,
806,
807,
808,
809,
810,
811,
812,
813,
814,
815,
816,
817,
818,
819,
820,
821,
822,
823,
824,
825,
826,
827,
828,
829,
830,
831,
832,
833,
834,
835,
836,
837,
838,
839,
840,
841,
842,
843,
844,
845,
846,
847,
848,
849,
850,
851,
852,
853,
854,
855,
856,
857,
858,
859,
860,
861,
862,
863,
864,
865,
866,
867,
868,
869,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
883,
884,
885,
886,
887,
888,
889,
890,
891,
892,
893,
894,
895,
896,
897,
898,
899,
900,
901,
902,
903,
904,
905,
906,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
919,
920,
921,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
933,
934,
935,
936,
937,
938,
939,
940,
941,
942,
943,
944,
945,
946,
947,
948,
949,
950,
951,
952,
953,
954,
955,
956,
957,
958,
959,
960,
961,
962,
963,
964,
965,
966,
967,
968,
969,
970,
971,
972,
973,
974,
975,
976,
977,
978,
979,
980,
981,
982,
983,
984,
985,
986,
987,
988,
989,
990,
991,
992,
993,
994,
995,
996,
997,
998,
999,
1000,
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1018,
1019,
1020,
1021,
1022,
1023,
1024,
1025,
1026,
1027,
1028,
1029,
1030,
1031,
1032,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1040,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1053,
1054,
1055,
1056,
1057,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1074,
1075,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1083,
1084,
1085,
1086,
1087,
1088,
1089,
1090,
1091,
1092,
1093,
1094,
1095,
1096,
1097,
1098,
1099,
1100,
1101,
1102,
1103,
1104,
1105,
1106,
1107,
1108,
1109,
1110,
1111,
1112,
1113,
1114,
1115,
1116,
1117,
1118,
1119,
1120,
1121,
1122,
1123,
1124,
1125,
1126,
1127,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1138,
1139,
1140,
1141
]
}
|
talkingdata
|
Please list any five app categories that are related to games, along with their label ID.
|
app categories refers to category; related to games refers to category like '%game%';
|
SELECT category, label_id FROM label_categories WHERE category LIKE '%game%' LIMIT 5
|
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,221 | 1,221 |
CREATE TABLE `label_categories`
(
CREATE TABLE `label_categories`
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY `label_id`
)
|
[
"LIKE",
"LIMIT",
"SELECT",
"FROM"
] | 4 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
110,
187,
188,
319,
445,
555,
595,
611,
675,
756,
768,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
1,
3,
10,
11,
13,
15,
17,
20,
26,
28,
29,
36,
38,
49,
55,
57,
59,
62,
69,
73,
75,
78,
81,
82,
86,
89,
90,
108,
110,
114,
121,
125,
126,
127,
131,
133,
136,
138,
146,
150,
159,
162,
163,
167,
168,
173,
174,
179,
181,
184,
185,
187,
188,
199,
200,
202,
204,
206,
208,
212,
213,
229,
233,
239,
240,
247,
252,
258,
262,
263,
264,
275,
277,
278,
281,
285,
286,
291,
309,
311,
313,
314,
315,
319,
320,
324,
328,
329,
334,
336,
337,
341,
342,
345,
348,
349,
352,
353,
356,
359,
364,
365,
371,
373,
377,
378,
379,
381,
385,
394,
395,
397,
400,
402,
403,
404,
407,
409,
411,
415,
421,
428,
429,
430,
433,
434,
435,
438,
444,
445,
451,
452,
454,
460,
462,
469,
476,
482,
495,
497,
505,
525,
530,
532,
534,
536,
538,
542,
546,
548,
552,
555,
557,
560,
566,
567,
576,
578,
579,
583,
584,
586,
590,
591,
592,
595,
598,
611,
619,
621,
624,
625,
626,
629,
634,
637,
638,
645,
654,
657,
659,
664,
665,
666,
669,
675,
681,
688,
690,
691,
698,
701,
703,
708,
713,
719,
732,
733,
735,
738,
740,
743,
747,
748,
749,
752,
754,
756,
759,
760,
768,
774,
778,
787,
790,
796,
800,
803,
804,
810,
815,
818,
823,
827,
828,
830,
832,
836,
841,
844,
850,
851,
858,
861,
865,
866,
869,
870,
875,
876,
879,
886,
889,
891,
893,
901,
907,
909,
911,
917,
918,
922,
924,
927,
929,
930,
934,
944,
946,
948,
950,
951,
953,
954,
956,
962,
963,
966,
967,
970,
972,
973,
975,
977,
979,
980,
981,
983,
987,
989,
994,
1000,
1004,
1005,
1006,
1010,
1013,
1017,
1018,
1019,
1022,
1024,
1025,
1030,
1034,
1037,
1038,
1042,
1047,
1049,
1050,
1051,
1054,
1056,
1057,
1064,
1065,
1067,
1068,
1070,
1075,
1076,
1077,
1083,
1094,
1096,
1098,
1101,
1111,
1117,
1124,
1128,
1137,
1139,
1141
]
}
|
talkingdata
|
Please list any three OPPO device models.
|
OPPO refers to phone_brand = 'OPPO';
|
SELECT device_model FROM phone_brand_device_model2 WHERE phone_brand = 'OPPO' LIMIT 3
|
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,222 | 1,222 |
CREATE TABLE `phone_brand_device_model2`
(
CREATE TABLE `phone_brand_device_model2`
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL, `phone_brand`, `device_model`
)
|
[
"LIMIT",
"SELECT",
"FROM"
] | 3 |
simple
|
{
"case_1": [
157,
506
],
"case_2": [
157,
506
],
"case_3": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
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,
360,
361,
362,
363,
364,
365,
366,
367,
368,
369,
370,
371,
372,
373,
374,
375,
376,
377,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
396,
397,
398,
399,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
410,
411,
412,
413,
414,
415,
416,
417,
418,
419,
420,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
439,
440,
441,
442,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
461,
462,
463,
464,
465,
466,
467,
468,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
481,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
492,
493,
494,
495,
496,
497,
498,
499,
500,
501,
502,
503,
504,
505,
506,
507,
508,
509,
510,
511,
512,
513,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
525,
526,
527,
528,
529,
530,
531,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
543,
544,
545,
546,
547,
548,
549,
550,
551,
552,
553,
554,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
568,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
585,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
598,
599,
600,
601,
602,
603,
604,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
617,
618,
619,
620,
621,
622,
623,
624,
625,
626,
627,
628,
629,
630,
631,
632,
633,
634,
635,
636,
637,
638,
639,
640,
641,
642,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
664,
665,
666,
667,
668,
669,
670,
671,
672,
673,
674,
675,
676,
677,
678,
679,
680,
681,
682,
683,
684,
685,
686,
687,
688,
689,
690,
691,
692,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
707,
708,
709,
710,
711,
712,
713,
714,
715,
716,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
729,
730,
731,
732,
733,
734,
735,
736,
737,
738,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
757,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
770,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
785,
786,
787,
788,
789,
790,
791,
792,
793,
794,
795,
796,
797,
798,
799,
800,
801,
802,
803,
804,
805,
806,
807,
808,
809,
810,
811,
812,
813,
814,
815,
816,
817,
818,
819,
820,
821,
822,
823,
824,
825,
826,
827,
828,
829,
830,
831,
832,
833,
834,
835,
836,
837,
838,
839,
840,
841,
842,
843,
844,
845,
846,
847,
848,
849,
850,
851,
852,
853,
854,
855,
856,
857,
858,
859,
860,
861,
862,
863,
864,
865,
866,
867,
868,
869,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
883,
884,
885,
886,
887,
888,
889,
890,
891,
892,
893,
894,
895,
896,
897,
898,
899,
900,
901,
902,
903,
904,
905,
906,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
919,
920,
921,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
933,
934,
935,
936,
937,
938,
939,
940,
941,
942,
943,
944,
945,
946,
947,
948,
949,
950,
951,
952,
953,
954,
955,
956,
957,
958,
959,
960,
961,
962,
963,
964,
965,
966,
967,
968,
969,
970,
971,
972,
973,
974,
975,
976,
977,
978,
979,
980,
981,
982,
983,
984,
985,
986,
987,
988,
989,
990,
991,
992,
993,
994,
995,
996,
997,
998,
999,
1000,
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1018,
1019,
1020,
1021,
1022,
1023,
1024,
1025,
1026,
1027,
1028,
1029,
1030,
1031,
1032,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1040,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1053,
1054,
1055,
1056,
1057,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1074,
1075,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1083,
1084,
1085,
1086,
1087,
1088,
1089,
1090,
1091,
1092,
1093,
1094,
1095,
1096,
1097,
1098,
1099,
1100,
1101,
1102,
1103,
1104,
1105,
1106,
1107,
1108,
1109,
1110,
1111,
1112,
1113,
1114,
1115,
1116,
1117,
1118,
1119,
1120,
1121,
1122,
1123,
1124,
1125,
1126,
1127,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1138,
1139,
1140,
1141
]
}
|
talkingdata
|
What is the percentage of users who experienced event number 6 who have the app installed but do not use the app?
|
percentage = MULTIPLY(DIVIDE(SUM(is_installed = 1 and is_active = 0), COUNT(app_id)), 1.0); event number refers to event_id = 6; installed refers to is_installed = 1; do not use refers to is_active = 0;
|
SELECT SUM(IIF(is_installed = 1 AND is_active = 0, 1, 0)) / COUNT(app_id) AS perrcent FROM app_events WHERE event_id = 6
|
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,223 | 1,223 |
CREATE TABLE `app_events`
(
CREATE TABLE `app_events`
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY `event_id`, `app_id`,
FOREIGN KEY `event_id` REFERENCES `events` `event_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"AS",
"AND",
"SELECT",
"SUM",
"COUNT",
"FROM"
] | 6 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
319,
382,
424,
445,
484,
506,
515,
554,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
4,
5,
6,
8,
10,
11,
12,
16,
19,
20,
21,
22,
24,
26,
27,
30,
32,
33,
35,
36,
37,
39,
40,
42,
44,
45,
47,
51,
52,
53,
55,
57,
61,
62,
63,
64,
66,
67,
68,
69,
71,
73,
74,
75,
76,
77,
81,
82,
83,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
98,
99,
104,
106,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
131,
138,
140,
141,
142,
143,
144,
146,
148,
152,
153,
154,
155,
158,
159,
160,
163,
164,
167,
169,
170,
172,
173,
175,
176,
177,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
195,
196,
197,
199,
200,
201,
202,
206,
207,
212,
213,
214,
215,
219,
223,
225,
226,
227,
228,
229,
230,
233,
234,
236,
239,
240,
243,
244,
247,
248,
254,
256,
258,
259,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
282,
286,
294,
296,
299,
300,
301,
303,
304,
305,
311,
313,
314,
315,
316,
317,
319,
320,
323,
325,
330,
334,
335,
336,
338,
339,
341,
344,
345,
347,
349,
350,
354,
356,
358,
360,
361,
363,
364,
365,
367,
368,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
423,
424,
425,
426,
427,
428,
433,
436,
437,
438,
440,
443,
444,
445,
446,
447,
448,
450,
451,
452,
453,
454,
455,
458,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
473,
475,
476,
477,
478,
480,
482,
483,
484,
485,
486,
487,
488,
490,
493,
494,
496,
497,
498,
500,
504,
505,
506,
507,
509,
510,
512,
514,
515,
516,
517,
518,
519,
520,
522,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
557,
558,
559,
560,
561,
562,
563,
564,
566,
571,
573,
575,
579,
580,
581,
582,
584,
586,
588,
589,
591,
594,
595,
596,
597,
601,
605,
606,
608,
609,
610,
611,
612,
613,
615,
618,
620,
623,
624,
625,
626,
627,
628,
630,
632,
633,
634,
637,
638,
640,
641,
643,
645,
646,
648,
649,
650,
651,
654,
656,
658,
659,
661,
662,
663,
665,
666,
667,
668,
669,
671,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
692,
693,
694,
695,
696,
697,
699,
701,
702,
705,
707,
710,
712,
714,
715,
717,
718,
719,
721,
723,
726,
727,
730,
733,
734,
735,
736,
739,
740,
741,
743,
744,
745,
746,
747,
749,
750,
752,
753,
754,
756,
758,
760,
762,
763,
765,
767,
768,
769,
772,
773,
775,
776,
777,
778,
779,
780,
783,
787,
788,
790,
793,
795,
796,
797,
798,
799,
800,
802,
804,
806,
807,
808,
810,
812,
813,
814,
817,
818,
819,
820,
823,
824,
825,
827,
829,
830,
831,
832,
835,
838,
839,
841,
843,
844,
848,
849,
851,
853,
857,
858,
859,
860,
861,
866,
867,
868,
870,
871,
873,
874,
876,
877,
878,
879,
886,
888,
892,
893,
894,
895,
896,
897,
898,
901,
902,
903,
905,
907,
909,
911,
912,
913,
915,
917,
918,
922,
923,
924,
926,
927,
928,
929,
930,
931,
932,
934,
935,
941,
943,
944,
945,
949,
950,
951,
953,
954,
956,
958,
959,
961,
962,
963,
965,
969,
973,
974,
975,
977,
981,
985,
986,
991,
993,
996,
998,
1000,
1001,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1017,
1019,
1020,
1022,
1023,
1027,
1031,
1037,
1038,
1039,
1042,
1043,
1044,
1046,
1047,
1050,
1051,
1058,
1059,
1061,
1062,
1063,
1064,
1067,
1068,
1069,
1070,
1071,
1072,
1078,
1079,
1080,
1082,
1084,
1086,
1087,
1092,
1094,
1098,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1112,
1113,
1115,
1119,
1121,
1123,
1124,
1126,
1128,
1131,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
Which gender owned more of the Galaxy Note 2 device model?
|
gender that owned more = SUBTRACT(IF(SUM(gender = 'M'), SUM(gender = 'F'),'M','F'));
|
SELECT IIF(SUM(IIF(T1.gender = 'M', 1, 0)) - SUM(IIF(T1.gender = 'F', 1, 0)) > 0, 'M', 'F') AS gender FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Galaxy Note 2'
|
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,224 | 1,224 |
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2`
(
CREATE TABLE `phone_brand_device_model2`
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY `device_id`, `phone_brand`, `device_model`
)
|
[
"AS",
"SELECT",
"SUM",
"INNER JOIN",
"ON",
"FROM"
] | 9 |
simple
|
{
"case_1": [
88,
160,
515,
608,
671,
687,
849
],
"case_2": [
88,
160,
188,
319,
445,
515,
595,
608,
671,
687,
849
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
506,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
When did event number 2 happen and how many users were active?
|
event number refers to event_id; event_id = 2; active refers to is_active = 1;
|
SELECT COUNT(T1.app_id) AS num FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id WHERE T1.event_id = 2 AND T1.is_active = 1 GROUP BY T2.timestamp
|
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,225 | 1,225 |
CREATE TABLE `app_events`
(
CREATE TABLE `app_events`
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY `event_id`, `app_id`,
FOREIGN KEY `event_id` REFERENCES `events` `event_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events`
(
CREATE TABLE `events`
`event_id` INTEGER NOT NULL,
`timestamp` DATETIME DEFAULT NULL,
PRIMARY KEY `event_id`
)
|
[
"GROUP BY",
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 10 |
simple
|
{
"case_1": [
-1
],
"case_2": [
228,
244
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1070,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
Which behavior category does user number 5902120154267990000 belong to?
|
behavior category refers to category; number refers to app_id; app_id = 5902120154267990000;
|
SELECT T1.category FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T2.app_id = 5902120154267990000
|
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,226 | 1,226 |
CREATE TABLE `app_labels`
(
CREATE TABLE `app_labels`
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY `label_id` REFERENCES `label_categories` `label_id` ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY `app_id` REFERENCES `app_all` `app_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `label_categories`
(
CREATE TABLE `label_categories`
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY `label_id`
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 6 |
simple
|
{
"case_1": [
357,
484,
839,
938
],
"case_2": [
357,
484,
611,
839,
938
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
506,
515,
555,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
508,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
978,
980,
981,
982,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1075,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
How many users belong to the same behavior category as comics?
|
behavior category refers to category; category = 'comics';
|
SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T1.category = 'comics'
|
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,227 | 1,227 |
CREATE TABLE `app_labels`
(
CREATE TABLE `app_labels`
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY `label_id` REFERENCES `label_categories` `label_id` ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY `app_id` REFERENCES `app_all` `app_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `label_categories`
(
CREATE TABLE `label_categories`
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY `label_id`
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 7 |
simple
|
{
"case_1": [
357,
484,
839,
938
],
"case_2": [
357,
484,
611,
839,
938
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
What is the age and gender of the person who uses the device number 29182687948017100 on event number 1?
|
device number refers to device_id; device_id = 29182687948017100; event number refers to event_id; and event_id = 1;
|
SELECT T1.age, T1.gender FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T1.device_id = 29182687948017100 AND T2.event_id = 1
|
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,228 | 1,228 |
CREATE TABLE `events_relevant`
(
CREATE TABLE `events_relevant`
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`,
FOREIGN KEY `device_id` REFERENCES `gender_age` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 7 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
How many male users have the log of events at the same longitude of 114?
|
male refers to gender = 'M';
|
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T2.longitude = 114 AND T1.gender = 'M'
|
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,229 | 1,229 |
CREATE TABLE `events_relevant`
(
`device_id` INTEGER DEFAULT NULL,
`longitude` REAL NOT NULL,
FOREIGN KEY `device_id` REFERENCES `gender_age` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 8 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
554,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
When did event number 7 happen for user number -8022267440849930000?
|
event number refers to event_id; event_id = 7; user number refers to app_id; app_id = -8022267440849930000;
|
SELECT T1.timestamp FROM events_relevant AS T1 INNER JOIN app_events AS T2 ON T1.event_id = T2.event_id WHERE T2.app_id = -8022267440849930000 AND T1.event_id = 7
|
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,230 | 1,230 |
CREATE TABLE `app_events`
(
CREATE TABLE `app_events`
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
PRIMARY KEY `event_id`, `app_id`,
FOREIGN KEY `event_id` REFERENCES `events` `event_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events_relevant`
(
CREATE TABLE `events_relevant`
`event_id` INTEGER NOT NULL,
`timestamp` DATETIME NOT NULL,
PRIMARY KEY `event_id`
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 7 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
What are the behavior categories that user number -9222198347540750000 belongs to?
|
behavior categories refers to category; user number refers to app_id; app_id = -9222198347540750000;
|
SELECT T3.category FROM app_all AS T1 INNER JOIN app_labels AS T2 ON T1.app_id = T2.app_id INNER JOIN label_categories AS T3 ON T2.label_id = T3.label_id WHERE T1.app_id = -9222198347540750000
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,231 | 1,231 |
CREATE TABLE `app_all`
(
CREATE TABLE `app_all`
`app_id` INTEGER NOT NULL,
PRIMARY KEY `app_id`
)
CREATE TABLE `app_labels`
(
CREATE TABLE `app_labels`
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY `label_id` REFERENCES `label_categories` `label_id` ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY `app_id` REFERENCES `app_all` `app_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `label_categories`
(
CREATE TABLE `label_categories`
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY `label_id`
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 9 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
506,
515,
555,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
508,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
978,
980,
981,
982,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1075,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
Please provide the age group of any LG Nexus 4 device users.
|
age group refers to `group`; LG Nexus 4 refers to phone_brand = 'LG' AND device_model = 'Nexus 4';
|
SELECT T1.`group` FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'LG' AND T2.device_model = 'Nexus 4'
|
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,232 | 1,232 |
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2`
(
CREATE TABLE `phone_brand_device_model2`
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY `device_id`, `phone_brand`, `device_model`
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 7 |
simple
|
{
"case_1": [
88,
160,
515,
608,
671,
687,
849
],
"case_2": [
88,
160,
188,
319,
445,
515,
595,
608,
671,
687,
849
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
Please provide the gender of at least one user who owns an HTC Desire 826 device.
|
HTC Desire 826 refers to phone_brand = 'HTC' AND device_model = 'Desire 826';
|
SELECT T1.gender FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Desire 826' AND T2.phone_brand = 'HTC'
|
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,233 | 1,233 |
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2`
(
CREATE TABLE `phone_brand_device_model2`
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY `device_id`, `phone_brand`, `device_model`
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 7 |
simple
|
{
"case_1": [
88,
160,
515,
608,
671,
687,
849
],
"case_2": [
88,
160,
188,
319,
445,
515,
595,
608,
671,
687,
849
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
What is the percentage of users who are in the same behavior category as "Academic Information"?
|
percentage = MULTIPLY(DIVIDE(SUM(category = 'Academic Information'), COUNT(app_id)), 1.0); behavior category refers to category; category = 'Academic Information';
|
SELECT SUM(IIF(T1.category = 'Academic Information', 1.0, 0)) / COUNT(T2.app_id) AS per FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id
|
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,234 | 1,234 |
CREATE TABLE `app_labels`
(
CREATE TABLE `app_labels`
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY `label_id` REFERENCES `label_categories` `label_id` ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY `app_id` REFERENCES `app_all` `app_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `label_categories`
(
CREATE TABLE `label_categories`
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY `label_id`
)
|
[
"AS",
"SELECT",
"SUM",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 9 |
simple
|
{
"case_1": [
357,
484,
839,
938
],
"case_2": [
357,
484,
611,
839,
938
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
506,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
173,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
What is the percentage of device users in the F27-28 age group who experienced an event on the 3rd of May 2016?
|
percentage = MULTIPLY(DIVIDE(SUM(`group` = 'F27-28'), COUNT(device_id)), 1.0); on the 3rd of May 2016 refers to timestamp = '2016-05-03%';
|
SELECT SUM(IIF(T1.`group` = 'F27-28', 1, 0)) / COUNT(T1.device_id) AS per FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE SUBSTR(T2.timestamp, 1, 10) = '2016-05-03'
|
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,235 | 1,235 |
CREATE TABLE `events_relevant`
(
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
FOREIGN KEY `device_id` REFERENCES `gender_age` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"AS",
"SELECT",
"SUM",
"-",
"INNER JOIN",
"ON",
"SUBSTR",
"COUNT",
"FROM"
] | 13 |
medium
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
173,
175,
176,
177,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
How many OPPO devices are there?
|
OPPO devices refers to phone_brand = 'OPPO';
|
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE phone_brand = 'OPPO'
|
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,236 | 1,236 |
CREATE TABLE `phone_brand_device_model2`
(
CREATE TABLE `phone_brand_device_model2`
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY `device_id`, `phone_brand`, `device_model`
)
|
[
"COUNT",
"SELECT",
"FROM"
] | 3 |
simple
|
{
"case_1": [
157,
506
],
"case_2": [
157,
506
],
"case_3": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
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,
360,
361,
362,
363,
364,
365,
366,
367,
368,
369,
370,
371,
372,
373,
374,
375,
376,
377,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
396,
397,
398,
399,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
410,
411,
412,
413,
414,
415,
416,
417,
418,
419,
420,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
439,
440,
441,
442,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
461,
462,
463,
464,
465,
466,
467,
468,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
481,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
492,
493,
494,
495,
496,
497,
498,
499,
500,
501,
502,
503,
504,
505,
506,
507,
508,
509,
510,
511,
512,
513,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
525,
526,
527,
528,
529,
530,
531,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
543,
544,
545,
546,
547,
548,
549,
550,
551,
552,
553,
554,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
568,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
585,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
598,
599,
600,
601,
602,
603,
604,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
617,
618,
619,
620,
621,
622,
623,
624,
625,
626,
627,
628,
629,
630,
631,
632,
633,
634,
635,
636,
637,
638,
639,
640,
641,
642,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
664,
665,
666,
667,
668,
669,
670,
671,
672,
673,
674,
675,
676,
677,
678,
679,
680,
681,
682,
683,
684,
685,
686,
687,
688,
689,
690,
691,
692,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
707,
708,
709,
710,
711,
712,
713,
714,
715,
716,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
729,
730,
731,
732,
733,
734,
735,
736,
737,
738,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
757,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
770,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
785,
786,
787,
788,
789,
790,
791,
792,
793,
794,
795,
796,
797,
798,
799,
800,
801,
802,
803,
804,
805,
806,
807,
808,
809,
810,
811,
812,
813,
814,
815,
816,
817,
818,
819,
820,
821,
822,
823,
824,
825,
826,
827,
828,
829,
830,
831,
832,
833,
834,
835,
836,
837,
838,
839,
840,
841,
842,
843,
844,
845,
846,
847,
848,
849,
850,
851,
852,
853,
854,
855,
856,
857,
858,
859,
860,
861,
862,
863,
864,
865,
866,
867,
868,
869,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
883,
884,
885,
886,
887,
888,
889,
890,
891,
892,
893,
894,
895,
896,
897,
898,
899,
900,
901,
902,
903,
904,
905,
906,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
919,
920,
921,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
933,
934,
935,
936,
937,
938,
939,
940,
941,
942,
943,
944,
945,
946,
947,
948,
949,
950,
951,
952,
953,
954,
955,
956,
957,
958,
959,
960,
961,
962,
963,
964,
965,
966,
967,
968,
969,
970,
971,
972,
973,
974,
975,
976,
977,
978,
979,
980,
981,
982,
983,
984,
985,
986,
987,
988,
989,
990,
991,
992,
993,
994,
995,
996,
997,
998,
999,
1000,
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1018,
1019,
1020,
1021,
1022,
1023,
1024,
1025,
1026,
1027,
1028,
1029,
1030,
1031,
1032,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1040,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1053,
1054,
1055,
1056,
1057,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1074,
1075,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1083,
1084,
1085,
1086,
1087,
1088,
1089,
1090,
1091,
1092,
1093,
1094,
1095,
1096,
1097,
1098,
1099,
1100,
1101,
1102,
1103,
1104,
1105,
1106,
1107,
1108,
1109,
1110,
1111,
1112,
1113,
1114,
1115,
1116,
1117,
1118,
1119,
1120,
1121,
1122,
1123,
1124,
1125,
1126,
1127,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1138,
1139,
1140,
1141
]
}
|
talkingdata
|
What is the most common age group among all device users?
|
most common age group refers to MAX(COUNT(`group`));
|
SELECT T.num FROM ( SELECT `group`, COUNT(`group`) AS num FROM gender_age GROUP BY `group` ) T
|
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,237 | 1,237 |
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL
)
|
[
"GROUP BY",
"AS",
"SELECT",
"COUNT",
"FROM"
] | 7 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
157,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
108,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
124,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
147,
148,
150,
151,
152,
153,
154,
155,
157,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
173,
175,
176,
177,
178,
179,
180,
182,
183,
184,
185,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
198,
199,
200,
201,
202,
203,
206,
207,
210,
211,
212,
213,
214,
215,
216,
217,
218,
219,
220,
221,
223,
224,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
252,
254,
256,
257,
258,
259,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
271,
272,
273,
275,
276,
277,
278,
279,
280,
281,
282,
284,
285,
286,
287,
289,
290,
291,
292,
293,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
348,
349,
352,
353,
354,
356,
357,
358,
359,
360,
361,
363,
364,
365,
367,
368,
369,
370,
371,
373,
374,
375,
376,
377,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
410,
411,
412,
413,
414,
415,
416,
417,
419,
420,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
481,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
508,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
531,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
543,
544,
545,
547,
548,
550,
551,
552,
554,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
585,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
598,
600,
601,
602,
603,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
629,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
664,
665,
666,
667,
668,
669,
670,
671,
672,
673,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
689,
690,
691,
692,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
737,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
757,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
770,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
811,
812,
813,
814,
817,
818,
819,
820,
821,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
865,
866,
867,
868,
869,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
890,
891,
892,
893,
894,
895,
896,
897,
898,
899,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
942,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
960,
961,
962,
963,
964,
965,
966,
967,
968,
969,
970,
971,
972,
973,
974,
975,
976,
977,
978,
980,
981,
982,
983,
985,
986,
987,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1030,
1031,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1053,
1055,
1056,
1057,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1075,
1076,
1077,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1090,
1091,
1092,
1094,
1095,
1096,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1108,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1127,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
How many events does the device "4069764298338760000" have?
|
SELECT COUNT(event_id) FROM events WHERE device_id = 4069764298338760000
|
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,238 | 1,238 |
CREATE TABLE `events`
(
CREATE TABLE `events`
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`
)
|
[
"COUNT",
"SELECT",
"FROM"
] | 3 |
simple
|
{
"case_1": [
222,
554
],
"case_2": [
222,
554
],
"case_3": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
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,
360,
361,
362,
363,
364,
365,
366,
367,
368,
369,
370,
371,
372,
373,
374,
375,
376,
377,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
396,
397,
398,
399,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
410,
411,
412,
413,
414,
415,
416,
417,
418,
419,
420,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
439,
440,
441,
442,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
461,
462,
463,
464,
465,
466,
467,
468,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
481,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
492,
493,
494,
495,
496,
497,
498,
499,
500,
501,
502,
503,
504,
505,
506,
507,
508,
509,
510,
511,
512,
513,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
525,
526,
527,
528,
529,
530,
531,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
543,
544,
545,
546,
547,
548,
549,
550,
551,
552,
553,
554,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
568,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
585,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
598,
599,
600,
601,
602,
603,
604,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
617,
618,
619,
620,
621,
622,
623,
624,
625,
626,
627,
628,
629,
630,
631,
632,
633,
634,
635,
636,
637,
638,
639,
640,
641,
642,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
664,
665,
666,
667,
668,
669,
670,
671,
672,
673,
674,
675,
676,
677,
678,
679,
680,
681,
682,
683,
684,
685,
686,
687,
688,
689,
690,
691,
692,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
707,
708,
709,
710,
711,
712,
713,
714,
715,
716,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
729,
730,
731,
732,
733,
734,
735,
736,
737,
738,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
757,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
770,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
785,
786,
787,
788,
789,
790,
791,
792,
793,
794,
795,
796,
797,
798,
799,
800,
801,
802,
803,
804,
805,
806,
807,
808,
809,
810,
811,
812,
813,
814,
815,
816,
817,
818,
819,
820,
821,
822,
823,
824,
825,
826,
827,
828,
829,
830,
831,
832,
833,
834,
835,
836,
837,
838,
839,
840,
841,
842,
843,
844,
845,
846,
847,
848,
849,
850,
851,
852,
853,
854,
855,
856,
857,
858,
859,
860,
861,
862,
863,
864,
865,
866,
867,
868,
869,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
883,
884,
885,
886,
887,
888,
889,
890,
891,
892,
893,
894,
895,
896,
897,
898,
899,
900,
901,
902,
903,
904,
905,
906,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
919,
920,
921,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
933,
934,
935,
936,
937,
938,
939,
940,
941,
942,
943,
944,
945,
946,
947,
948,
949,
950,
951,
952,
953,
954,
955,
956,
957,
958,
959,
960,
961,
962,
963,
964,
965,
966,
967,
968,
969,
970,
971,
972,
973,
974,
975,
976,
977,
978,
979,
980,
981,
982,
983,
984,
985,
986,
987,
988,
989,
990,
991,
992,
993,
994,
995,
996,
997,
998,
999,
1000,
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1018,
1019,
1020,
1021,
1022,
1023,
1024,
1025,
1026,
1027,
1028,
1029,
1030,
1031,
1032,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1040,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1053,
1054,
1055,
1056,
1057,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1074,
1075,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1083,
1084,
1085,
1086,
1087,
1088,
1089,
1090,
1091,
1092,
1093,
1094,
1095,
1096,
1097,
1098,
1099,
1100,
1101,
1102,
1103,
1104,
1105,
1106,
1107,
1108,
1109,
1110,
1111,
1112,
1113,
1114,
1115,
1116,
1117,
1118,
1119,
1120,
1121,
1122,
1123,
1124,
1125,
1126,
1127,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1138,
1139,
1140,
1141
]
}
|
|
talkingdata
|
How many of the apps belong in the "Equity Fund" category?
|
SELECT COUNT(T1.app_id) FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id WHERE T2.category = 'Equity Fund'
|
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,239 | 1,239 |
CREATE TABLE `app_labels`
(
CREATE TABLE `app_labels`
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY `label_id` REFERENCES `label_categories` `label_id` ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY `app_id` REFERENCES `app_all` `app_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `label_categories`
(
CREATE TABLE `label_categories`
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY `label_id`
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 7 |
simple
|
{
"case_1": [
357,
484,
839,
938
],
"case_2": [
357,
484,
611,
839,
938
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
|
talkingdata
|
List all females aged 24 to 26 devices' locations.
|
females refers to gender = 'F'; aged 24 to 26 refers to `group` = 'F24-26';
|
SELECT T2.longitude, T2.latitude FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T1.`group` = 'F24-26' AND T1.gender = 'F'
|
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,240 | 1,240 |
CREATE TABLE `events_relevant`
(
`device_id` INTEGER DEFAULT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
FOREIGN KEY `device_id` REFERENCES `gender_age` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"AS",
"AND",
"SELECT",
"-",
"INNER JOIN",
"ON",
"FROM"
] | 8 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
36,
37,
39,
41,
42,
43,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
79,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
362,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
679,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
785,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
864,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1070,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
How many male users have a Galaxy Note 3?
|
male refers to gender = 'M'; Galaxy Note 3 refers to device_model = 'Galaxy Note 3';
|
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Galaxy Note 3' AND T1.gender = 'M'
|
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,241 | 1,241 |
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2`
(
CREATE TABLE `phone_brand_device_model2`
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY `device_id`, `phone_brand`, `device_model`
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 8 |
simple
|
{
"case_1": [
88,
160,
515,
608,
671,
687,
849
],
"case_2": [
88,
160,
188,
319,
445,
515,
595,
608,
671,
687,
849
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
554,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
List all the devices' brands and models of events on 5/7/2016 at 6:03:22 AM.
|
devices' brands refers to phone_brand; models refers to device_model; on 5/7/2016 at 6:03:22 AM refers to timestamp = '2016-05-07 06:03:22';
|
SELECT T1.phone_brand, T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T2.timestamp = '2016-05-07 06:03:22'
|
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,242 | 1,242 |
CREATE TABLE `events_relevant`
(
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
FOREIGN KEY `device_id` REFERENCES `gender_age` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2`
(
CREATE TABLE `phone_brand_device_model2`
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY `device_id`, `phone_brand`, `device_model`
)
|
[
"AS",
"SELECT",
"-",
"INNER JOIN",
"ON",
"FROM"
] | 8 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
938,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1070,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
Which brand is most common among people in their twenties?
|
brand refers to phone_brand; brand that is most common refers to MAX(COUNT(phone_brand)); twenties refers to age BETWEEN 20 AND 30;
|
SELECT T.phone_brand FROM ( SELECT T2.phone_brand, COUNT(T2.phone_brand) AS num FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.age BETWEEN 20 AND 30 GROUP BY T2.phone_brand ) AS T ORDER BY T.num DESC LIMIT 1
|
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,243 | 1,243 |
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2`
(
CREATE TABLE `phone_brand_device_model2`
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY `device_id`, `phone_brand`, `device_model`
)
|
[
"GROUP BY",
"AS",
"AND",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"COUNT",
"BETWEEN",
"FROM"
] | 17 |
challenging
|
{
"case_1": [
319,
445,
595
],
"case_2": [
88,
160,
188,
319,
445,
515,
595,
608,
671,
687,
849
],
"case_3": [
88,
143,
160,
187,
188,
244,
319,
382,
424,
445,
515,
595,
608,
611,
671,
687,
756,
768,
849,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
1,
4,
10,
11,
13,
15,
20,
22,
28,
29,
30,
36,
37,
39,
47,
49,
51,
53,
55,
59,
62,
63,
68,
69,
73,
74,
75,
76,
78,
86,
88,
89,
93,
96,
98,
108,
113,
115,
117,
118,
119,
121,
125,
126,
131,
138,
140,
142,
143,
146,
150,
152,
159,
160,
162,
163,
164,
167,
169,
170,
173,
175,
179,
183,
184,
187,
188,
191,
197,
199,
200,
202,
206,
213,
214,
227,
229,
233,
239,
244,
247,
252,
256,
262,
267,
268,
275,
276,
277,
278,
281,
286,
301,
309,
311,
313,
314,
317,
319,
320,
324,
325,
329,
330,
334,
336,
339,
341,
342,
344,
345,
348,
349,
352,
353,
356,
359,
364,
365,
370,
371,
373,
374,
378,
379,
381,
382,
383,
385,
391,
394,
395,
403,
406,
409,
411,
416,
417,
424,
426,
428,
429,
434,
435,
436,
444,
445,
448,
451,
454,
460,
462,
463,
464,
469,
473,
476,
477,
482,
490,
493,
495,
497,
500,
505,
515,
516,
519,
520,
526,
530,
532,
536,
537,
538,
542,
544,
548,
552,
558,
559,
560,
562,
563,
566,
567,
578,
579,
581,
582,
584,
586,
590,
592,
595,
608,
611,
613,
621,
625,
626,
627,
630,
632,
633,
634,
637,
638,
641,
645,
651,
654,
657,
659,
663,
664,
665,
668,
669,
671,
677,
681,
686,
687,
688,
690,
691,
696,
698,
701,
703,
712,
714,
719,
721,
727,
733,
734,
735,
739,
740,
743,
748,
749,
752,
753,
756,
759,
760,
768,
777,
778,
779,
788,
790,
797,
799,
800,
803,
804,
810,
814,
818,
819,
823,
824,
827,
830,
838,
849,
850,
851,
853,
861,
866,
867,
869,
870,
876,
877,
886,
888,
889,
891,
893,
896,
901,
902,
911,
917,
918,
923,
924,
927,
929,
930,
932,
934,
935,
950,
951,
953,
954,
956,
958,
961,
962,
963,
966,
967,
969,
970,
972,
973,
975,
977,
981,
985,
986,
993,
994,
996,
1005,
1006,
1010,
1013,
1017,
1022,
1023,
1025,
1030,
1034,
1037,
1038,
1042,
1043,
1047,
1049,
1050,
1051,
1056,
1057,
1058,
1064,
1065,
1067,
1068,
1071,
1072,
1076,
1077,
1084,
1086,
1092,
1094,
1100,
1101,
1103,
1104,
1106,
1119,
1123,
1124,
1128,
1131,
1135,
1137
]
}
|
talkingdata
|
What percentage of vivo devices belong to users with no information?
|
percentage = MULTIPLY(DIVIDE(SUM(gender = NULL and age = NULL and `group` = NULL), COUNT(device_id)), 1.0); vivo devices refers to phone_brand = 'vivo'; no information refers to gender = NULL AND age = NULL AND `group` = NULL;
|
SELECT SUM(IIF(T1.gender IS NULL AND T1.age IS NULL AND T1.`group` IS NULL, 1, 0)) / COUNT(T1.device_id) AS per FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'vivo'
|
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
|
CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
)
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_events_relevant` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER DEFAULT NULL,
`is_active` INTEGER DEFAULT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `app_labels` (
`app_id` INTEGER NOT NULL,
`label_id` INTEGER NOT NULL,
FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `events` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY (`event_id`)
)
CREATE TABLE `events_relevant` (
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME NOT NULL,
`longitude` REAL NOT NULL,
`latitude` REAL NOT NULL,
PRIMARY KEY (`event_id`),
FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`),
FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `gender_age_test` (
`device_id` INTEGER NOT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `gender_age_train` (
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
CREATE TABLE `label_categories` (
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY (`label_id`)
)
CREATE TABLE `phone_brand_device_model2` (
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY (`device_id`,`phone_brand`,`device_model`)
)
CREATE TABLE `sample_submission` (
`device_id` INTEGER NOT NULL,
`F23-` REAL DEFAULT NULL,
`F24-26` REAL DEFAULT NULL,
`F27-28` REAL DEFAULT NULL,
`F29-32` REAL DEFAULT NULL,
`F33-42` REAL DEFAULT NULL,
`F43+` REAL DEFAULT NULL,
`M22-` REAL DEFAULT NULL,
`M23-26` REAL DEFAULT NULL,
`M27-28` REAL DEFAULT NULL,
`M29-31` REAL DEFAULT NULL,
`M32-38` REAL DEFAULT NULL,
`M39+` REAL DEFAULT NULL,
PRIMARY KEY (`device_id`)
)
|
na
| 1,244 | 1,244 |
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL,
`group` TEXT DEFAULT NULL,
PRIMARY KEY `device_id`,
FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE
)
CREATE TABLE `phone_brand_device_model2`
(
CREATE TABLE `phone_brand_device_model2`
`device_id` INTEGER NOT NULL,
`phone_brand` TEXT NOT NULL,
`device_model` TEXT NOT NULL,
PRIMARY KEY `device_id`, `phone_brand`, `device_model`
)
|
[
"AS",
"AND",
"SELECT",
"SUM",
"NULL",
"INNER JOIN",
"ON",
"COUNT",
"IS",
"FROM"
] | 17 |
challenging
|
{
"case_1": [
319,
445,
595
],
"case_2": [
88,
160,
188,
319,
445,
515,
595,
608,
671,
687,
849
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
319,
382,
424,
445,
484,
515,
595,
608,
611,
671,
675,
687,
756,
768,
839,
849,
1067,
1094
],
"case_4": [
88,
110,
143,
157,
160,
187,
188,
189,
222,
228,
244,
253,
260,
306,
319,
357,
382,
424,
445,
484,
506,
515,
554,
555,
595,
608,
611,
671,
675,
687,
737,
756,
768,
839,
842,
849,
938,
1026,
1067,
1094,
1138
],
"case_5": [
0,
1,
4,
5,
6,
8,
11,
12,
16,
19,
20,
21,
22,
24,
26,
27,
30,
33,
36,
37,
39,
42,
44,
45,
47,
51,
52,
53,
55,
57,
62,
63,
64,
66,
67,
68,
69,
71,
73,
74,
75,
76,
77,
81,
82,
83,
85,
86,
88,
90,
91,
93,
94,
95,
96,
98,
99,
106,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
131,
138,
140,
141,
142,
143,
144,
146,
148,
150,
152,
153,
154,
155,
158,
159,
160,
163,
164,
167,
169,
170,
171,
172,
175,
176,
177,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
195,
196,
197,
199,
200,
201,
202,
206,
207,
212,
213,
214,
219,
225,
226,
227,
228,
229,
233,
234,
236,
239,
240,
243,
244,
247,
248,
254,
256,
258,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
282,
294,
296,
298,
299,
300,
301,
303,
304,
305,
311,
313,
314,
315,
316,
317,
319,
320,
323,
325,
330,
334,
335,
336,
338,
339,
341,
344,
345,
347,
349,
354,
356,
358,
360,
361,
363,
364,
365,
368,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
424,
425,
426,
427,
428,
433,
436,
437,
438,
440,
443,
444,
445,
446,
448,
450,
451,
452,
454,
455,
460,
462,
463,
464,
465,
467,
469,
470,
471,
473,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
490,
493,
494,
496,
497,
498,
500,
505,
507,
509,
510,
514,
515,
516,
518,
519,
520,
522,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
557,
558,
559,
560,
561,
562,
563,
564,
566,
571,
573,
575,
579,
580,
581,
582,
584,
586,
588,
589,
595,
596,
597,
601,
605,
606,
608,
609,
610,
611,
612,
613,
615,
620,
623,
624,
625,
626,
627,
628,
630,
632,
633,
634,
637,
638,
640,
641,
643,
645,
646,
648,
649,
650,
651,
654,
658,
659,
662,
663,
665,
666,
668,
669,
671,
672,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
693,
694,
695,
696,
697,
699,
701,
702,
705,
706,
710,
712,
714,
715,
717,
721,
723,
724,
726,
727,
733,
734,
735,
736,
739,
740,
741,
743,
744,
745,
746,
747,
749,
750,
752,
753,
754,
756,
758,
760,
762,
763,
765,
767,
768,
769,
772,
773,
775,
776,
777,
778,
779,
780,
783,
787,
788,
790,
793,
796,
797,
798,
799,
800,
802,
804,
805,
806,
807,
808,
810,
812,
813,
814,
818,
819,
823,
824,
825,
827,
829,
830,
832,
835,
837,
838,
839,
841,
844,
848,
849,
851,
853,
857,
858,
859,
860,
861,
866,
867,
868,
870,
871,
873,
874,
876,
877,
878,
879,
880,
886,
888,
892,
893,
894,
895,
896,
897,
898,
901,
902,
905,
907,
909,
911,
912,
915,
917,
918,
922,
923,
924,
926,
927,
928,
930,
931,
932,
934,
935,
941,
943,
944,
949,
950,
951,
953,
954,
956,
958,
959,
961,
962,
963,
965,
969,
973,
974,
975,
977,
981,
985,
986,
991,
993,
996,
1000,
1001,
1005,
1006,
1008,
1010,
1012,
1013,
1014,
1015,
1017,
1019,
1020,
1022,
1023,
1027,
1031,
1037,
1038,
1039,
1042,
1043,
1044,
1046,
1047,
1050,
1051,
1058,
1059,
1061,
1062,
1063,
1064,
1066,
1067,
1068,
1069,
1071,
1072,
1078,
1080,
1082,
1084,
1086,
1087,
1092,
1094,
1098,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1112,
1115,
1119,
1121,
1123,
1124,
1128,
1131,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
Please list all the keywords of the episode "Refuge: Part 1".
|
episode "Refuge: Part 1" refers to title = 'Refuge: Part 1'
|
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Refuge: Part 1'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,245 | 1,245 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Keyword`
(
episode_id TEXT,
keyword TEXT,
primary key episode_id, keyword,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 6 |
simple
|
{
"case_1": [
474
],
"case_2": [
474,
623,
752
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
508,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
978,
980,
981,
982,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1075,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
How many keywords are there for season 9, episode 23 of law_and_order?
|
SELECT COUNT(T2.keyword) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.season = 9 AND T1.episode = 23
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,246 | 1,246 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
season INTEGER,
episode INTEGER,
episode_image TEXT
)
CREATE TABLE `Keyword`
(
episode_id TEXT,
keyword TEXT,
primary key episode_id, keyword,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 8 |
simple
|
{
"case_1": [
474
],
"case_2": [
474,
623,
752
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
|
law_episode
|
What is the title of the episode with the keyword "laundering money"?
|
keyword "laundering money" refers to keyword = 'laundering money'
|
SELECT T1.title FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.keyword = 'laundering money'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,247 | 1,247 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Keyword`
(
episode_id TEXT,
keyword TEXT,
primary key episode_id, keyword,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 6 |
simple
|
{
"case_1": [
474
],
"case_2": [
474,
623,
752
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
508,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
978,
980,
981,
982,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1075,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
Please list all the keywords for the episodes with a rating of over 8.
|
a rating of over 8 refers to rating > 8
|
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.rating > 8
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,248 | 1,248 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
episode_image TEXT,
rating REAL
)
CREATE TABLE `Keyword`
(
episode_id TEXT,
keyword TEXT,
primary key episode_id, keyword,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 6 |
simple
|
{
"case_1": [
474
],
"case_2": [
474,
623,
752
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
508,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
978,
980,
981,
982,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1075,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
How many 10-star votes were given to the episode titled "Cherished"?
|
10-star vote refers to stars = 10; titled "Cherished" refers to title = 'Cherished'
|
SELECT T2.votes FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Cherished' AND T2.stars = 10
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,249 | 1,249 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT,
votes INTEGER
)
CREATE TABLE `Vote`
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 7 |
simple
|
{
"case_1": [
163
],
"case_2": [
163,
313,
810,
973
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
How many votes did the episode titled "Cherished" get in total?
|
titled "Cherished" refers to title = 'Cherished'
|
SELECT SUM(T2.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Cherished'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,250 | 1,250 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT,
votes INTEGER
)
CREATE TABLE `Vote`
(
episode_id TEXT,
votes INTEGER,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"SELECT",
"SUM",
"INNER JOIN",
"ON",
"FROM"
] | 7 |
simple
|
{
"case_1": [
163
],
"case_2": [
163,
313,
810,
973
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
What is the title of the episode that got the most 10-star votes?
|
the most refers to max(votes); 10-star refers to stars = 10
|
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10 ORDER BY T2.votes DESC LIMIT 1
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,251 | 1,251 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT,
votes INTEGER
)
CREATE TABLE `Vote`
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"FROM"
] | 9 |
simple
|
{
"case_1": [
163
],
"case_2": [
163,
313,
810,
973
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
3,
4,
5,
6,
7,
8,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
26,
27,
28,
29,
30,
33,
34,
36,
37,
38,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
80,
81,
82,
83,
84,
85,
86,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
108,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
133,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
173,
174,
175,
176,
177,
179,
180,
181,
183,
184,
185,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
208,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
252,
254,
256,
257,
258,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
285,
286,
287,
289,
290,
291,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
337,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
348,
349,
352,
353,
354,
356,
357,
358,
359,
360,
361,
363,
364,
365,
368,
369,
370,
371,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
619,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
664,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
708,
710,
711,
712,
714,
715,
717,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
732,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
815,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
836,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
869,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
943,
944,
946,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
972,
973,
974,
975,
977,
980,
981,
983,
985,
986,
987,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1010,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1030,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1057,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1076,
1077,
1078,
1080,
1082,
1083,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1139,
1141
]
}
|
law_episode
|
Park Dietz was credited in which role in the episode titled "Cherished"?
|
credited refers to credited = 'true'; titled "Cherished" refers to title = 'Cherished'
|
SELECT T2.role FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.title = 'Cherished' AND T3.name = 'Park Dietz' AND T2.credited = 'true'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,252 | 1,252 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
person_id TEXT,
role TEXT,
credited TEXT,
primary key episode_id, person_id,
foreign key episode_id references Episodeepisode_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 11 |
medium
|
{
"case_1": [
266
],
"case_2": [
116,
266,
494,
702,
793
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
How many people had filled a role in the episode titled "Cherished", but did not show up in the on-screen credits?
|
titled "Cherished" refers to title = 'Cherished'; did not show up in the on-screen credits refers to credited = ''
|
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Cherished' AND T2.credited = 'false'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,253 | 1,253 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
credited TEXT,
primary key episode_id,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 8 |
simple
|
{
"case_1": [
-1
],
"case_2": [
175,
261
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
Who was credited as "technical advisor" in the episode titled "Cherished"?
|
who refers to name; credited refers to credited = 'true'; as "technical advisor" refers to role = 'technical advisor'; titled "Cherished" refers to title = 'Cherished'
|
SELECT T3.name FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.title = 'Cherished' AND T2.credited = 'true' AND T2.role = 'technical advisor'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,254 | 1,254 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
person_id TEXT,
role TEXT,
credited TEXT,
primary key episode_id, person_id,
foreign key episode_id references Episodeepisode_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 11 |
medium
|
{
"case_1": [
266
],
"case_2": [
116,
266,
494,
702,
793
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
For how many times was Park Dietz credited?
|
credited refers to credited = 'true'
|
SELECT COUNT(T3.person_id) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T2.credited = 'true' AND T3.name = 'Park Dietz'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,255 | 1,255 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
episode_image TEXT
)
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
person_id TEXT,
credited TEXT,
primary key episode_id, person_id,
foreign key episode_id references Episodeepisode_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 11 |
medium
|
{
"case_1": [
266
],
"case_2": [
116,
266,
494,
702,
793
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
Please list the titles of all the episodes in which Park Dietz was credited.
|
credited refers to credited = 'true'
|
SELECT T1.title FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T2.credited = 'true' AND T3.name = 'Park Dietz'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,256 | 1,256 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
person_id TEXT,
credited TEXT,
primary key episode_id, person_id,
foreign key episode_id references Episodeepisode_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 10 |
simple
|
{
"case_1": [
116,
494,
702,
793
],
"case_2": [
116,
266,
494,
702,
793
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
Was Anthony Azzara's role in episode tt0629204 displayed in the credits at the end of the episode?
|
episode tt0629204 refers to episode_id = 'tt0629204'; credited refers to credited = 'true'; not credited refers to credited = ''
|
SELECT T1.credited FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'Anthony Azzara' AND T1.episode_id = 'tt0629204'
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,257 | 1,257 |
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
person_id TEXT,
credited TEXT,
primary key episode_id, person_id,
foreign key episode_id references Episodeepisode_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 7 |
simple
|
{
"case_1": [
-1
],
"case_2": [
138
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
How many keywords are there in the episode Disciple?
|
episode Disciple refers to title = 'Disciple'
|
SELECT COUNT(T2.keyword) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Disciple'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,258 | 1,258 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Keyword`
(
episode_id TEXT,
keyword TEXT,
primary key episode_id, keyword,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 7 |
simple
|
{
"case_1": [
474
],
"case_2": [
474,
623,
752
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
Which episode got the most 1 star votes? Give its title.
|
the most refers to max(votes); 1 star refers to stars = '1'
|
SELECT T2.title FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.stars = 1 ORDER BY T1.votes DESC LIMIT 1
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,259 | 1,259 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT,
votes INTEGER
)
CREATE TABLE `Vote`
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"FROM"
] | 9 |
simple
|
{
"case_1": [
163
],
"case_2": [
163,
313,
810,
973
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
3,
4,
5,
6,
7,
8,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
26,
27,
28,
29,
30,
33,
34,
36,
37,
38,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
80,
81,
82,
83,
84,
85,
86,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
108,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
133,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
173,
174,
175,
176,
177,
179,
180,
181,
183,
184,
185,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
208,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
252,
254,
256,
257,
258,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
285,
286,
287,
289,
290,
291,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
337,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
348,
349,
352,
353,
354,
356,
357,
358,
359,
360,
361,
363,
364,
365,
368,
369,
370,
371,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
619,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
664,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
708,
710,
711,
712,
714,
715,
717,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
732,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
815,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
836,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
869,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
943,
944,
946,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
972,
973,
974,
975,
977,
980,
981,
983,
985,
986,
987,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1010,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1030,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1057,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1076,
1077,
1078,
1080,
1082,
1083,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1139,
1141
]
}
|
law_episode
|
How many nominations did Law and Order season 9, episode 20 get?
|
Law and Order refers to series = 'Law and Order'
|
SELECT COUNT(T2.award_id) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.series = 'Law and Order' AND T1.season = 9 AND T1.episode = 20
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,260 | 1,260 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
episode_image TEXT
)
CREATE TABLE `Award`
(
award_id INTEGER
primary key,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"AND",
"SELECT",
"and",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 10 |
simple
|
{
"case_1": [
-1
],
"case_2": [
733
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
For season 9, episode 17 of the show Law and Order, how many roles have been included in the credit?
|
Law and Order refers to series = 'Law and Order'; included in the credit refers to credited = 'true'
|
SELECT COUNT(T2.role) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.series = 'Law and Order' AND T1.season = 9 AND T1.episode = 17 AND T2.credited = 'true'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,261 | 1,261 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
episode_image TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
role TEXT,
credited TEXT,
primary key episode_id,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"AND",
"SELECT",
"and",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 11 |
medium
|
{
"case_1": [
175,
261
],
"case_2": [
175,
261
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
Describe what happened in the episode of award no.296.
|
description of what happened refers to summary; award no.296 refers to award_id = '296'
|
SELECT T1.summary FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.award_id = 296
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,262 | 1,262 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
summary TEXT,
episode_image TEXT
)
CREATE TABLE `Award`
(
award_id INTEGER
primary key,
award_category TEXT,
award TEXT,
episode_id TEXT,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 6 |
simple
|
{
"case_1": [
-1
],
"case_2": [
733
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
508,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
978,
980,
981,
982,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1075,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
Which role did Joseph Blair play in the show?
|
SELECT T1.role FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'Joseph Blair'
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,263 | 1,263 |
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Credit`
(
person_id TEXT,
role TEXT, person_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 6 |
simple
|
{
"case_1": [
-1
],
"case_2": [
138
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
508,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
978,
980,
981,
982,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1075,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
|
law_episode
|
How many awards has Rene Balcer been nominated for?
|
SELECT COUNT(T2.award_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.name = 'Rene Balcer'
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,264 | 1,264 |
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Award`
(
award_id INTEGER
primary key,
award_category TEXT,
award TEXT,
person_id TEXT,
foreign key person_id references Personperson_id
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 7 |
simple
|
{
"case_1": [
-1
],
"case_2": [
956
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
|
law_episode
|
For the episode with the most votes, give its air date.
|
the most votes refers to max(votes)
|
SELECT T2.air_date FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id GROUP BY T2.episode_id ORDER BY SUM(T1.votes) DESC LIMIT 1
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,265 | 1,265 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
air_date DATE,
episode_image TEXT,
votes INTEGER
)
CREATE TABLE `Vote`
(
episode_id TEXT,
votes INTEGER,
foreign key episode_id references Episodeepisode_id
)
|
[
"GROUP BY",
"AS",
"SELECT",
"SUM",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"FROM"
] | 11 |
medium
|
{
"case_1": [
313,
810,
973
],
"case_2": [
163,
313,
810,
973
],
"case_3": [
138,
163,
261,
313,
623,
733,
752,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
1,
6,
10,
11,
13,
15,
20,
22,
24,
28,
29,
36,
39,
42,
49,
55,
59,
62,
64,
69,
71,
73,
75,
77,
78,
81,
83,
86,
89,
93,
94,
108,
112,
113,
115,
120,
121,
125,
126,
127,
129,
138,
140,
141,
142,
143,
148,
150,
153,
155,
159,
162,
163,
167,
169,
173,
179,
184,
186,
187,
188,
189,
191,
195,
199,
200,
201,
202,
206,
207,
212,
213,
214,
219,
225,
226,
228,
229,
233,
234,
236,
239,
247,
248,
252,
254,
261,
262,
264,
275,
278,
279,
281,
285,
286,
300,
304,
309,
311,
313,
314,
316,
317,
319,
320,
323,
324,
329,
334,
335,
336,
341,
342,
344,
345,
347,
348,
349,
352,
353,
356,
359,
360,
363,
364,
365,
371,
373,
378,
379,
381,
383,
385,
394,
395,
402,
403,
409,
411,
412,
415,
424,
427,
428,
429,
434,
435,
438,
444,
445,
448,
450,
451,
452,
454,
460,
462,
469,
470,
473,
476,
482,
483,
486,
487,
488,
495,
497,
500,
505,
518,
530,
532,
535,
536,
537,
538,
540,
542,
547,
548,
550,
552,
560,
563,
564,
566,
567,
571,
575,
578,
579,
580,
581,
584,
586,
590,
592,
595,
597,
609,
611,
612,
621,
623,
625,
626,
628,
630,
634,
637,
638,
640,
645,
650,
651,
654,
657,
658,
659,
662,
664,
665,
666,
669,
676,
681,
682,
686,
688,
690,
691,
695,
696,
698,
701,
703,
710,
717,
719,
720,
721,
723,
733,
735,
740,
743,
744,
745,
747,
748,
750,
751,
752,
753,
759,
760,
762,
768,
776,
777,
778,
779,
787,
788,
790,
796,
800,
802,
803,
808,
810,
813,
818,
823,
825,
827,
830,
832,
841,
848,
850,
851,
861,
866,
868,
869,
870,
871,
874,
876,
882,
886,
889,
891,
893,
896,
901,
909,
911,
912,
918,
922,
924,
927,
929,
932,
934,
943,
944,
950,
951,
953,
954,
956,
958,
959,
962,
963,
966,
967,
970,
972,
973,
975,
977,
981,
987,
993,
994,
1004,
1005,
1006,
1010,
1012,
1013,
1017,
1023,
1025,
1027,
1030,
1031,
1034,
1037,
1038,
1043,
1047,
1049,
1050,
1051,
1056,
1057,
1064,
1065,
1067,
1068,
1076,
1077,
1078,
1082,
1087,
1091,
1092,
1094,
1098,
1100,
1106,
1124,
1135,
1137
]
}
|
law_episode
|
Who was nominated for award no.313? Give the full name.
|
award no.313 refers to award_id = '313'; full name refers to name
|
SELECT T1.name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.award_id = 313
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,266 | 1,266 |
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Award`
(
award_id INTEGER
primary key,
award_category TEXT,
award TEXT,
person_id TEXT,
foreign key person_id references Personperson_id
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 6 |
simple
|
{
"case_1": [
-1
],
"case_2": [
956
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
508,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
978,
980,
981,
982,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1075,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
How many episodes did J.K. Simmons' role appear on the show?
|
SELECT COUNT(T1.role) FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'J.K. Simmons'
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,267 | 1,267 |
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Credit`
(
person_id TEXT,
role TEXT, person_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 7 |
simple
|
{
"case_1": [
-1
],
"case_2": [
138
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
|
law_episode
|
Display the number of 9-star votes the episode Sideshow received.
|
9-star vote refers to stars = '9'; episode Sideshow refers to title = 'Sideshow'
|
SELECT T2.votes FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 9 AND T1.title = 'Sideshow'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,268 | 1,268 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT,
votes INTEGER
)
CREATE TABLE `Vote`
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 7 |
simple
|
{
"case_1": [
163
],
"case_2": [
163,
313,
810,
973
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
How many times is the number of keywords in "Refuge: Part 1" episode than "Shield" episode?
|
"Refuge: Part 1" episode refers to title = 'Refuge: Part 1'; "Shield" episode refers to title = 'Shield'; times = divide(count(keyword where title = 'Refuge: Part 1'), count(keyword where title = 'Shield'))
|
SELECT CAST(SUM(CASE WHEN T1.title = 'Refuge: Part 1' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.title = 'Shield' THEN 1 ELSE 0 END) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,269 | 1,269 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Keyword`
(
episode_id TEXT,
keyword TEXT,
primary key episode_id, keyword,
foreign key episode_id references Episodeepisode_id
)
|
[
"CASE WHEN",
"AS",
"SELECT",
"SUM",
"CASE",
"INNER JOIN",
"ON",
"CAST",
"FROM"
] | 14 |
medium
|
{
"case_1": [
623,
752
],
"case_2": [
474,
623,
752
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
54,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
122,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
173,
175,
176,
177,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
205,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
245,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
508,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
709,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
939,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
979,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1093,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1110,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
Calculate the average number of cast members that appeared in the credit from the 185th to the 193rd episode.
|
appeared in the credit refers to credited = 'TRUE'; from the 185th to the 193rd episode refers to number_in_series between 185 and 193; cast refers to category = 'Cast'; average number = divide(count(episode_id), 9)
|
SELECT CAST(COUNT(T1.episode_id) AS REAL) / (193 - 185 + 1) FROM Credit AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.category = 'Cast' AND T1.credited = 'true' AND T2.number_in_series BETWEEN 185 AND 193
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,270 | 1,270 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
series TEXT,
episode INTEGER,
number_in_series INTEGER,
episode_image TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
category TEXT,
credited TEXT,
primary key episode_id,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"AND",
"SELECT",
"Cast",
"INNER JOIN",
"ON",
"CAST",
"COUNT",
"BETWEEN",
"FROM"
] | 14 |
medium
|
{
"case_1": [
175,
261
],
"case_2": [
175,
261
],
"case_3": [
116,
138,
163,
175,
261,
266,
494,
623,
702,
733,
752,
793,
810,
956
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
4,
5,
6,
8,
10,
11,
12,
16,
19,
20,
21,
22,
24,
26,
27,
30,
33,
36,
37,
39,
44,
45,
47,
51,
52,
53,
55,
57,
62,
63,
64,
66,
68,
69,
71,
73,
74,
75,
76,
77,
82,
85,
86,
88,
90,
91,
93,
95,
96,
98,
99,
106,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
131,
138,
140,
141,
142,
143,
144,
146,
148,
152,
154,
158,
159,
160,
163,
164,
167,
169,
170,
172,
175,
176,
177,
179,
180,
183,
184,
187,
188,
189,
190,
191,
195,
196,
197,
199,
200,
201,
202,
206,
212,
214,
219,
223,
225,
226,
227,
229,
233,
234,
236,
239,
240,
243,
244,
247,
248,
254,
256,
258,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
282,
296,
299,
300,
301,
304,
311,
314,
315,
316,
317,
319,
320,
322,
323,
325,
330,
334,
335,
336,
338,
339,
341,
344,
345,
347,
349,
354,
356,
358,
360,
361,
364,
368,
370,
373,
374,
375,
376,
382,
383,
384,
385,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
408,
409,
411,
412,
413,
414,
416,
417,
419,
424,
425,
426,
427,
428,
433,
436,
437,
438,
440,
444,
445,
446,
448,
451,
452,
454,
455,
460,
462,
463,
464,
465,
467,
469,
470,
471,
473,
475,
476,
477,
478,
480,
482,
483,
484,
487,
488,
490,
493,
494,
496,
497,
498,
500,
505,
507,
509,
510,
514,
515,
516,
519,
520,
522,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
552,
557,
558,
559,
560,
561,
562,
563,
564,
566,
573,
575,
580,
581,
582,
584,
586,
588,
589,
595,
596,
597,
605,
606,
608,
610,
611,
612,
613,
615,
620,
623,
624,
625,
626,
627,
630,
632,
633,
634,
637,
641,
643,
645,
646,
648,
649,
651,
654,
658,
659,
662,
663,
665,
666,
668,
669,
671,
675,
676,
677,
678,
681,
683,
684,
685,
686,
687,
688,
690,
693,
694,
696,
697,
699,
702,
705,
710,
712,
714,
715,
721,
726,
727,
733,
734,
735,
736,
739,
740,
741,
743,
744,
746,
747,
749,
750,
752,
753,
754,
756,
758,
760,
762,
763,
765,
767,
768,
769,
772,
773,
775,
776,
777,
778,
779,
780,
783,
787,
788,
790,
793,
796,
797,
798,
799,
800,
802,
804,
806,
807,
808,
810,
812,
813,
814,
818,
819,
824,
825,
827,
829,
830,
832,
835,
838,
839,
841,
844,
848,
849,
851,
853,
857,
858,
859,
860,
861,
866,
867,
870,
873,
874,
876,
877,
878,
879,
886,
888,
892,
893,
894,
895,
896,
897,
898,
901,
902,
905,
907,
909,
911,
912,
915,
917,
918,
922,
923,
924,
926,
927,
928,
930,
931,
932,
934,
935,
943,
944,
949,
950,
951,
953,
954,
956,
958,
959,
961,
963,
969,
974,
975,
977,
981,
985,
986,
991,
993,
996,
1000,
1001,
1005,
1006,
1008,
1010,
1013,
1015,
1017,
1019,
1022,
1023,
1027,
1031,
1037,
1039,
1042,
1043,
1044,
1046,
1047,
1050,
1051,
1058,
1061,
1062,
1063,
1064,
1067,
1068,
1071,
1072,
1078,
1080,
1082,
1084,
1086,
1087,
1092,
1094,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1112,
1115,
1119,
1121,
1123,
1124,
1128,
1131,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
What are the names of the person that were not credited at the end of episode tt0629391?
|
not credited refers to credited = ''; episode tt0629391 refers to episode_id = 'tt0629391'
|
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.credited = 'false' AND T1.episode_id = 'tt0629391'
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,271 | 1,271 |
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
person_id TEXT,
credited TEXT,
primary key episode_id, person_id,
foreign key episode_id references Episodeepisode_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 7 |
simple
|
{
"case_1": [
-1
],
"case_2": [
138
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
How many people have won at least 3 awards?
|
won refers to result = 'Winner'; at least 3 awards refers to count(result) > 3
|
SELECT COUNT(T1.person_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.result = 'Winner' GROUP BY T1.person_id HAVING COUNT(T2.award_id) >= 3
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,272 | 1,272 |
CREATE TABLE `Person`
(
person_id TEXT
primary key
)
CREATE TABLE `Award`
(
award_id INTEGER
primary key,
award_category TEXT,
award TEXT,
person_id TEXT,
result TEXT,
foreign key person_id references Personperson_id
)
|
[
"GROUP BY",
"AS",
"SELECT",
"HAVING",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 10 |
simple
|
{
"case_1": [
-1
],
"case_2": [
956
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
179,
180,
182,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
481,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
718,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1070,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
Who is the script supervisor of the series in episode tt0629204?
|
who refers to name; script supervisor refers to role = 'script supervisor'; episode tt0629204 refers to episode_id = 'tt0629204'
|
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.episode_id = 'tt0629204' AND T1.role = 'script supervisor'
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,273 | 1,273 |
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
person_id TEXT,
role TEXT,
primary key episode_id, person_id,
foreign key episode_id references Episodeepisode_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 7 |
simple
|
{
"case_1": [
-1
],
"case_2": [
138
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
How many awards has Julia Roberts been nominated for?
|
been nominated refers to result = 'Nominee'
|
SELECT COUNT(T2.award_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.name = 'Julia Roberts' AND T2.result = 'Nominee'
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,274 | 1,274 |
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Award`
(
award_id INTEGER
primary key,
award_category TEXT,
award TEXT,
person_id TEXT,
result TEXT,
foreign key person_id references Personperson_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 8 |
simple
|
{
"case_1": [
-1
],
"case_2": [
956
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
Who is the tallest camera operator?
|
who refers to name; the tallest refers to max(height_meters); camera operator refers to role = 'camera operator'
|
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.role = 'camera operator' ORDER BY T2.height_meters DESC LIMIT 1
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,275 | 1,275 |
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE `Credit`
(
person_id TEXT,
role TEXT, person_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"FROM"
] | 9 |
simple
|
{
"case_1": [
-1
],
"case_2": [
138
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
3,
4,
5,
6,
7,
8,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
26,
27,
28,
29,
30,
33,
34,
36,
37,
38,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
80,
81,
82,
83,
84,
85,
86,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
108,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
133,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
173,
174,
175,
176,
177,
179,
180,
181,
183,
184,
185,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
208,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
252,
254,
256,
257,
258,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
285,
286,
287,
289,
290,
291,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
337,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
348,
349,
352,
353,
354,
356,
357,
358,
359,
360,
361,
363,
364,
365,
368,
369,
370,
371,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
619,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
664,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
708,
710,
711,
712,
714,
715,
717,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
732,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
815,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
836,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
869,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
943,
944,
946,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
972,
973,
974,
975,
977,
980,
981,
983,
985,
986,
987,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1010,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1030,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1057,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1076,
1077,
1078,
1080,
1082,
1083,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1139,
1141
]
}
|
law_episode
|
How many people, who were born in Canada, won an award in 1999?
|
born in Canada refers to birth_country = 'Canada'; in 1999 refers to year = 1999
|
SELECT COUNT(T1.person_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.year = 1999 AND T1.birth_country = 'Canada'
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,276 | 1,276 |
CREATE TABLE `Person`
(
person_id TEXT
primary key,
birth_country TEXT
)
CREATE TABLE `Award`
(
award_id INTEGER
primary key,
year INTEGER,
award_category TEXT,
award TEXT,
person_id TEXT,
foreign key person_id references Personperson_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 8 |
simple
|
{
"case_1": [
-1
],
"case_2": [
956
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
How many people gave the most enjoyed episode a 10-star rating?
|
the most enjoyed refers max(rating); 10-star refers to stars = 10
|
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,277 | 1,277 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
episode_image TEXT
)
CREATE TABLE `Vote`
(
episode_id TEXT,
stars INTEGER,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 7 |
simple
|
{
"case_1": [
163
],
"case_2": [
163,
313,
810,
973
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
What are the keywords of the "Shield" episode?
|
"Shield" episode refers to title = 'Shield'
|
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Shield'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,278 | 1,278 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Keyword`
(
episode_id TEXT,
keyword TEXT,
primary key episode_id, keyword,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 6 |
simple
|
{
"case_1": [
474
],
"case_2": [
474,
623,
752
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
101,
102,
104,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
215,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
506,
507,
508,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
527,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
978,
980,
981,
982,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1075,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
What is the percentage of people who gave the "True North" episode a 1-star rating?
|
the "True North" episode refers to title = 'True North'; 1-star refers to stars = 1; percentage = divide(count(episode_id where stars = 1), count(episode_id)) * 100% where title = 'True North'
|
SELECT CAST(SUM(CASE WHEN T2.stars = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'True North' AND T1.episode_id = 'tt0629477'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,279 | 1,279 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Vote`
(
episode_id TEXT,
stars INTEGER,
foreign key episode_id references Episodeepisode_id
)
|
[
"CASE WHEN",
"AS",
"AND",
"SELECT",
"SUM",
"CASE",
"INNER JOIN",
"ON",
"CAST",
"COUNT",
"FROM"
] | 13 |
medium
|
{
"case_1": [
313,
810,
973
],
"case_2": [
163,
313,
810,
973
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
4,
5,
6,
8,
11,
12,
16,
19,
20,
21,
22,
24,
26,
27,
30,
33,
35,
36,
37,
39,
42,
44,
45,
47,
51,
52,
53,
55,
57,
61,
62,
63,
64,
66,
68,
69,
71,
73,
74,
75,
76,
77,
81,
82,
83,
85,
86,
87,
88,
90,
91,
93,
94,
95,
96,
98,
99,
104,
106,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
131,
138,
140,
141,
142,
143,
144,
146,
148,
152,
153,
154,
155,
158,
159,
160,
163,
164,
167,
169,
170,
171,
172,
173,
175,
176,
177,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
195,
196,
197,
199,
200,
201,
202,
206,
207,
212,
213,
214,
215,
219,
223,
225,
226,
227,
228,
229,
233,
234,
236,
239,
240,
243,
244,
247,
248,
254,
256,
258,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
282,
296,
298,
299,
300,
301,
304,
311,
313,
314,
315,
316,
317,
319,
320,
322,
323,
325,
330,
334,
335,
336,
338,
339,
341,
344,
345,
347,
349,
354,
356,
358,
360,
361,
363,
364,
365,
368,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
423,
424,
425,
426,
427,
428,
433,
436,
437,
438,
440,
444,
445,
446,
448,
450,
451,
452,
453,
454,
455,
458,
460,
462,
463,
464,
465,
467,
469,
470,
471,
473,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
490,
493,
494,
496,
497,
498,
500,
504,
505,
507,
509,
510,
514,
515,
516,
517,
518,
519,
520,
522,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
557,
558,
559,
560,
561,
562,
563,
564,
566,
571,
573,
575,
579,
580,
581,
582,
584,
586,
588,
589,
595,
596,
597,
605,
606,
608,
609,
610,
611,
612,
613,
615,
620,
623,
624,
625,
626,
627,
628,
630,
632,
633,
634,
637,
638,
640,
641,
643,
645,
646,
648,
649,
650,
651,
654,
658,
659,
662,
663,
665,
666,
668,
669,
671,
672,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
693,
694,
695,
696,
697,
699,
701,
702,
705,
706,
710,
712,
714,
715,
717,
721,
723,
726,
727,
733,
734,
735,
736,
739,
740,
741,
743,
744,
745,
746,
747,
749,
750,
752,
753,
754,
756,
758,
760,
762,
763,
765,
767,
768,
769,
772,
773,
775,
776,
777,
778,
779,
780,
783,
787,
788,
790,
793,
795,
796,
797,
798,
799,
800,
802,
804,
805,
806,
807,
808,
810,
812,
813,
814,
818,
819,
823,
824,
825,
827,
829,
830,
832,
835,
838,
839,
841,
844,
848,
849,
851,
853,
857,
858,
859,
860,
861,
866,
867,
868,
870,
871,
873,
874,
876,
877,
878,
879,
880,
886,
888,
892,
893,
894,
895,
896,
897,
898,
901,
902,
905,
907,
909,
911,
912,
913,
915,
917,
918,
922,
923,
924,
926,
927,
928,
930,
931,
932,
934,
935,
941,
943,
944,
949,
950,
951,
953,
954,
956,
958,
959,
961,
962,
963,
969,
973,
974,
975,
977,
981,
985,
986,
991,
993,
996,
998,
1000,
1001,
1005,
1006,
1008,
1010,
1012,
1013,
1015,
1017,
1019,
1022,
1023,
1027,
1031,
1037,
1038,
1039,
1042,
1043,
1044,
1046,
1047,
1050,
1051,
1058,
1061,
1062,
1063,
1064,
1066,
1067,
1068,
1069,
1071,
1072,
1078,
1080,
1082,
1084,
1086,
1087,
1092,
1094,
1098,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1112,
1115,
1119,
1121,
1123,
1124,
1128,
1131,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
What is the title of the episode with the highest number of keywords?
|
the highest number of keywords refers to max(count(keyword))
|
SELECT T1.title FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id GROUP BY T1.episode_id ORDER BY COUNT(T2.keyword) DESC LIMIT 1
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,280 | 1,280 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Keyword`
(
episode_id TEXT,
keyword TEXT,
primary key episode_id, keyword,
foreign key episode_id references Episodeepisode_id
)
|
[
"GROUP BY",
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"COUNT",
"FROM"
] | 11 |
medium
|
{
"case_1": [
752
],
"case_2": [
752
],
"case_3": [
138,
163,
175,
261,
313,
733,
752,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
4,
6,
10,
11,
13,
15,
16,
20,
22,
27,
28,
29,
30,
36,
37,
47,
49,
51,
53,
55,
59,
62,
63,
68,
69,
73,
74,
75,
77,
78,
82,
86,
88,
89,
91,
93,
96,
98,
106,
108,
113,
115,
117,
118,
119,
121,
125,
126,
131,
138,
140,
142,
143,
146,
148,
150,
152,
159,
160,
162,
163,
164,
167,
169,
170,
173,
175,
179,
183,
184,
185,
187,
188,
189,
190,
191,
196,
197,
199,
200,
202,
206,
212,
213,
214,
225,
226,
227,
229,
233,
234,
239,
243,
244,
247,
252,
254,
256,
261,
262,
267,
268,
269,
275,
276,
277,
278,
281,
285,
286,
291,
299,
301,
309,
311,
313,
314,
316,
317,
319,
320,
323,
324,
325,
329,
330,
334,
335,
336,
338,
339,
341,
342,
344,
345,
348,
349,
352,
353,
354,
356,
358,
359,
360,
364,
365,
370,
371,
373,
374,
375,
378,
379,
381,
382,
383,
384,
385,
391,
392,
394,
395,
401,
403,
406,
409,
411,
412,
416,
417,
424,
426,
428,
429,
434,
435,
436,
444,
445,
448,
451,
454,
460,
462,
464,
465,
467,
469,
471,
473,
476,
477,
478,
482,
484,
487,
488,
490,
493,
495,
497,
500,
505,
509,
515,
516,
519,
520,
526,
530,
532,
535,
536,
537,
538,
542,
544,
547,
548,
552,
558,
559,
560,
563,
564,
566,
567,
573,
578,
579,
580,
581,
582,
584,
586,
590,
592,
595,
596,
597,
606,
608,
611,
613,
620,
621,
625,
626,
627,
630,
632,
633,
634,
637,
638,
641,
645,
646,
649,
651,
654,
657,
658,
659,
662,
663,
664,
665,
668,
669,
671,
681,
687,
688,
690,
691,
694,
696,
698,
701,
703,
705,
712,
714,
719,
720,
721,
727,
733,
734,
735,
736,
739,
740,
743,
748,
749,
750,
751,
752,
753,
756,
759,
760,
762,
768,
769,
772,
778,
779,
787,
790,
796,
797,
799,
800,
802,
803,
804,
810,
812,
813,
814,
818,
819,
823,
824,
827,
830,
838,
839,
841,
849,
850,
851,
853,
857,
861,
866,
867,
869,
870,
874,
876,
877,
882,
886,
888,
889,
891,
893,
896,
897,
898,
901,
902,
909,
911,
912,
915,
917,
918,
922,
923,
924,
926,
927,
929,
930,
932,
934,
935,
943,
950,
951,
953,
954,
956,
958,
961,
962,
963,
966,
967,
969,
970,
972,
973,
975,
977,
981,
983,
985,
986,
987,
993,
994,
996,
1004,
1005,
1006,
1010,
1013,
1015,
1017,
1022,
1023,
1025,
1030,
1034,
1037,
1038,
1042,
1043,
1047,
1049,
1050,
1051,
1056,
1057,
1058,
1062,
1064,
1065,
1067,
1068,
1071,
1072,
1076,
1077,
1078,
1082,
1084,
1086,
1087,
1091,
1094,
1100,
1101,
1103,
1104,
1106,
1112,
1119,
1123,
1124,
1128,
1131,
1133,
1134,
1135,
1137
]
}
|
law_episode
|
Among the episodes that were aired in 1998, how many won an International Monitor Awards?
|
aired in 1998 refers to air_date like '1998%'; won refers to result = 'Winner'; International Monitor Awards refers to organization = 'International Monitor Awards'
|
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE strftime('%Y', T1.air_date) = '1998' AND T2.organization = 'International Monitor Awards' AND T2.result = 'Winner'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,281 | 1,281 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
air_date DATE,
episode_image TEXT
)
CREATE TABLE `Award`
(
award_id INTEGER
primary key,
organization TEXT,
award_category TEXT,
award TEXT,
episode_id TEXT,
result TEXT,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"AND",
"SELECT",
"strftime",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 10 |
simple
|
{
"case_1": [
-1
],
"case_2": [
733
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
How many times did the episode titled "Agony" win an award?
|
titled "Agony" refers to title = 'Agony'; win an award refers to result = 'Winner'
|
SELECT COUNT(T2.award_id) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Agony' AND T2.result = 'Winner'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,282 | 1,282 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Award`
(
award_id INTEGER
primary key,
award_category TEXT,
award TEXT,
episode_id TEXT,
result TEXT,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 8 |
simple
|
{
"case_1": [
-1
],
"case_2": [
733
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
How many episodes are there in the 9th season of Law and Order? Calculate the average number of casts per season of the said series.
|
the 9th season refers to season = 9; Law and Order refers to series = 'Law and Order'; cast refers to category = 'Cast'; average number of casts per season = divide(count(person_id), count(episode_id))
|
SELECT SUM(CASE WHEN T2.season = 9 THEN 1 ELSE 0 END) AS num , CAST(SUM(CASE WHEN T2.season = 9 THEN 1 ELSE 0 END) AS REAL) / COUNT(T1.episode_id) FROM Credit AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.category = 'Cast' AND T2.series = 'Law and Order'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,283 | 1,283 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
episode_image TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
category TEXT,
primary key episode_id,
foreign key episode_id references Episodeepisode_id
)
|
[
"CASE WHEN",
"AS",
"AND",
"SELECT",
"SUM",
"Cast",
"and",
"CASE",
"INNER JOIN",
"ON",
"CAST",
"COUNT",
"FROM"
] | 19 |
challenging
|
{
"case_1": [
-1
],
"case_2": [
175,
261
],
"case_3": [
175,
261,
623,
810,
956
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
4,
6,
16,
22,
24,
30,
37,
39,
42,
47,
51,
53,
61,
63,
64,
68,
69,
71,
73,
74,
75,
77,
81,
88,
93,
96,
98,
106,
112,
113,
115,
117,
118,
119,
120,
125,
127,
129,
131,
141,
142,
143,
146,
148,
152,
153,
155,
158,
160,
164,
169,
170,
173,
175,
183,
184,
187,
189,
191,
192,
195,
197,
201,
207,
212,
214,
215,
219,
223,
225,
226,
227,
234,
236,
244,
248,
254,
256,
258,
261,
264,
267,
268,
271,
276,
277,
278,
279,
299,
300,
301,
304,
314,
316,
317,
319,
322,
323,
325,
330,
335,
339,
341,
347,
356,
360,
370,
374,
375,
376,
382,
383,
391,
393,
398,
402,
403,
406,
409,
412,
415,
416,
417,
423,
424,
426,
427,
436,
438,
444,
448,
451,
452,
453,
458,
464,
469,
470,
476,
477,
478,
483,
485,
486,
487,
488,
490,
493,
500,
504,
510,
514,
515,
516,
517,
518,
519,
520,
526,
528,
535,
537,
540,
544,
547,
550,
558,
559,
560,
563,
564,
571,
573,
575,
580,
581,
582,
595,
597,
608,
612,
613,
620,
623,
627,
628,
630,
632,
633,
640,
641,
646,
649,
658,
662,
663,
666,
668,
671,
676,
682,
686,
687,
690,
710,
712,
714,
723,
727,
734,
735,
739,
740,
743,
744,
747,
749,
750,
753,
756,
760,
762,
768,
772,
776,
777,
787,
788,
795,
796,
797,
798,
799,
800,
802,
804,
808,
810,
813,
814,
819,
824,
825,
827,
830,
832,
838,
841,
844,
848,
849,
851,
853,
867,
868,
870,
871,
874,
877,
886,
888,
894,
896,
898,
902,
909,
912,
913,
917,
922,
923,
924,
926,
930,
935,
943,
944,
954,
956,
958,
959,
961,
969,
985,
986,
991,
996,
998,
1008,
1012,
1022,
1023,
1027,
1031,
1042,
1058,
1062,
1064,
1067,
1068,
1069,
1071,
1072,
1078,
1082,
1084,
1086,
1087,
1092,
1098,
1100,
1101,
1103,
1104,
1119,
1121,
1123,
1128,
1131,
1133,
1134,
1135
]
}
|
law_episode
|
What are the keywords of the episode which received the 2nd-highest number of votes?
|
the 2nd-highest number of votes refers to second max(votes)
|
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.votes NOT IN ( SELECT MAX(T1.votes) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id ) ORDER BY T1.votes DESC LIMIT 1
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,284 | 1,284 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
episode_image TEXT,
votes INTEGER
)
CREATE TABLE `Keyword`
(
episode_id TEXT,
keyword TEXT,
primary key episode_id, keyword,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"IN",
"ON",
"DESC",
"NOT",
"FROM",
"MAX"
] | 18 |
challenging
|
{
"case_1": [
-1
],
"case_2": [
752
],
"case_3": [
138,
163,
313,
733,
752,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
1,
7,
10,
11,
20,
22,
29,
36,
49,
53,
55,
59,
62,
69,
72,
73,
75,
86,
89,
106,
119,
121,
125,
138,
140,
150,
158,
159,
162,
163,
166,
167,
171,
179,
187,
188,
195,
199,
200,
202,
206,
207,
213,
219,
229,
233,
239,
241,
247,
258,
262,
263,
275,
278,
281,
286,
298,
309,
311,
313,
314,
319,
320,
324,
329,
334,
336,
341,
342,
345,
349,
353,
356,
364,
365,
373,
378,
379,
381,
385,
386,
393,
394,
395,
398,
403,
409,
411,
428,
429,
434,
435,
436,
444,
445,
451,
454,
460,
462,
469,
476,
479,
482,
495,
497,
498,
505,
514,
516,
522,
528,
529,
530,
532,
536,
538,
542,
548,
552,
555,
557,
560,
565,
566,
567,
578,
579,
584,
586,
590,
592,
595,
611,
621,
625,
626,
630,
633,
634,
637,
638,
645,
654,
657,
659,
663,
665,
669,
672,
681,
688,
690,
691,
701,
706,
712,
724,
733,
735,
752,
759,
760,
768,
778,
790,
803,
805,
810,
818,
823,
827,
830,
837,
844,
845,
850,
851,
861,
866,
874,
876,
880,
886,
889,
891,
893,
901,
911,
918,
927,
929,
932,
934,
950,
951,
953,
954,
956,
962,
963,
966,
967,
970,
973,
975,
977,
981,
994,
1004,
1005,
1006,
1010,
1013,
1017,
1025,
1034,
1037,
1038,
1047,
1049,
1050,
1051,
1056,
1065,
1066,
1067,
1068,
1094,
1118,
1124,
1137
]
}
|
law_episode
|
How many awards did the "Agony" win?
|
the "Agony" refers to title = 'Agony'; win refers to result = 'Winner'
|
SELECT COUNT(T2.award) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Agony' AND T2.result = 'Winner'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,285 | 1,285 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Award`
(
award_id INTEGER
primary key,
award_category TEXT,
award TEXT,
episode_id TEXT,
result TEXT,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 8 |
simple
|
{
"case_1": [
-1
],
"case_2": [
733
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
Who is the narrator of the "Flight" episode?
|
who refers to name; narrator refers to role = 'Narrator'; the "Flight" episode refers to title = 'Flight'
|
SELECT T3.name FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.title = 'Flight' AND T2.role = 'Narrator'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,286 | 1,286 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
person_id TEXT,
role TEXT,
primary key episode_id, person_id,
foreign key episode_id references Episodeepisode_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 10 |
simple
|
{
"case_1": [
116,
494,
702,
793
],
"case_2": [
116,
266,
494,
702,
793
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
In which organization did Constantine Makris win the most awards?
|
win refers to result = 'Winner'; the most awards refers to max(count(award_id))
|
SELECT T2.organization FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.name = 'Constantine Makris' AND T2.result = 'Winner' GROUP BY T2.organization ORDER BY COUNT(T2.award_id) DESC LIMIT 1
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,287 | 1,287 |
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Award`
(
award_id INTEGER
primary key,
organization TEXT,
award_category TEXT,
award TEXT,
person_id TEXT,
result TEXT,
foreign key person_id references Personperson_id
)
|
[
"GROUP BY",
"AS",
"AND",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"COUNT",
"FROM"
] | 12 |
medium
|
{
"case_1": [
956
],
"case_2": [
956
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
494,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
4,
5,
6,
8,
10,
11,
12,
13,
15,
16,
19,
20,
21,
22,
24,
26,
27,
28,
29,
30,
33,
36,
37,
38,
39,
44,
45,
47,
49,
51,
52,
53,
55,
57,
59,
62,
63,
66,
68,
69,
71,
73,
74,
75,
76,
77,
78,
82,
85,
86,
88,
89,
90,
91,
93,
95,
96,
98,
99,
106,
108,
111,
112,
113,
115,
116,
117,
118,
119,
121,
125,
126,
127,
128,
129,
131,
138,
140,
141,
142,
143,
144,
146,
148,
150,
152,
154,
158,
159,
160,
162,
163,
164,
167,
169,
170,
172,
173,
175,
176,
177,
179,
180,
183,
184,
185,
187,
188,
189,
190,
191,
196,
197,
199,
200,
202,
206,
212,
213,
214,
219,
225,
226,
227,
229,
233,
234,
239,
240,
243,
244,
247,
252,
254,
256,
258,
261,
262,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
281,
282,
285,
286,
291,
296,
299,
301,
309,
311,
313,
314,
315,
316,
317,
319,
320,
323,
324,
325,
329,
330,
334,
335,
336,
338,
339,
341,
342,
344,
345,
348,
349,
352,
353,
354,
356,
358,
359,
360,
361,
364,
365,
368,
370,
371,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
408,
409,
411,
412,
413,
414,
416,
417,
419,
424,
425,
426,
427,
428,
429,
433,
434,
435,
436,
437,
438,
440,
444,
445,
446,
448,
451,
452,
454,
455,
460,
462,
463,
464,
465,
467,
469,
470,
471,
473,
475,
476,
477,
478,
480,
482,
484,
487,
488,
490,
493,
494,
495,
496,
497,
498,
500,
505,
507,
509,
514,
515,
516,
519,
520,
522,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
541,
542,
544,
547,
548,
552,
557,
558,
559,
560,
561,
562,
563,
564,
566,
567,
573,
578,
579,
580,
581,
582,
584,
586,
588,
589,
590,
592,
595,
596,
597,
605,
606,
608,
610,
611,
612,
613,
615,
620,
621,
624,
625,
626,
627,
630,
632,
633,
634,
637,
638,
641,
643,
645,
646,
648,
649,
651,
654,
657,
658,
659,
662,
663,
664,
665,
666,
668,
669,
671,
675,
677,
678,
681,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
696,
697,
698,
699,
701,
702,
703,
705,
712,
714,
715,
719,
720,
721,
726,
727,
733,
734,
735,
736,
739,
740,
741,
743,
746,
747,
748,
749,
750,
751,
752,
753,
754,
756,
758,
759,
760,
762,
763,
765,
767,
768,
769,
772,
773,
775,
776,
777,
778,
779,
780,
783,
787,
788,
790,
793,
796,
797,
799,
800,
802,
803,
804,
806,
807,
808,
810,
812,
813,
814,
818,
819,
823,
824,
825,
827,
829,
830,
832,
835,
838,
839,
841,
844,
848,
849,
850,
851,
853,
857,
858,
859,
860,
861,
866,
867,
869,
870,
873,
874,
876,
877,
878,
879,
882,
886,
888,
889,
891,
892,
893,
895,
896,
897,
898,
901,
902,
905,
907,
909,
911,
912,
915,
917,
918,
922,
923,
924,
926,
927,
928,
929,
930,
931,
932,
934,
935,
943,
944,
949,
950,
951,
953,
954,
956,
958,
961,
962,
963,
966,
967,
969,
970,
972,
973,
974,
975,
977,
981,
983,
985,
986,
987,
991,
993,
994,
996,
1000,
1001,
1004,
1005,
1006,
1010,
1013,
1015,
1017,
1019,
1022,
1023,
1025,
1027,
1030,
1031,
1034,
1037,
1038,
1039,
1042,
1043,
1044,
1046,
1047,
1049,
1050,
1051,
1056,
1057,
1058,
1061,
1062,
1063,
1064,
1065,
1067,
1068,
1071,
1072,
1076,
1077,
1078,
1080,
1082,
1084,
1086,
1087,
1091,
1092,
1094,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1112,
1115,
1119,
1123,
1124,
1128,
1131,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
Who is the stunt coordinator in episode 3?
|
who refers to name; stunt coordinator refers to role = 'stunt coordinator'
|
SELECT T3.name FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.episode = 3 AND T2.role = 'stunt coordinator'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,288 | 1,288 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
episode_image TEXT
)
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
person_id TEXT,
role TEXT,
primary key episode_id, person_id,
foreign key episode_id references Episodeepisode_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 10 |
simple
|
{
"case_1": [
116,
494,
702,
793
],
"case_2": [
116,
266,
494,
702,
793
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
510,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
How many people were not credited at the end of the "Admissions" episode?
|
not credited refers to credited = ''; the "Admissions" episode refers to title = 'Admissions'
|
SELECT COUNT(T2.person_id) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Admissions' AND T2.credited = 'false'
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,289 | 1,289 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
person_id TEXT,
credited TEXT,
primary key episode_id, person_id,
foreign key episode_id references Episodeepisode_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 8 |
simple
|
{
"case_1": [
-1
],
"case_2": [
175,
261
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
What is the title of the episode that has the highest number of crews in the Art Department?
|
the highest number of crews refers to max(count(person_id)); in the Art Department refers to category = 'Art Department'
|
SELECT T2.title FROM Credit AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.category = 'Art Department' GROUP BY T2.episode_id ORDER BY COUNT(T1.category) DESC LIMIT 1
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,290 | 1,290 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT
)
CREATE TABLE `Credit`
(
episode_id TEXT,
category TEXT,
primary key episode_id,
foreign key episode_id references Episodeepisode_id
)
|
[
"GROUP BY",
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"COUNT",
"FROM"
] | 11 |
medium
|
{
"case_1": [
175,
261
],
"case_2": [
175,
261
],
"case_3": [
138,
163,
175,
261,
313,
733,
752,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
4,
6,
10,
11,
13,
15,
16,
20,
22,
27,
28,
29,
30,
36,
37,
47,
49,
51,
53,
55,
59,
62,
63,
68,
69,
73,
74,
75,
77,
78,
82,
86,
88,
89,
91,
93,
96,
98,
106,
108,
113,
115,
117,
118,
119,
121,
125,
126,
131,
138,
140,
142,
143,
146,
148,
150,
152,
159,
160,
162,
163,
164,
167,
169,
170,
173,
175,
179,
183,
184,
185,
187,
188,
189,
190,
191,
196,
197,
199,
200,
202,
206,
212,
213,
214,
225,
226,
227,
229,
233,
234,
239,
243,
244,
247,
252,
254,
256,
261,
262,
267,
268,
269,
275,
276,
277,
278,
281,
285,
286,
291,
299,
301,
309,
311,
313,
314,
316,
317,
319,
320,
323,
324,
325,
329,
330,
334,
335,
336,
338,
339,
341,
342,
344,
345,
348,
349,
352,
353,
354,
356,
358,
359,
360,
364,
365,
370,
371,
373,
374,
375,
378,
379,
381,
382,
383,
384,
385,
391,
392,
394,
395,
401,
403,
406,
409,
411,
412,
416,
417,
424,
426,
428,
429,
434,
435,
436,
444,
445,
448,
451,
454,
460,
462,
464,
465,
467,
469,
471,
473,
476,
477,
478,
482,
484,
487,
488,
490,
493,
495,
497,
500,
505,
509,
515,
516,
519,
520,
526,
530,
532,
535,
536,
537,
538,
542,
544,
547,
548,
552,
558,
559,
560,
563,
564,
566,
567,
573,
578,
579,
580,
581,
582,
584,
586,
590,
592,
595,
596,
597,
606,
608,
611,
613,
620,
621,
625,
626,
627,
630,
632,
633,
634,
637,
638,
641,
645,
646,
649,
651,
654,
657,
658,
659,
662,
663,
664,
665,
668,
669,
671,
681,
687,
688,
690,
691,
694,
696,
698,
701,
703,
705,
712,
714,
719,
720,
721,
727,
733,
734,
735,
736,
739,
740,
743,
748,
749,
750,
751,
752,
753,
756,
759,
760,
762,
768,
769,
772,
778,
779,
787,
790,
796,
797,
799,
800,
802,
803,
804,
810,
812,
813,
814,
818,
819,
823,
824,
827,
830,
838,
839,
841,
849,
850,
851,
853,
857,
861,
866,
867,
869,
870,
874,
876,
877,
882,
886,
888,
889,
891,
893,
896,
897,
898,
901,
902,
909,
911,
912,
915,
917,
918,
922,
923,
924,
926,
927,
929,
930,
932,
934,
935,
943,
950,
951,
953,
954,
956,
958,
961,
962,
963,
966,
967,
969,
970,
972,
973,
975,
977,
981,
983,
985,
986,
987,
993,
994,
996,
1004,
1005,
1006,
1010,
1013,
1015,
1017,
1022,
1023,
1025,
1030,
1034,
1037,
1038,
1042,
1043,
1047,
1049,
1050,
1051,
1056,
1057,
1058,
1062,
1064,
1065,
1067,
1068,
1071,
1072,
1076,
1077,
1078,
1082,
1084,
1086,
1087,
1091,
1094,
1100,
1101,
1103,
1104,
1106,
1112,
1119,
1123,
1124,
1128,
1131,
1133,
1134,
1135,
1137
]
}
|
law_episode
|
How many roles did Julia Roberts play in the series?
|
SELECT COUNT(T1.role) FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'Julia Roberts'
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,291 | 1,291 |
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Credit`
(
person_id TEXT,
role TEXT, person_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 7 |
simple
|
{
"case_1": [
-1
],
"case_2": [
138
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
35,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
661,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
|
law_episode
|
What are the titles of the top 3 episodes that received no less than 30 votes in its 10-star rating?
|
no less than 30 votes refers to votes > = 30; 10-star rating refers to stars = 10
|
SELECT T2.title FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.votes >= 30 AND T1.stars = 10 ORDER BY T1.votes DESC LIMIT 3
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,292 | 1,292 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT,
votes INTEGER
)
CREATE TABLE `Vote`
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"AND",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"FROM"
] | 10 |
simple
|
{
"case_1": [
163
],
"case_2": [
163,
313,
810,
973
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
3,
4,
5,
6,
7,
8,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
26,
27,
28,
29,
30,
33,
34,
36,
37,
38,
39,
41,
42,
43,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
80,
81,
82,
83,
84,
85,
86,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
108,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
133,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
173,
174,
175,
176,
177,
179,
180,
181,
183,
184,
185,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
208,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
252,
254,
256,
257,
258,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
285,
286,
287,
289,
290,
291,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
337,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
348,
349,
352,
353,
354,
356,
357,
358,
359,
360,
361,
363,
364,
365,
368,
369,
370,
371,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
619,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
664,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
708,
710,
711,
712,
714,
715,
717,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
732,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
815,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
836,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
869,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
943,
944,
946,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
972,
973,
974,
975,
977,
980,
981,
983,
985,
986,
987,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1010,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1030,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1057,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1076,
1077,
1078,
1080,
1082,
1083,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1139,
1141
]
}
|
law_episode
|
Who is the youngest person to ever play a "clerk" role in the series?
|
who refers to name; the youngest person refers to max(birthdate); a "clerk" role refers to role = 'Clerk'
|
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.role = 'Clerk' AND T2.birthdate IS NOT NULL ORDER BY T2.birthdate LIMIT 1
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,293 | 1,293 |
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Credit`
(
person_id TEXT,
role TEXT, person_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"AND",
"SELECT",
"ORDER BY",
"LIMIT",
"NULL",
"INNER JOIN",
"ON",
"NOT",
"IS",
"FROM"
] | 12 |
medium
|
{
"case_1": [
138
],
"case_2": [
138
],
"case_3": [
116,
138,
163,
175,
266,
313,
494,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
4,
5,
7,
8,
10,
11,
12,
16,
19,
20,
21,
22,
24,
26,
29,
30,
33,
36,
37,
39,
42,
44,
45,
47,
49,
51,
52,
53,
55,
57,
59,
62,
63,
66,
67,
68,
69,
71,
73,
74,
75,
76,
85,
86,
88,
90,
92,
93,
95,
96,
98,
99,
106,
111,
112,
113,
115,
116,
117,
118,
119,
121,
125,
126,
127,
128,
129,
131,
138,
141,
142,
143,
144,
146,
148,
150,
152,
154,
158,
159,
160,
162,
163,
164,
167,
169,
170,
171,
172,
175,
176,
177,
179,
180,
183,
184,
187,
188,
195,
197,
199,
200,
202,
206,
213,
214,
219,
227,
229,
233,
239,
240,
244,
247,
256,
258,
262,
263,
265,
266,
267,
268,
272,
275,
276,
277,
278,
281,
282,
296,
298,
299,
301,
303,
305,
309,
311,
313,
314,
315,
317,
319,
320,
324,
325,
329,
330,
334,
336,
339,
341,
342,
345,
349,
353,
356,
361,
364,
365,
368,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
385,
391,
393,
394,
395,
398,
402,
403,
405,
406,
408,
409,
411,
413,
414,
416,
417,
419,
424,
425,
426,
427,
428,
429,
433,
434,
435,
436,
437,
438,
440,
443,
444,
445,
446,
448,
451,
452,
454,
455,
460,
462,
463,
464,
469,
470,
475,
476,
477,
478,
479,
480,
482,
490,
493,
494,
495,
496,
497,
498,
500,
505,
507,
508,
514,
515,
516,
519,
520,
522,
524,
526,
528,
529,
530,
532,
533,
536,
537,
538,
539,
541,
544,
548,
552,
557,
558,
559,
560,
561,
562,
563,
566,
567,
573,
578,
579,
581,
582,
584,
586,
588,
589,
590,
592,
595,
601,
605,
608,
610,
611,
612,
613,
615,
620,
621,
624,
625,
626,
627,
632,
633,
634,
637,
638,
641,
643,
645,
646,
648,
651,
654,
657,
659,
663,
665,
666,
668,
669,
671,
672,
675,
677,
678,
681,
683,
684,
685,
686,
687,
688,
690,
691,
693,
697,
699,
701,
702,
706,
712,
714,
715,
724,
726,
727,
733,
734,
735,
739,
740,
741,
743,
746,
747,
749,
752,
753,
754,
756,
758,
759,
760,
763,
765,
767,
768,
772,
773,
775,
776,
777,
778,
780,
783,
788,
790,
793,
797,
799,
800,
803,
804,
805,
806,
807,
808,
810,
814,
818,
819,
823,
824,
825,
827,
829,
830,
832,
835,
837,
838,
844,
848,
849,
850,
851,
853,
858,
859,
860,
861,
866,
867,
870,
873,
876,
877,
878,
879,
880,
886,
888,
889,
891,
892,
893,
894,
895,
896,
901,
902,
905,
907,
911,
917,
918,
923,
924,
926,
927,
928,
930,
931,
932,
934,
935,
941,
944,
949,
950,
951,
953,
954,
956,
958,
961,
962,
963,
966,
967,
969,
970,
973,
974,
975,
977,
978,
981,
982,
985,
986,
991,
994,
996,
1000,
1001,
1005,
1006,
1010,
1013,
1014,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1031,
1034,
1036,
1037,
1038,
1039,
1042,
1044,
1046,
1047,
1048,
1049,
1050,
1051,
1056,
1058,
1059,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1071,
1072,
1080,
1084,
1086,
1092,
1094,
1100,
1101,
1103,
1104,
1105,
1109,
1115,
1119,
1123,
1124,
1128,
1129,
1131,
1133,
1134,
1136,
1137
]
}
|
law_episode
|
How many people did not enjoy the finale episode?
|
did not enjoy refers to stars = 1; the finale episode refers to episode = 24
|
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.episode = 24 AND T2.stars = 1
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,294 | 1,294 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
episode_image TEXT
)
CREATE TABLE `Vote`
(
episode_id TEXT,
stars INTEGER,
foreign key episode_id references Episodeepisode_id
)
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 8 |
simple
|
{
"case_1": [
163
],
"case_2": [
163,
313,
810,
973
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
10,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
33,
34,
35,
36,
37,
39,
40,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
109,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
192,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
223,
225,
226,
227,
228,
229,
230,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
259,
260,
261,
262,
264,
265,
266,
267,
268,
269,
271,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
286,
287,
289,
290,
292,
294,
295,
296,
297,
298,
299,
300,
301,
302,
303,
304,
305,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
367,
368,
369,
370,
373,
374,
375,
376,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
504,
505,
507,
509,
510,
511,
512,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
542,
544,
547,
548,
550,
552,
554,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
600,
601,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
618,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
665,
666,
667,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
680,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
692,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
707,
710,
711,
712,
714,
715,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
730,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
795,
796,
797,
798,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
817,
818,
819,
820,
822,
823,
824,
825,
827,
828,
829,
830,
831,
832,
833,
834,
835,
837,
838,
839,
841,
843,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
903,
904,
905,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
945,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
965,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
998,
999,
1000,
1001,
1003,
1005,
1006,
1008,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1019,
1020,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1078,
1079,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1126,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
List the names of all the cast members in the series.
|
cast member refers to category = 'Cast'
|
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.category = 'Cast'
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,295 | 1,295 |
CREATE TABLE `Person`
(
person_id TEXT
primary key,
name TEXT,
birth_name TEXT,
nickname TEXT
)
CREATE TABLE `Credit`
(
person_id TEXT,
category TEXT, person_id,
foreign key person_id references Personperson_id
)
|
[
"AS",
"Cast",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 7 |
simple
|
{
"case_1": [
-1
],
"case_2": [
138
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
3,
4,
5,
6,
7,
8,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
33,
34,
36,
37,
39,
41,
42,
44,
45,
46,
47,
48,
49,
51,
52,
53,
55,
57,
58,
59,
62,
63,
64,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
80,
81,
82,
83,
84,
85,
86,
88,
90,
91,
93,
94,
95,
96,
97,
98,
99,
101,
102,
105,
106,
107,
111,
112,
113,
115,
116,
117,
118,
119,
120,
121,
125,
126,
127,
128,
129,
130,
131,
132,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143,
144,
145,
146,
148,
150,
151,
152,
153,
154,
155,
158,
159,
160,
162,
163,
164,
165,
166,
167,
169,
170,
171,
172,
175,
176,
177,
178,
179,
180,
183,
184,
186,
187,
188,
189,
190,
191,
194,
195,
196,
197,
199,
200,
201,
202,
206,
207,
211,
212,
213,
214,
217,
218,
219,
220,
221,
225,
226,
227,
228,
229,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
246,
247,
248,
250,
254,
256,
257,
258,
260,
261,
262,
264,
265,
266,
267,
268,
269,
272,
275,
276,
277,
278,
279,
280,
281,
282,
284,
287,
289,
290,
292,
295,
296,
297,
298,
299,
300,
301,
302,
304,
307,
308,
309,
311,
312,
313,
314,
315,
316,
317,
318,
319,
320,
321,
322,
323,
324,
325,
329,
330,
333,
334,
335,
336,
338,
339,
340,
341,
342,
343,
344,
345,
346,
347,
349,
353,
354,
356,
357,
358,
360,
361,
363,
364,
365,
368,
369,
370,
373,
374,
375,
376,
378,
379,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
398,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
422,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
440,
441,
444,
445,
446,
447,
448,
449,
450,
451,
452,
454,
455,
456,
457,
459,
460,
462,
463,
464,
465,
467,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
482,
483,
484,
486,
487,
488,
489,
490,
491,
493,
494,
495,
496,
497,
498,
499,
500,
501,
503,
505,
507,
509,
511,
514,
515,
516,
518,
519,
520,
521,
522,
523,
524,
526,
528,
529,
530,
532,
533,
535,
536,
537,
538,
539,
540,
541,
544,
547,
548,
550,
552,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
569,
570,
571,
572,
573,
574,
575,
577,
578,
579,
580,
581,
582,
584,
586,
587,
588,
589,
590,
592,
593,
595,
596,
597,
600,
602,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
620,
621,
623,
624,
625,
626,
627,
628,
630,
631,
632,
633,
634,
636,
637,
638,
639,
640,
641,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
654,
655,
657,
658,
659,
660,
662,
663,
665,
666,
668,
669,
670,
671,
672,
674,
675,
676,
677,
678,
681,
682,
683,
684,
685,
686,
687,
688,
690,
691,
693,
694,
695,
696,
697,
699,
700,
701,
702,
704,
705,
706,
710,
711,
712,
714,
715,
717,
720,
721,
722,
723,
724,
725,
726,
727,
728,
733,
734,
735,
736,
739,
740,
741,
742,
743,
744,
745,
746,
747,
749,
750,
751,
752,
753,
754,
755,
756,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
782,
783,
784,
786,
787,
788,
790,
792,
793,
796,
797,
799,
800,
802,
803,
804,
805,
806,
807,
808,
809,
810,
812,
813,
814,
818,
819,
822,
823,
824,
825,
827,
828,
829,
830,
832,
833,
834,
835,
837,
838,
839,
841,
844,
845,
846,
848,
849,
850,
851,
852,
853,
854,
857,
858,
859,
860,
861,
862,
863,
866,
867,
868,
870,
871,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
885,
886,
887,
888,
889,
891,
892,
893,
894,
895,
896,
897,
898,
900,
901,
902,
904,
905,
907,
908,
909,
910,
911,
912,
914,
915,
916,
917,
918,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
943,
944,
949,
950,
951,
952,
953,
954,
956,
958,
959,
961,
962,
963,
964,
966,
967,
969,
970,
971,
973,
974,
975,
977,
980,
981,
985,
986,
988,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1005,
1006,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1025,
1027,
1029,
1031,
1033,
1034,
1035,
1037,
1038,
1039,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1049,
1050,
1051,
1052,
1056,
1058,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1071,
1072,
1074,
1078,
1080,
1082,
1084,
1085,
1086,
1087,
1089,
1091,
1092,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1114,
1115,
1116,
1118,
1119,
1122,
1123,
1124,
1128,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
law_episode
|
Who is the person who appeared the most in the series? Calculate in percentage how many times he or she appeared.
|
who refers to name; appear the most refers to max(count(person_id)); percentage = divide(count(person_id where max(count(person_id))), count(person_id)) * 100%
|
SELECT T2.person_id, CAST(COUNT(T2.person_id) AS REAL) * 100 / ( SELECT COUNT(T2.person_id) AS num FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id ) AS per FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id GROUP BY T2.person_id ORDER BY COUNT(T2.person_id) DESC LIMIT 1
|
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,296 | 1,296 |
CREATE TABLE `Person`
(
person_id TEXT
primary key
)
CREATE TABLE `Credit`
(
person_id TEXT, person_id,
foreign key person_id references Personperson_id
)
|
[
"GROUP BY",
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"CAST",
"COUNT",
"FROM"
] | 23 |
challenging
|
{
"case_1": [
-1
],
"case_2": [
138
],
"case_3": [
138,
163,
175,
261,
313,
623,
733,
752,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
1,
4,
6,
10,
11,
13,
15,
16,
20,
22,
24,
27,
28,
29,
30,
36,
37,
47,
49,
51,
53,
55,
59,
62,
63,
64,
68,
69,
73,
74,
75,
77,
78,
82,
86,
88,
89,
91,
93,
96,
98,
106,
108,
113,
115,
117,
118,
119,
120,
121,
125,
126,
131,
138,
140,
142,
143,
146,
148,
150,
152,
159,
160,
162,
163,
164,
167,
169,
170,
173,
175,
179,
183,
184,
185,
187,
188,
189,
190,
191,
195,
196,
197,
199,
200,
201,
202,
206,
212,
213,
214,
225,
226,
227,
229,
233,
234,
236,
239,
243,
244,
247,
248,
252,
254,
256,
261,
262,
264,
267,
268,
269,
275,
276,
277,
278,
281,
285,
286,
291,
299,
300,
301,
304,
309,
311,
313,
314,
316,
317,
319,
320,
322,
323,
324,
325,
329,
330,
334,
335,
336,
338,
339,
341,
342,
344,
345,
347,
348,
349,
352,
353,
354,
356,
358,
359,
360,
364,
365,
370,
371,
373,
374,
375,
378,
379,
381,
382,
383,
384,
385,
391,
392,
394,
395,
401,
403,
406,
409,
411,
412,
416,
417,
424,
426,
428,
429,
434,
435,
436,
444,
445,
448,
451,
452,
454,
460,
462,
464,
465,
467,
469,
471,
473,
476,
477,
478,
482,
483,
484,
487,
488,
490,
493,
495,
497,
500,
505,
509,
515,
516,
519,
520,
526,
530,
532,
535,
536,
537,
538,
540,
542,
544,
547,
548,
552,
558,
559,
560,
563,
564,
566,
567,
573,
575,
578,
579,
580,
581,
582,
584,
586,
590,
592,
595,
596,
597,
606,
608,
611,
613,
620,
621,
623,
625,
626,
627,
630,
632,
633,
634,
637,
638,
641,
645,
646,
649,
651,
654,
657,
658,
659,
662,
663,
664,
665,
668,
669,
671,
676,
681,
686,
687,
688,
690,
691,
694,
696,
698,
701,
703,
705,
710,
712,
714,
719,
720,
721,
727,
733,
734,
735,
736,
739,
740,
743,
744,
748,
749,
750,
751,
752,
753,
756,
759,
760,
762,
768,
769,
772,
778,
779,
787,
790,
796,
797,
799,
800,
802,
803,
804,
808,
810,
812,
813,
814,
818,
819,
823,
824,
827,
830,
832,
838,
839,
841,
849,
850,
851,
853,
857,
861,
866,
867,
869,
870,
874,
876,
877,
882,
886,
888,
889,
891,
893,
894,
896,
897,
898,
901,
902,
909,
911,
912,
915,
917,
918,
922,
923,
924,
926,
927,
929,
930,
932,
934,
935,
943,
950,
951,
953,
954,
956,
958,
959,
961,
962,
963,
966,
967,
969,
970,
972,
973,
975,
977,
981,
983,
985,
986,
987,
993,
994,
996,
1004,
1005,
1006,
1010,
1013,
1015,
1017,
1022,
1023,
1025,
1030,
1034,
1037,
1038,
1042,
1043,
1047,
1049,
1050,
1051,
1056,
1057,
1058,
1062,
1064,
1065,
1067,
1068,
1070,
1071,
1072,
1076,
1077,
1078,
1082,
1084,
1086,
1087,
1091,
1094,
1100,
1101,
1103,
1104,
1106,
1112,
1119,
1123,
1124,
1128,
1131,
1133,
1134,
1135,
1137
]
}
|
law_episode
|
Which episodes of the Law & Order have been nominated for the Primetime Emmy Awards?
|
episode refers to award; the Primetime Emmy Awards refers to award_category like 'Primetime Emmy'
|
SELECT DISTINCT episode_id FROM Award WHERE award_category = 'Primetime Emmy'
|
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,297 | 1,297 |
CREATE TABLE `Award`
(
award_id INTEGER
primary key,
award_category TEXT,
award TEXT,
episode_id TEXT,
foreign key episode_id references Episodeepisode_id
)
|
[
"SELECT",
"FROM"
] | 2 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
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,
360,
361,
362,
363,
364,
365,
366,
367,
368,
369,
370,
371,
372,
373,
374,
375,
376,
377,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
396,
397,
398,
399,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
410,
411,
412,
413,
414,
415,
416,
417,
418,
419,
420,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
439,
440,
441,
442,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
461,
462,
463,
464,
465,
466,
467,
468,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
481,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
492,
493,
494,
495,
496,
497,
498,
499,
500,
501,
502,
503,
504,
505,
506,
507,
508,
509,
510,
511,
512,
513,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
525,
526,
527,
528,
529,
530,
531,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
543,
544,
545,
546,
547,
548,
549,
550,
551,
552,
553,
554,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
568,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
585,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
598,
599,
600,
601,
602,
603,
604,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
617,
618,
619,
620,
621,
622,
623,
624,
625,
626,
627,
628,
629,
630,
631,
632,
633,
634,
635,
636,
637,
638,
639,
640,
641,
642,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
664,
665,
666,
667,
668,
669,
670,
671,
672,
673,
674,
675,
676,
677,
678,
679,
680,
681,
682,
683,
684,
685,
686,
687,
688,
689,
690,
691,
692,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
707,
708,
709,
710,
711,
712,
713,
714,
715,
716,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
729,
730,
731,
732,
733,
734,
735,
736,
737,
738,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
757,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
770,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
785,
786,
787,
788,
789,
790,
791,
792,
793,
794,
795,
796,
797,
798,
799,
800,
801,
802,
803,
804,
805,
806,
807,
808,
809,
810,
811,
812,
813,
814,
815,
816,
817,
818,
819,
820,
821,
822,
823,
824,
825,
826,
827,
828,
829,
830,
831,
832,
833,
834,
835,
836,
837,
838,
839,
840,
841,
842,
843,
844,
845,
846,
847,
848,
849,
850,
851,
852,
853,
854,
855,
856,
857,
858,
859,
860,
861,
862,
863,
864,
865,
866,
867,
868,
869,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
883,
884,
885,
886,
887,
888,
889,
890,
891,
892,
893,
894,
895,
896,
897,
898,
899,
900,
901,
902,
903,
904,
905,
906,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
919,
920,
921,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
933,
934,
935,
936,
937,
938,
939,
940,
941,
942,
943,
944,
945,
946,
947,
948,
949,
950,
951,
952,
953,
954,
955,
956,
957,
958,
959,
960,
961,
962,
963,
964,
965,
966,
967,
968,
969,
970,
971,
972,
973,
974,
975,
976,
977,
978,
979,
980,
981,
982,
983,
984,
985,
986,
987,
988,
989,
990,
991,
992,
993,
994,
995,
996,
997,
998,
999,
1000,
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1018,
1019,
1020,
1021,
1022,
1023,
1024,
1025,
1026,
1027,
1028,
1029,
1030,
1031,
1032,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1040,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1053,
1054,
1055,
1056,
1057,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1074,
1075,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1083,
1084,
1085,
1086,
1087,
1088,
1089,
1090,
1091,
1092,
1093,
1094,
1095,
1096,
1097,
1098,
1099,
1100,
1101,
1102,
1103,
1104,
1105,
1106,
1107,
1108,
1109,
1110,
1111,
1112,
1113,
1114,
1115,
1116,
1117,
1118,
1119,
1120,
1121,
1122,
1123,
1124,
1125,
1126,
1127,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1138,
1139,
1140,
1141
]
}
|
law_episode
|
How many episodes have not won any Law & Order series awards?
|
have not won any award refers to Result = 'Nominee'
|
SELECT COUNT(award_id) FROM Award WHERE Result = 'Nominee'
|
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,298 | 1,298 |
CREATE TABLE `Award`
(
award_id INTEGER
primary key,
award_category TEXT,
award TEXT
)
|
[
"COUNT",
"SELECT",
"FROM"
] | 3 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
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,
360,
361,
362,
363,
364,
365,
366,
367,
368,
369,
370,
371,
372,
373,
374,
375,
376,
377,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
396,
397,
398,
399,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
410,
411,
412,
413,
414,
415,
416,
417,
418,
419,
420,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
439,
440,
441,
442,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
461,
462,
463,
464,
465,
466,
467,
468,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
481,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
492,
493,
494,
495,
496,
497,
498,
499,
500,
501,
502,
503,
504,
505,
506,
507,
508,
509,
510,
511,
512,
513,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
525,
526,
527,
528,
529,
530,
531,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
543,
544,
545,
546,
547,
548,
549,
550,
551,
552,
553,
554,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
568,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
585,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
598,
599,
600,
601,
602,
603,
604,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
617,
618,
619,
620,
621,
622,
623,
624,
625,
626,
627,
628,
629,
630,
631,
632,
633,
634,
635,
636,
637,
638,
639,
640,
641,
642,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
664,
665,
666,
667,
668,
669,
670,
671,
672,
673,
674,
675,
676,
677,
678,
679,
680,
681,
682,
683,
684,
685,
686,
687,
688,
689,
690,
691,
692,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
707,
708,
709,
710,
711,
712,
713,
714,
715,
716,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
729,
730,
731,
732,
733,
734,
735,
736,
737,
738,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
757,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
770,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
785,
786,
787,
788,
789,
790,
791,
792,
793,
794,
795,
796,
797,
798,
799,
800,
801,
802,
803,
804,
805,
806,
807,
808,
809,
810,
811,
812,
813,
814,
815,
816,
817,
818,
819,
820,
821,
822,
823,
824,
825,
826,
827,
828,
829,
830,
831,
832,
833,
834,
835,
836,
837,
838,
839,
840,
841,
842,
843,
844,
845,
846,
847,
848,
849,
850,
851,
852,
853,
854,
855,
856,
857,
858,
859,
860,
861,
862,
863,
864,
865,
866,
867,
868,
869,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
883,
884,
885,
886,
887,
888,
889,
890,
891,
892,
893,
894,
895,
896,
897,
898,
899,
900,
901,
902,
903,
904,
905,
906,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
919,
920,
921,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
933,
934,
935,
936,
937,
938,
939,
940,
941,
942,
943,
944,
945,
946,
947,
948,
949,
950,
951,
952,
953,
954,
955,
956,
957,
958,
959,
960,
961,
962,
963,
964,
965,
966,
967,
968,
969,
970,
971,
972,
973,
974,
975,
976,
977,
978,
979,
980,
981,
982,
983,
984,
985,
986,
987,
988,
989,
990,
991,
992,
993,
994,
995,
996,
997,
998,
999,
1000,
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1018,
1019,
1020,
1021,
1022,
1023,
1024,
1025,
1026,
1027,
1028,
1029,
1030,
1031,
1032,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1040,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1053,
1054,
1055,
1056,
1057,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1074,
1075,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1083,
1084,
1085,
1086,
1087,
1088,
1089,
1090,
1091,
1092,
1093,
1094,
1095,
1096,
1097,
1098,
1099,
1100,
1101,
1102,
1103,
1104,
1105,
1106,
1107,
1108,
1109,
1110,
1111,
1112,
1113,
1114,
1115,
1116,
1117,
1118,
1119,
1120,
1121,
1122,
1123,
1124,
1125,
1126,
1127,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1138,
1139,
1140,
1141
]
}
|
law_episode
|
What roles have not been credited at the end of the episodes?
|
have not been credited refers to credited = ''
|
SELECT DISTINCT role FROM Credit WHERE credited = 'false'
|
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,299 | 1,299 |
CREATE TABLE `Credit`
(
credited TEXT
)
|
[
"SELECT",
"FROM"
] | 2 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
0,
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,
360,
361,
362,
363,
364,
365,
366,
367,
368,
369,
370,
371,
372,
373,
374,
375,
376,
377,
378,
379,
380,
381,
382,
383,
384,
385,
386,
387,
388,
389,
390,
391,
392,
393,
394,
395,
396,
397,
398,
399,
400,
401,
402,
403,
404,
405,
406,
407,
408,
409,
410,
411,
412,
413,
414,
415,
416,
417,
418,
419,
420,
421,
422,
423,
424,
425,
426,
427,
428,
429,
430,
431,
432,
433,
434,
435,
436,
437,
438,
439,
440,
441,
442,
443,
444,
445,
446,
447,
448,
449,
450,
451,
452,
453,
454,
455,
456,
457,
458,
459,
460,
461,
462,
463,
464,
465,
466,
467,
468,
469,
470,
471,
472,
473,
474,
475,
476,
477,
478,
479,
480,
481,
482,
483,
484,
485,
486,
487,
488,
489,
490,
491,
492,
493,
494,
495,
496,
497,
498,
499,
500,
501,
502,
503,
504,
505,
506,
507,
508,
509,
510,
511,
512,
513,
514,
515,
516,
517,
518,
519,
520,
521,
522,
523,
524,
525,
526,
527,
528,
529,
530,
531,
532,
533,
534,
535,
536,
537,
538,
539,
540,
541,
542,
543,
544,
545,
546,
547,
548,
549,
550,
551,
552,
553,
554,
555,
556,
557,
558,
559,
560,
561,
562,
563,
564,
565,
566,
567,
568,
569,
570,
571,
572,
573,
574,
575,
576,
577,
578,
579,
580,
581,
582,
583,
584,
585,
586,
587,
588,
589,
590,
591,
592,
593,
594,
595,
596,
597,
598,
599,
600,
601,
602,
603,
604,
605,
606,
607,
608,
609,
610,
611,
612,
613,
614,
615,
616,
617,
618,
619,
620,
621,
622,
623,
624,
625,
626,
627,
628,
629,
630,
631,
632,
633,
634,
635,
636,
637,
638,
639,
640,
641,
642,
643,
644,
645,
646,
647,
648,
649,
650,
651,
652,
653,
654,
655,
656,
657,
658,
659,
660,
661,
662,
663,
664,
665,
666,
667,
668,
669,
670,
671,
672,
673,
674,
675,
676,
677,
678,
679,
680,
681,
682,
683,
684,
685,
686,
687,
688,
689,
690,
691,
692,
693,
694,
695,
696,
697,
698,
699,
700,
701,
702,
703,
704,
705,
706,
707,
708,
709,
710,
711,
712,
713,
714,
715,
716,
717,
718,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
729,
730,
731,
732,
733,
734,
735,
736,
737,
738,
739,
740,
741,
742,
743,
744,
745,
746,
747,
748,
749,
750,
751,
752,
753,
754,
755,
756,
757,
758,
759,
760,
761,
762,
763,
764,
765,
766,
767,
768,
769,
770,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
785,
786,
787,
788,
789,
790,
791,
792,
793,
794,
795,
796,
797,
798,
799,
800,
801,
802,
803,
804,
805,
806,
807,
808,
809,
810,
811,
812,
813,
814,
815,
816,
817,
818,
819,
820,
821,
822,
823,
824,
825,
826,
827,
828,
829,
830,
831,
832,
833,
834,
835,
836,
837,
838,
839,
840,
841,
842,
843,
844,
845,
846,
847,
848,
849,
850,
851,
852,
853,
854,
855,
856,
857,
858,
859,
860,
861,
862,
863,
864,
865,
866,
867,
868,
869,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
880,
881,
882,
883,
884,
885,
886,
887,
888,
889,
890,
891,
892,
893,
894,
895,
896,
897,
898,
899,
900,
901,
902,
903,
904,
905,
906,
907,
908,
909,
910,
911,
912,
913,
914,
915,
916,
917,
918,
919,
920,
921,
922,
923,
924,
925,
926,
927,
928,
929,
930,
931,
932,
933,
934,
935,
936,
937,
938,
939,
940,
941,
942,
943,
944,
945,
946,
947,
948,
949,
950,
951,
952,
953,
954,
955,
956,
957,
958,
959,
960,
961,
962,
963,
964,
965,
966,
967,
968,
969,
970,
971,
972,
973,
974,
975,
976,
977,
978,
979,
980,
981,
982,
983,
984,
985,
986,
987,
988,
989,
990,
991,
992,
993,
994,
995,
996,
997,
998,
999,
1000,
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1018,
1019,
1020,
1021,
1022,
1023,
1024,
1025,
1026,
1027,
1028,
1029,
1030,
1031,
1032,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1040,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1053,
1054,
1055,
1056,
1057,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1074,
1075,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1083,
1084,
1085,
1086,
1087,
1088,
1089,
1090,
1091,
1092,
1093,
1094,
1095,
1096,
1097,
1098,
1099,
1100,
1101,
1102,
1103,
1104,
1105,
1106,
1107,
1108,
1109,
1110,
1111,
1112,
1113,
1114,
1115,
1116,
1117,
1118,
1119,
1120,
1121,
1122,
1123,
1124,
1125,
1126,
1127,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137,
1138,
1139,
1140,
1141
]
}
|
law_episode
|
What is the title of the 3 worst rated episodes?
|
worst rated refers to min(rating)
|
SELECT title FROM Episode ORDER BY rating LIMIT 3
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
|
CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating REAL,
votes INTEGER
)
CREATE TABLE Keyword
(
episode_id TEXT,
keyword TEXT,
primary key (episode_id, keyword),
foreign key (episode_id) references Episode(episode_id)
)
CREATE TABLE Person
(
person_id TEXT
primary key,
name TEXT,
birthdate DATE,
birth_name TEXT,
birth_place TEXT,
birth_region TEXT,
birth_country TEXT,
height_meters REAL,
nickname TEXT
)
CREATE TABLE Award
(
award_id INTEGER
primary key,
organization TEXT,
year INTEGER,
award_category TEXT,
award TEXT,
series TEXT,
episode_id TEXT,
person_id TEXT,
role TEXT,
result TEXT,
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Credit
(
episode_id TEXT,
person_id TEXT,
category TEXT,
role TEXT,
credited TEXT,
primary key (episode_id, person_id),
foreign key (episode_id) references Episode(episode_id),
foreign key (person_id) references Person(person_id)
)
CREATE TABLE Vote
(
episode_id TEXT,
stars INTEGER,
votes INTEGER,
percent REAL,
foreign key (episode_id) references Episode(episode_id)
)
|
na
| 1,300 | 1,300 |
CREATE TABLE `Episode`
(
episode_id TEXT
primary key,
episode INTEGER,
title TEXT,
episode_image TEXT,
rating REAL
)
|
[
"ORDER BY",
"LIMIT",
"SELECT",
"FROM"
] | 4 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
138,
163,
313,
733,
752,
810,
956,
973
],
"case_4": [
116,
138,
163,
175,
261,
266,
313,
474,
494,
623,
702,
733,
752,
793,
810,
956,
973
],
"case_5": [
1,
10,
11,
13,
15,
17,
20,
28,
29,
36,
38,
43,
49,
55,
59,
62,
69,
73,
75,
78,
86,
89,
108,
110,
121,
125,
133,
138,
150,
159,
162,
163,
167,
173,
174,
179,
181,
185,
187,
188,
199,
200,
202,
206,
208,
213,
229,
233,
239,
247,
252,
262,
263,
275,
278,
281,
285,
286,
291,
309,
311,
313,
314,
319,
320,
324,
328,
329,
334,
336,
337,
341,
342,
345,
348,
349,
352,
353,
356,
359,
364,
365,
371,
373,
378,
379,
381,
385,
394,
395,
400,
403,
404,
409,
411,
428,
429,
434,
435,
444,
445,
451,
454,
460,
462,
469,
482,
495,
497,
505,
530,
532,
534,
536,
538,
542,
548,
552,
555,
560,
566,
567,
576,
578,
579,
583,
584,
586,
590,
592,
595,
611,
619,
621,
625,
626,
634,
637,
638,
645,
654,
657,
659,
664,
665,
669,
681,
688,
690,
691,
698,
701,
703,
708,
713,
719,
732,
733,
735,
748,
752,
759,
760,
768,
778,
790,
803,
810,
815,
818,
823,
827,
830,
836,
850,
851,
861,
866,
869,
876,
886,
889,
891,
893,
901,
911,
918,
927,
929,
934,
946,
950,
951,
953,
954,
956,
962,
963,
966,
967,
970,
972,
973,
975,
977,
981,
983,
987,
989,
994,
1004,
1005,
1006,
1010,
1013,
1017,
1024,
1025,
1030,
1034,
1037,
1038,
1047,
1049,
1050,
1051,
1056,
1057,
1065,
1067,
1068,
1075,
1076,
1077,
1083,
1094,
1124,
1137,
1139,
1141
]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.