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
|
How many female users belong to the age group of 27 to 28?
|
female refers to gender = 'F'; age group of 27 to 28 refers to `group` = 'F27-28';
|
SELECT COUNT(device_id) FROM gender_age WHERE `group` = 'F27-28' AND gender = 'F'
|
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,101 | 1,101 |
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
)
|
[
"AND",
"SELECT",
"-",
"COUNT",
"FROM"
] | 5 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
157,
160,
187,
188,
189,
228,
244,
253,
319,
382,
424,
445,
484,
515,
554,
595,
608,
611,
671,
675,
687,
737,
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,
3,
4,
5,
6,
8,
9,
10,
11,
12,
13,
15,
16,
19,
20,
21,
22,
24,
25,
26,
27,
28,
30,
32,
33,
34,
35,
36,
37,
38,
39,
40,
42,
43,
44,
45,
47,
50,
51,
52,
53,
55,
56,
57,
61,
62,
63,
66,
67,
68,
69,
71,
73,
74,
75,
76,
77,
78,
79,
82,
85,
86,
87,
88,
89,
90,
91,
93,
95,
96,
97,
98,
99,
100,
105,
106,
108,
109,
111,
112,
113,
115,
116,
117,
118,
119,
121,
124,
125,
126,
127,
128,
129,
131,
135,
138,
140,
141,
142,
143,
144,
146,
147,
148,
152,
154,
157,
158,
159,
160,
163,
164,
167,
168,
169,
170,
172,
173,
175,
176,
177,
179,
180,
182,
183,
184,
185,
187,
188,
189,
190,
191,
192,
196,
197,
198,
199,
200,
202,
203,
206,
210,
212,
214,
216,
219,
223,
224,
225,
226,
227,
228,
229,
230,
233,
234,
239,
240,
243,
244,
247,
252,
253,
254,
255,
256,
258,
259,
261,
262,
265,
266,
267,
268,
269,
270,
271,
272,
273,
275,
276,
277,
278,
282,
286,
291,
293,
294,
296,
299,
300,
301,
303,
305,
311,
314,
315,
316,
317,
319,
320,
323,
325,
330,
334,
335,
336,
338,
339,
341,
344,
345,
348,
349,
350,
352,
354,
356,
358,
359,
360,
361,
362,
364,
367,
368,
370,
371,
373,
374,
375,
376,
380,
382,
383,
384,
385,
391,
392,
393,
394,
395,
396,
398,
399,
401,
402,
403,
405,
406,
408,
409,
410,
411,
412,
413,
414,
416,
417,
418,
419,
420,
421,
423,
424,
425,
426,
427,
428,
433,
436,
437,
438,
439,
440,
443,
444,
445,
446,
447,
448,
451,
452,
453,
454,
455,
458,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
473,
475,
476,
477,
478,
480,
481,
482,
484,
485,
487,
488,
489,
490,
492,
493,
494,
496,
497,
498,
500,
503,
504,
505,
507,
509,
510,
512,
514,
515,
516,
517,
519,
520,
522,
524,
526,
528,
529,
530,
531,
532,
533,
535,
536,
537,
538,
539,
541,
542,
543,
544,
545,
547,
548,
550,
551,
552,
554,
557,
558,
559,
560,
561,
562,
563,
564,
566,
573,
580,
581,
582,
584,
585,
586,
588,
589,
591,
594,
595,
596,
597,
598,
599,
601,
603,
605,
606,
608,
610,
611,
612,
613,
615,
617,
618,
620,
622,
624,
625,
626,
627,
629,
630,
632,
633,
634,
637,
641,
643,
645,
646,
647,
648,
649,
651,
654,
656,
658,
659,
660,
661,
662,
663,
664,
665,
666,
667,
668,
669,
671,
673,
675,
677,
678,
679,
680,
681,
683,
684,
685,
686,
687,
688,
689,
690,
692,
693,
694,
695,
696,
697,
698,
699,
702,
703,
705,
707,
709,
712,
714,
715,
716,
718,
719,
721,
726,
727,
729,
730,
733,
734,
735,
736,
737,
739,
740,
741,
743,
746,
747,
748,
749,
750,
752,
753,
754,
756,
757,
758,
760,
762,
763,
765,
767,
768,
769,
770,
772,
773,
775,
776,
777,
778,
779,
780,
783,
785,
787,
788,
790,
793,
794,
795,
796,
797,
798,
799,
800,
802,
804,
805,
806,
807,
808,
810,
811,
812,
813,
814,
817,
818,
819,
820,
821,
824,
825,
826,
827,
829,
830,
831,
832,
835,
838,
839,
840,
841,
843,
844,
848,
849,
851,
853,
855,
857,
858,
859,
860,
861,
864,
865,
866,
867,
869,
870,
873,
874,
876,
877,
878,
879,
882,
886,
888,
890,
892,
893,
894,
895,
896,
897,
898,
899,
901,
902,
903,
905,
907,
909,
911,
912,
913,
915,
917,
918,
920,
922,
923,
924,
925,
926,
927,
928,
930,
931,
932,
934,
935,
941,
942,
943,
944,
945,
949,
950,
951,
953,
954,
955,
956,
958,
959,
960,
961,
963,
965,
968,
969,
972,
974,
975,
976,
977,
979,
980,
981,
983,
985,
986,
991,
993,
996,
998,
1000,
1001,
1005,
1006,
1008,
1009,
1010,
1011,
1013,
1014,
1015,
1017,
1018,
1019,
1020,
1022,
1023,
1027,
1030,
1031,
1037,
1039,
1042,
1043,
1044,
1046,
1047,
1050,
1051,
1052,
1053,
1055,
1057,
1058,
1059,
1061,
1062,
1063,
1064,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1074,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1084,
1086,
1087,
1090,
1092,
1093,
1094,
1096,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1111,
1112,
1113,
1115,
1117,
1119,
1121,
1123,
1124,
1126,
1127,
1128,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
What is the age of the oldest male user of the app?
|
oldest user refers to MAX(age); male refers to gender = 'M';
|
SELECT MAX(age) FROM gender_age WHERE 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 `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,102 | 1,102 |
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL
)
|
[
"SELECT",
"FROM",
"MAX"
] | 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
|
How many users installed the app but are not active?
|
installed refers to is_installed = 1; not active refers to is_active = 0;
|
SELECT COUNT(app_id) FROM app_events WHERE is_installed = 1 AND is_active = 0
|
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,103 | 1,103 |
CREATE TABLE `app_events`
(
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL, `app_id`
)
|
[
"COUNT",
"AND",
"SELECT",
"FROM"
] | 4 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
157,
160,
187,
188,
189,
244,
319,
382,
424,
445,
484,
515,
554,
595,
608,
611,
671,
675,
687,
737,
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,
9,
10,
11,
12,
13,
15,
16,
19,
20,
21,
22,
24,
25,
26,
27,
28,
30,
32,
33,
35,
36,
37,
38,
39,
40,
43,
44,
45,
47,
50,
51,
52,
53,
55,
56,
57,
61,
62,
63,
66,
67,
68,
69,
71,
73,
74,
75,
76,
77,
78,
79,
82,
85,
86,
87,
88,
89,
90,
91,
93,
95,
96,
98,
99,
100,
106,
108,
109,
111,
112,
113,
115,
116,
117,
118,
119,
121,
124,
125,
126,
127,
128,
129,
131,
138,
140,
141,
142,
143,
144,
146,
147,
148,
152,
154,
157,
158,
159,
160,
163,
164,
167,
168,
169,
170,
172,
173,
175,
176,
177,
179,
180,
182,
183,
184,
185,
187,
188,
189,
190,
191,
192,
196,
197,
198,
199,
200,
202,
203,
206,
210,
212,
214,
216,
219,
223,
224,
225,
226,
227,
229,
230,
233,
234,
239,
240,
243,
244,
247,
252,
254,
255,
256,
258,
259,
261,
262,
265,
266,
267,
268,
269,
270,
271,
272,
273,
275,
276,
277,
278,
282,
286,
291,
293,
294,
296,
299,
301,
303,
305,
311,
314,
315,
316,
317,
319,
320,
323,
325,
330,
334,
335,
336,
338,
339,
341,
344,
345,
348,
349,
350,
352,
354,
356,
358,
359,
360,
361,
362,
364,
367,
368,
370,
371,
373,
374,
375,
376,
380,
382,
383,
384,
385,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
408,
409,
410,
411,
412,
413,
414,
416,
417,
418,
419,
420,
421,
423,
424,
425,
426,
427,
428,
433,
436,
437,
438,
439,
440,
443,
444,
445,
446,
447,
448,
451,
452,
453,
454,
455,
458,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
473,
475,
476,
477,
478,
480,
481,
482,
484,
485,
487,
488,
490,
492,
493,
494,
496,
497,
498,
500,
504,
505,
507,
509,
510,
512,
514,
515,
516,
517,
519,
520,
522,
524,
526,
528,
529,
530,
531,
532,
533,
535,
536,
537,
538,
539,
541,
542,
543,
544,
545,
547,
548,
551,
552,
554,
557,
558,
559,
560,
561,
562,
563,
564,
566,
573,
580,
581,
582,
584,
585,
586,
588,
589,
591,
594,
595,
596,
597,
598,
599,
601,
603,
605,
606,
608,
610,
611,
612,
613,
615,
618,
620,
622,
624,
625,
626,
627,
629,
630,
632,
633,
634,
637,
641,
643,
645,
646,
648,
649,
651,
654,
656,
658,
659,
661,
662,
663,
664,
665,
666,
667,
668,
669,
671,
673,
675,
677,
678,
679,
680,
681,
683,
684,
685,
686,
687,
688,
689,
690,
692,
693,
694,
696,
697,
698,
699,
702,
703,
705,
707,
712,
714,
715,
716,
718,
719,
721,
726,
727,
730,
733,
734,
735,
736,
737,
739,
740,
741,
743,
746,
747,
748,
749,
750,
752,
753,
754,
756,
757,
758,
760,
762,
763,
765,
767,
768,
769,
770,
772,
773,
775,
776,
777,
778,
779,
780,
783,
785,
787,
788,
790,
793,
794,
795,
796,
797,
798,
799,
800,
802,
804,
806,
807,
808,
810,
811,
812,
813,
814,
817,
818,
819,
820,
821,
824,
825,
827,
829,
830,
831,
832,
835,
838,
839,
840,
841,
843,
844,
848,
849,
851,
853,
855,
857,
858,
859,
860,
861,
864,
865,
866,
867,
869,
870,
873,
874,
876,
877,
878,
879,
886,
888,
890,
892,
893,
894,
895,
896,
897,
898,
899,
901,
902,
903,
905,
907,
909,
911,
912,
913,
915,
917,
918,
920,
922,
923,
924,
926,
927,
928,
930,
931,
932,
934,
935,
941,
942,
943,
944,
945,
949,
950,
951,
953,
954,
956,
958,
960,
961,
963,
965,
968,
969,
972,
974,
975,
976,
977,
981,
983,
985,
986,
991,
993,
996,
998,
1000,
1001,
1005,
1006,
1008,
1009,
1010,
1011,
1013,
1014,
1015,
1017,
1018,
1019,
1020,
1022,
1023,
1027,
1030,
1031,
1037,
1039,
1042,
1043,
1044,
1046,
1047,
1050,
1051,
1053,
1055,
1057,
1058,
1059,
1061,
1062,
1063,
1064,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1084,
1086,
1087,
1090,
1092,
1094,
1096,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1112,
1113,
1115,
1117,
1119,
1121,
1123,
1124,
1126,
1127,
1128,
1131,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
What is the age of the youngest female user of the app?
|
youngest user refers to MIN(age); female refers to gender = 'F';
|
SELECT MIN(age) FROM gender_age WHERE gender = 'F'
|
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,104 | 1,104 |
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL
)
|
[
"MIN",
"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
|
How many models does the VIVO phone brand released?
|
models refers to device_model;
|
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE phone_brand = 'vivo'
|
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,105 | 1,105 |
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
|
List at least 15 phone models released under the OPPO brand.
|
phone models refers to device_model; OPPO brand refers to phone_brand = 'OPPO';
|
SELECT device_model FROM phone_brand_device_model2 WHERE phone_brand = 'OPPO' LIMIT 15
|
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,106 | 1,106 |
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
|
List at least 10 device models that male users over the age of 39 usually use.
|
male refers to gender = 'M'; over the age of 39 refers to group = 'M39+';
|
SELECT T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T2.`group` = 'M39+' AND T2.gender = 'M' LIMIT 10
|
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,107 | 1,107 |
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",
"LIMIT",
"INNER JOIN",
"ON",
"FROM"
] | 8 |
simple
|
{
"case_1": [
88,
160,
515,
555,
608,
671,
687,
849
],
"case_2": [
88,
160,
188,
319,
445,
515,
555,
595,
608,
671,
687,
849
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
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,
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,
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,
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,
286,
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,
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,
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,
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,
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,
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,
1004,
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,
1075,
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
|
List 5 device models that users use to install the app and are active in using the app.
|
install refers to is_installed = 1; active refers to is_active = 1;
|
SELECT T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN events AS T2 ON T1.device_id = T2.event_id INNER JOIN app_events AS T3 ON T2.event_id = T3.event_id WHERE T3.is_active = 1 AND T3.is_installed = 1 LIMIT 5
|
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 `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,108 | 1,108 |
CREATE TABLE `app_events`
(
CREATE TABLE `app_events`
`event_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY `event_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,
`device_id` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`
)
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",
"LIMIT",
"INNER JOIN",
"ON",
"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,
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,
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,
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,
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,
286,
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,
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,
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,
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,
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,
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,
1004,
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,
1075,
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 users belong to "Financial Information" 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 = 'Financial Information'
|
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,109 | 1,109 |
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
|
How many users belong to "game-Art Style" 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 = 'game-Art Style'
|
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,110 | 1,110 |
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"
] | 8 |
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,
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,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
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,
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,
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,
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,
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,
661,
662,
663,
665,
666,
667,
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,
737,
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,
770,
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,
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,
1057,
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
|
Provide the total number of the male users that use OPPO as their phone brand.
|
male refers to gender = 'Male';
|
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.phone_brand = 'OPPO' 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,111 | 1,111 |
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
|
What is the brand of the youngest user's device?
|
brand of the device refers to phone_brand; youngest user refers to MIN(age);
|
SELECT device_model FROM phone_brand_device_model2 WHERE device_id IN ( SELECT device_id FROM gender_age WHERE age = ( SELECT MIN(age) FROM 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` (
`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,112 | 1,112 |
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`
)
|
[
"MIN",
"IN",
"SELECT",
"FROM"
] | 8 |
simple
|
{
"case_1": [
306,
555,
1026
],
"case_2": [
306,
555,
1026
],
"case_3": [
306,
555,
1026
],
"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": [
7,
22,
72,
106,
109,
119,
140,
166,
200,
207,
219,
270,
306,
341,
355,
393,
399,
404,
410,
446,
514,
555,
588,
630,
635,
644,
663,
767,
817,
851,
872,
874,
903,
921,
948,
1026,
1040,
1085,
1108,
1116
]
}
|
talkingdata
|
List at least 3 categories with the lowest number of users.
|
lowest number of users refers to MIN(COUNT(label_id));
|
SELECT T1.category FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id ORDER BY T2.label_id LIMIT 3
|
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,113 | 1,113 |
CREATE TABLE `app_labels`
(
`label_id` INTEGER NOT NULL,
FOREIGN KEY `label_id` REFERENCES `label_categories` `label_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",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"FROM"
] | 8 |
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,
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,
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,
178,
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,
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,
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,
713,
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,
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,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
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,
989,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1024,
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,
1075,
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
]
}
|
talkingdata
|
How many male users use the Galaxy Ace Plus model?
|
male refers to gender = 'M'; Galaxy Ace Plus refers to device_model = 'Galaxy Ace Plus';
|
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 Ace Plus' 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,114 | 1,114 |
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
|
What is the age group of most OPPO users?
|
age group refers to group; most OPPO users refers to MAX(COUNT(phone_brand = 'OPPO')); OPPO users refers to phone_brand = 'OPPO';
|
SELECT T.`group` FROM ( SELECT T1.`group`, COUNT(T1.`group`) AS num FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'OPPO' 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,115 | 1,115 |
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"
] | 15 |
medium
|
{
"case_1": [
188
],
"case_2": [
88,
160,
188,
319,
445,
515,
595,
608,
671,
687,
849
],
"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
|
List at least 5 device models that are commonly used by female users.
|
device models that are commonly used refers to MAX(COUNT(device_model)); female refers to gender = 'F';
|
SELECT T.device_model FROM ( SELECT T2.device_model, COUNT(T2.device_model) AS num FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'F' GROUP BY T2.device_model ) AS T ORDER BY T.num DESC LIMIT 5
|
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,116 | 1,116 |
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"
] | 15 |
medium
|
{
"case_1": [
188
],
"case_2": [
88,
160,
188,
319,
445,
515,
595,
608,
671,
687,
849
],
"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
|
Calculate the ratio in percentage between the average number of app users belonging to "80s Japanese comic" and "90s Japanese comic".
|
ratio in percentage = DIVIDE(SUM(IF(category = '80s Japanese comic',1,0)), COUNT(app_id)) as '80s'; DIVIDE(SUM(IF(category = '90s Japanese comic',1,0)), COUNT(app_id)) as '90s'; 80s Japanese comic refers to category = '80s Japanese comic'; 90s Japanese comic refers to category = '80s Japanese comic';
|
SELECT SUM(IIF(T1.category = '80s Japanese comic', 1, 0)) / COUNT(T1.label_id) AS J8 , SUM(IIF(T1.category = '90s Japanese comic', 1, 0)) / COUNT(T1.label_id) AS J9 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,117 | 1,117 |
CREATE TABLE `app_labels`
(
`label_id` INTEGER NOT NULL,
FOREIGN KEY `label_id` REFERENCES `label_categories` `label_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"
] | 12 |
medium
|
{
"case_1": [
611
],
"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
|
Among the female users that uses OPPO as their phone brand, what is the percentage of them of the user that uses R815T model to install the app?
|
female refers to gender = 'F'; percentage = DIVIDE(SUM(IF(phone_brand = 'OPPO',1,0)), SUM(IF(device_id = 'R815T',1,0))); R815T refers to device_id = 'R815T';
|
SELECT SUM(IIF(T1.phone_brand = 'OPPO', 1, 0)) / SUM(IIF(T1.device_id = 'R815T', 1, 0)) AS num FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T2.gender = 'F'
|
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,118 | 1,118 |
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
|
What is the phone brand of the device model "坚果手机"?
|
SELECT phone_brand FROM phone_brand_device_model2 WHERE device_model = '坚果手机'
|
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,119 | 1,119 |
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`
)
|
[
"SELECT",
"FROM"
] | 2 |
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
|
Give the number of device models for "中兴" phone brand.
|
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE device_model = '中兴'
|
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,120 | 1,120 |
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
|
Which group does age 24 belong to?
|
SELECT `group` FROM gender_age WHERE age = '24'
|
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,121 | 1,121 |
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
)
|
[
"SELECT",
"FROM"
] | 2 |
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
|
Give the time stamp for event No.887711.
|
event no. refers to event_id; event_id = '887711';
|
SELECT timestamp FROM events WHERE event_id = '887711'
|
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,122 | 1,122 |
CREATE TABLE `events`
(
CREATE TABLE `events`
`event_id` INTEGER NOT NULL,
PRIMARY KEY `event_id`
)
|
[
"SELECT",
"FROM"
] | 2 |
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
|
Provide the number of events that happened on 2016/5/6.
|
on 2016/5/6 refers to timestamp = '2016/5/6 XX:XX:XX';
|
SELECT COUNT(event_id) FROM events WHERE SUBSTR(`timestamp`, 1, 10) = '2016-05-06'
|
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,123 | 1,123 |
CREATE TABLE `events`
(
CREATE TABLE `events`
`event_id` INTEGER NOT NULL,
`timestamp` DATETIME DEFAULT NULL,
PRIMARY KEY `event_id`
)
|
[
"SELECT",
"-",
"SUBSTR",
"COUNT",
"FROM"
] | 6 |
simple
|
{
"case_1": [
554
],
"case_2": [
554
],
"case_3": [
88,
143,
157,
160,
187,
188,
189,
228,
244,
253,
319,
382,
424,
445,
484,
515,
554,
595,
608,
611,
671,
675,
687,
737,
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,
3,
4,
6,
9,
11,
13,
15,
16,
21,
22,
25,
27,
28,
30,
32,
34,
35,
36,
37,
39,
40,
42,
43,
45,
47,
50,
51,
53,
54,
55,
61,
62,
63,
67,
68,
69,
73,
74,
75,
77,
78,
79,
82,
85,
86,
87,
88,
89,
91,
93,
96,
97,
98,
105,
106,
108,
109,
112,
113,
115,
117,
118,
119,
121,
122,
124,
125,
126,
128,
131,
135,
140,
141,
142,
143,
146,
147,
148,
152,
154,
157,
158,
159,
160,
164,
167,
169,
170,
172,
173,
175,
179,
180,
182,
183,
184,
185,
187,
188,
189,
190,
191,
192,
196,
197,
198,
199,
202,
203,
206,
210,
212,
214,
216,
219,
224,
225,
226,
227,
228,
229,
230,
233,
234,
237,
240,
243,
244,
247,
252,
253,
254,
256,
259,
261,
267,
268,
269,
271,
272,
273,
276,
277,
286,
291,
293,
294,
296,
299,
300,
301,
303,
311,
314,
316,
317,
319,
320,
323,
325,
330,
334,
335,
336,
338,
339,
341,
344,
345,
348,
349,
352,
354,
356,
358,
359,
360,
362,
364,
368,
370,
371,
373,
374,
375,
380,
382,
383,
384,
391,
392,
393,
394,
396,
399,
401,
403,
406,
409,
410,
411,
412,
416,
417,
418,
420,
421,
423,
424,
425,
426,
436,
443,
444,
445,
446,
447,
448,
451,
453,
454,
458,
460,
462,
464,
465,
466,
467,
469,
471,
473,
476,
477,
478,
481,
484,
485,
487,
488,
489,
490,
493,
496,
498,
500,
503,
504,
505,
507,
509,
510,
512,
514,
515,
516,
517,
519,
520,
522,
526,
529,
531,
532,
535,
536,
537,
538,
542,
543,
544,
545,
547,
548,
550,
552,
554,
558,
559,
560,
562,
563,
564,
566,
573,
580,
581,
582,
585,
591,
594,
595,
596,
597,
598,
601,
603,
606,
608,
611,
613,
617,
618,
620,
624,
627,
629,
630,
632,
633,
634,
641,
643,
645,
646,
647,
649,
654,
656,
658,
659,
660,
661,
662,
663,
664,
665,
667,
668,
669,
671,
673,
675,
677,
679,
680,
681,
684,
687,
688,
689,
692,
693,
694,
695,
696,
698,
703,
705,
707,
709,
712,
714,
718,
719,
721,
727,
729,
730,
733,
734,
735,
736,
737,
739,
740,
743,
746,
748,
749,
750,
752,
753,
754,
756,
757,
758,
760,
762,
768,
769,
770,
772,
777,
778,
779,
785,
787,
788,
790,
795,
796,
797,
798,
799,
800,
802,
804,
805,
811,
812,
813,
814,
817,
818,
819,
820,
821,
824,
826,
827,
829,
830,
831,
835,
838,
839,
841,
843,
849,
851,
853,
857,
858,
864,
865,
866,
867,
869,
870,
874,
876,
877,
878,
882,
886,
888,
890,
893,
894,
896,
897,
898,
899,
901,
902,
903,
905,
909,
911,
912,
913,
915,
917,
918,
922,
923,
924,
925,
926,
927,
930,
934,
935,
941,
942,
943,
945,
950,
951,
954,
955,
956,
958,
959,
960,
961,
963,
965,
968,
969,
972,
974,
975,
976,
977,
979,
980,
981,
983,
985,
986,
993,
996,
1005,
1006,
1008,
1010,
1011,
1013,
1014,
1015,
1020,
1022,
1023,
1030,
1031,
1037,
1042,
1043,
1047,
1050,
1051,
1052,
1053,
1055,
1057,
1058,
1059,
1062,
1064,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1076,
1077,
1078,
1079,
1082,
1084,
1086,
1087,
1090,
1092,
1093,
1094,
1096,
1097,
1100,
1101,
1103,
1104,
1106,
1111,
1112,
1113,
1119,
1121,
1123,
1124,
1126,
1127,
1128,
1131,
1132,
1133,
1134,
1135,
1137
]
}
|
talkingdata
|
For the event which happened at 23:55:16 on 2016/5/7, in the location coordinate(113, 28), on what device did it happen? Give the name of the device model.
|
at 23:55:16 on 2016/5/7 refers to timestamp = '2016/5/7 23:55:16'; location coordinate (113, 28) refers to longitude = '113' AND latitude = '28';
|
SELECT T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN events AS T2 ON T1.device_id = T2.event_id WHERE T2.longitude = '113' AND T2.latitude = '28' AND T2.timestamp = '2016-05-07 23:55:16'
|
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 `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,124 | 1,124 |
CREATE TABLE `events`
(
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 `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"
] | 10 |
simple
|
{
"case_1": [
260
],
"case_2": [
260,
675
],
"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
|
Give the number of "game-Fishing" apps.
|
game-Fishing refers to category = 'game-Fishing';
|
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 = 'game-Fishing'
|
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,125 | 1,125 |
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"
] | 8 |
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,
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,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
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,
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,
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,
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,
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,
661,
662,
663,
665,
666,
667,
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,
737,
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,
770,
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,
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,
1057,
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
|
State the number of the "魅蓝Note 2" users who are in the "F29-32" group.
|
魅蓝Note 2 refers to device_model = '魅蓝Note 2';
|
SELECT COUNT(T2.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.`group` = 'F29-32' AND T2.device_model = '魅蓝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,126 | 1,126 |
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",
"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,
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,
32,
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,
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,
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,
667,
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,
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
|
Give the number of 30-year-old users who were active in the events on 2016/5/2.
|
30-year-old refers to age = '30'; active refers to is_active = 1; on 2016/5/2 refers to timestamp = '2016/5/2 XX:XX:XX';
|
SELECT COUNT(T3.device_id) FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id INNER JOIN gender_age AS T3 ON T2.device_id = T3.device_id WHERE SUBSTR(`timestamp`, 1, 10) = '2016-05-02' AND T1.is_active = 1 AND T3.age = '30'
|
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 `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,127 | 1,127 |
CREATE TABLE `app_events`
(
CREATE TABLE `app_events`
`event_id` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY `event_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,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
PRIMARY KEY `event_id`
)
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",
"SUBSTR",
"COUNT",
"FROM"
] | 15 |
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,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
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,
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,
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,
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,
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,
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,
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
|
For the event which happened at 23:33:34 on 2016/5/6, how many installed apps were involved?
|
at 23:33:34 on 2016/5/6 refers to timestamp = '2016/5/6 23:33:34'; installed refers to is_installed = '1';
|
SELECT COUNT(T1.event_id) FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id WHERE SUBSTR(T2.`timestamp`, 1, 10) = '2016-05-06' AND T1.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 `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,128 | 1,128 |
CREATE TABLE `app_events`
(
CREATE TABLE `app_events`
`event_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
PRIMARY KEY `event_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`
)
|
[
"AS",
"AND",
"SELECT",
"-",
"INNER JOIN",
"ON",
"SUBSTR",
"COUNT",
"FROM"
] | 11 |
medium
|
{
"case_1": [
228,
244
],
"case_2": [
228,
244
],
"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,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
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,
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,
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,
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,
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,
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,
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
|
Give the number of female users of "E派" brand devices.
|
female refers to gender = 'F'; E派 brand refers to phone_brand = 'E派';
|
SELECT COUNT(T2.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'F' AND T2.phone_brand = 'E派'
|
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,129 | 1,129 |
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
|
How many male users of the "Galaxy S5" device model?
|
male refers to gender = 'M';
|
SELECT COUNT(T1.device_id) FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T1.device_model = 'Galaxy S5' AND T2.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,130 | 1,130 |
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
|
How many users from the group "F29-32" who were active in the events on 2016/5/7?
|
active users refers to is_active = '1'; on 2016/5/7 refers to timestamp = '2016/5/7 XX:XX:XX';
|
SELECT COUNT(T1.app_id) FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id INNER JOIN gender_age AS T3 ON T2.event_id = T3.device_id WHERE SUBSTR(T2.`timestamp`, 1, 10) = '2016-05-07' AND T1.is_active = '1' AND T3.`group` = 'F29-32'
|
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 `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,131 | 1,131 |
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,
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL,
PRIMARY KEY `event_id`
)
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",
"SUBSTR",
"COUNT",
"FROM"
] | 16 |
challenging
|
{
"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,
11,
12,
14,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
29,
30,
32,
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,
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,
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,
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,
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,
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,
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 category does the app id No.894384172610331000 belong to?
|
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 = '894384172610331000'
|
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,132 | 1,132 |
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
|
For the event which happened at 14:09:49 on 2016/5/6, in the location coordinate(116, 40), how many apps were active?
|
at 14:09:49 on 2016/5/6 refers to timestamp = '2016/5/6 14:09:49'; location coordinate(116, 40) refers to longitude = '116' AND latitude = '40'; active refers to is_active = '1';
|
SELECT COUNT(T1.app_id) FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id WHERE T2.timestamp = '2016-05-06 14:09:49' AND T1.is_active = '1' AND T2.longitude = '116' AND T2.latitude = '40'
|
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,133 | 1,133 |
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,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY `event_id`
)
|
[
"AS",
"AND",
"SELECT",
"-",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 12 |
medium
|
{
"case_1": [
228,
244
],
"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,
32,
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,
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,
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,
667,
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,
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
|
How many times is the number of active apps in the event that happened at 7:50:28 on 2016/5/2 than in the event that happened at 7:41:03 on 2016/5/2?
|
how many times = DIVIDE(SUM(IF(timestamp = '2016/5/2 7:50:28', 1,0)), SUM(IF(timestamp = '2016/5/2 7:41:03',1,0))); active refers to is_active = '1'; at 7:50:28 on 2016/5/2 refers to timestamp = '2016/5/2 7:50:28'; at 7:41:03 on 2016/5/2 refers to timestamp = '2016/5/2 7:41:03';
|
SELECT SUM(IIF(timestamp = '2016-05-02 7:50:28', 1, 0)) / SUM(IIF(timestamp = '2016-05-02 7:41:03', 1, 0)) AS num FROM events AS T1 INNER JOIN app_events AS T2 ON T1.event_id = T2.event_id WHERE T2.is_active = '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 `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,134 | 1,134 |
CREATE TABLE `app_events`
(
CREATE TABLE `app_events`
`event_id` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY `event_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,
PRIMARY KEY `event_id`
)
|
[
"AS",
"SELECT",
"SUM",
"-",
"INNER JOIN",
"ON",
"FROM"
] | 13 |
medium
|
{
"case_1": [
228,
244
],
"case_2": [
228,
244
],
"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,
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,
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,
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,
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,
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,
979,
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,
1093,
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 devices are of the brand vivo?
|
brand vivo refers to phone_brand = 'vivo';
|
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE phone_brand = 'vivo'
|
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,135 | 1,135 |
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
|
How many more devices are there of the brand vivo than of the brand LG?
|
how many more = SUBTRACT(SUM(IF(phone_brand = 'vivo',1,0)), SUM(IF(phone_brand = 'LG',1,0))); brand vivo refers to phone_brand = 'vivo'; brand LG refers to phone_brand = 'LG';
|
SELECT SUM(IIF(phone_brand = 'vivo', 1, 0)) - SUM(IIF(phone_brand = 'LG', 1, 0)) AS num FROM 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`)
)
|
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,136 | 1,136 |
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`
)
|
[
"AS",
"SUM",
"SELECT",
"FROM"
] | 5 |
simple
|
{
"case_1": [
506
],
"case_2": [
506
],
"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,
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,
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,
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,
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,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
245,
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,
285,
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,
350,
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,
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,
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,
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,
929,
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,
978,
979,
980,
981,
982,
985,
986,
987,
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,
1093,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1110,
1111,
1112,
1113,
1114,
1115,
1116,
1118,
1119,
1121,
1122,
1123,
1124,
1128,
1129,
1130,
1131,
1132,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
What is the ID of the device used by the youngest user?
|
ID of the device refers to device_id; youngest user refers to MIN(age);
|
SELECT device_id FROM gender_age WHERE age = ( SELECT MIN(age) FROM 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 `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,137 | 1,137 |
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
)
|
[
"MIN",
"SELECT",
"FROM"
] | 5 |
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
|
Among the female users of the devices, how many of them are over 30?
|
female refers to gender = 'F'; over 30 refers to age > 30;
|
SELECT COUNT(device_id) FROM gender_age WHERE age > 30 AND gender = 'F'
|
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,138 | 1,138 |
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
)
|
[
"COUNT",
"AND",
"SELECT",
"FROM"
] | 4 |
simple
|
{
"case_1": [
-1
],
"case_2": [
-1
],
"case_3": [
88,
143,
157,
160,
187,
188,
189,
244,
319,
382,
424,
445,
484,
515,
554,
595,
608,
611,
671,
675,
687,
737,
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,
9,
10,
11,
12,
13,
15,
16,
19,
20,
21,
22,
24,
25,
26,
27,
28,
30,
32,
33,
35,
36,
37,
38,
39,
40,
43,
44,
45,
47,
50,
51,
52,
53,
55,
56,
57,
61,
62,
63,
66,
67,
68,
69,
71,
73,
74,
75,
76,
77,
78,
79,
82,
85,
86,
87,
88,
89,
90,
91,
93,
95,
96,
98,
99,
100,
106,
108,
109,
111,
112,
113,
115,
116,
117,
118,
119,
121,
124,
125,
126,
127,
128,
129,
131,
138,
140,
141,
142,
143,
144,
146,
147,
148,
152,
154,
157,
158,
159,
160,
163,
164,
167,
168,
169,
170,
172,
173,
175,
176,
177,
179,
180,
182,
183,
184,
185,
187,
188,
189,
190,
191,
192,
196,
197,
198,
199,
200,
202,
203,
206,
210,
212,
214,
216,
219,
223,
224,
225,
226,
227,
229,
230,
233,
234,
239,
240,
243,
244,
247,
252,
254,
255,
256,
258,
259,
261,
262,
265,
266,
267,
268,
269,
270,
271,
272,
273,
275,
276,
277,
278,
282,
286,
291,
293,
294,
296,
299,
301,
303,
305,
311,
314,
315,
316,
317,
319,
320,
323,
325,
330,
334,
335,
336,
338,
339,
341,
344,
345,
348,
349,
350,
352,
354,
356,
358,
359,
360,
361,
362,
364,
367,
368,
370,
371,
373,
374,
375,
376,
380,
382,
383,
384,
385,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
408,
409,
410,
411,
412,
413,
414,
416,
417,
418,
419,
420,
421,
423,
424,
425,
426,
427,
428,
433,
436,
437,
438,
439,
440,
443,
444,
445,
446,
447,
448,
451,
452,
453,
454,
455,
458,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
473,
475,
476,
477,
478,
480,
481,
482,
484,
485,
487,
488,
490,
492,
493,
494,
496,
497,
498,
500,
504,
505,
507,
509,
510,
512,
514,
515,
516,
517,
519,
520,
522,
524,
526,
528,
529,
530,
531,
532,
533,
535,
536,
537,
538,
539,
541,
542,
543,
544,
545,
547,
548,
551,
552,
554,
557,
558,
559,
560,
561,
562,
563,
564,
566,
573,
580,
581,
582,
584,
585,
586,
588,
589,
591,
594,
595,
596,
597,
598,
599,
601,
603,
605,
606,
608,
610,
611,
612,
613,
615,
618,
620,
622,
624,
625,
626,
627,
629,
630,
632,
633,
634,
637,
641,
643,
645,
646,
648,
649,
651,
654,
656,
658,
659,
661,
662,
663,
664,
665,
666,
667,
668,
669,
671,
673,
675,
677,
678,
679,
680,
681,
683,
684,
685,
686,
687,
688,
689,
690,
692,
693,
694,
696,
697,
698,
699,
702,
703,
705,
707,
712,
714,
715,
716,
718,
719,
721,
726,
727,
730,
733,
734,
735,
736,
737,
739,
740,
741,
743,
746,
747,
748,
749,
750,
752,
753,
754,
756,
757,
758,
760,
762,
763,
765,
767,
768,
769,
770,
772,
773,
775,
776,
777,
778,
779,
780,
783,
785,
787,
788,
790,
793,
794,
795,
796,
797,
798,
799,
800,
802,
804,
806,
807,
808,
810,
811,
812,
813,
814,
817,
818,
819,
820,
821,
824,
825,
827,
829,
830,
831,
832,
835,
838,
839,
840,
841,
843,
844,
848,
849,
851,
853,
855,
857,
858,
859,
860,
861,
864,
865,
866,
867,
869,
870,
873,
874,
876,
877,
878,
879,
886,
888,
890,
892,
893,
894,
895,
896,
897,
898,
899,
901,
902,
903,
905,
907,
909,
911,
912,
913,
915,
917,
918,
920,
922,
923,
924,
926,
927,
928,
930,
931,
932,
934,
935,
941,
942,
943,
944,
945,
949,
950,
951,
953,
954,
956,
958,
960,
961,
963,
965,
968,
969,
972,
974,
975,
976,
977,
981,
983,
985,
986,
991,
993,
996,
998,
1000,
1001,
1005,
1006,
1008,
1009,
1010,
1011,
1013,
1014,
1015,
1017,
1018,
1019,
1020,
1022,
1023,
1027,
1030,
1031,
1037,
1039,
1042,
1043,
1044,
1046,
1047,
1050,
1051,
1053,
1055,
1057,
1058,
1059,
1061,
1062,
1063,
1064,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1084,
1086,
1087,
1090,
1092,
1094,
1096,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1112,
1113,
1115,
1117,
1119,
1121,
1123,
1124,
1126,
1127,
1128,
1131,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
Is the oldest device user male or female?
|
MAX(Age) AND gender = 'M' means that the oldest device user is male; MAX(Age) AND gender = 'F' means that the oldest device user is female;
|
SELECT gender FROM gender_age WHERE age = ( SELECT MAX(age) FROM 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 `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,139 | 1,139 |
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL
)
|
[
"SELECT",
"FROM",
"MAX"
] | 5 |
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
|
What is the age of the youngest female device user?
|
youngest refers to MIN(age); female refers to gender = 'F';
|
SELECT MIN(age) FROM gender_age WHERE gender = 'F'
|
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,140 | 1,140 |
CREATE TABLE `gender_age`
(
CREATE TABLE `gender_age`
`device_id` INTEGER NOT NULL,
`gender` TEXT DEFAULT NULL,
`age` INTEGER DEFAULT NULL
)
|
[
"MIN",
"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
|
Among all the users who use a vivo device, what is the age of the youngest user?
|
vivo device refers to phone_brand = 'vivo'; youngest refers to MIN(age);
|
SELECT T1.age 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' ORDER BY T1.age 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,141 | 1,141 |
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",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"FROM"
] | 8 |
simple
|
{
"case_1": [
88,
160,
515,
555,
608,
671,
687,
849
],
"case_2": [
88,
160,
188,
319,
445,
515,
555,
595,
608,
671,
687,
849
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
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,
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,
178,
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,
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,
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,
713,
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,
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,
929,
930,
931,
932,
934,
935,
936,
937,
938,
940,
941,
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,
989,
991,
993,
994,
996,
997,
999,
1000,
1001,
1003,
1004,
1005,
1006,
1010,
1011,
1012,
1013,
1015,
1016,
1017,
1019,
1022,
1023,
1024,
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,
1075,
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
]
}
|
talkingdata
|
Please list the app IDs of all the users in the Securities category.
|
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 = 'Securities'
|
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,142 | 1,142 |
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
|
For the device with an event occurring on 2016/5/1 at 0:55:25, what is the gender of its user?
|
on 2016/5/1 at 0:55:25 refers to timestamp = '2016-05-01 00:55:25';
|
SELECT T1.gender FROM gender_age AS T1 INNER JOIN events AS T2 ON T1.device_id = T2.device_id WHERE T2.timestamp = '2016-05-01 00:55:25'
|
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 `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,143 | 1,143 |
CREATE TABLE `events`
(
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL
)
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",
"-",
"INNER JOIN",
"ON",
"FROM"
] | 8 |
simple
|
{
"case_1": [
424
],
"case_2": [
382,
424,
1067
],
"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
|
Among the devices with an event occurring in 2016, how many of them are owned by a user in the M23-26 user group?
|
in 2016 refers to year(timestamp) = 2016; M23-26 user group refers to `group` = 'M23-26';
|
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN events AS T2 ON T1.device_id = T2.device_id WHERE STRFTIME('%Y', T2.timestamp) = '2016' AND T1.`group` = 'M23-26'
|
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 `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,144 | 1,144 |
CREATE TABLE `events`
(
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL
)
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",
"STRFTIME",
"COUNT",
"FROM"
] | 10 |
simple
|
{
"case_1": [
424
],
"case_2": [
382,
424,
1067
],
"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,
32,
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,
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,
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,
667,
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,
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,
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
|
What is the brand of the device used by the most users in the M23-26 user group?
|
brand of the device refers to phone_brand; M23-26 user group refers to `group` = 'M23-26';
|
SELECT T.phone_brand FROM ( SELECT T2.phone_brand, 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 T1.`group` = 'M23-26' 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,145 | 1,145 |
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
|
Please list the location coordinates of all the Galaxy Note 2 devices when an event happened.
|
location coordinates = longitude, latitude; Galaxy Note 2 refers to device_model = 'Galaxy Note 2';
|
SELECT T1.longitude, T1.latitude FROM events 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 `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 `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,146 | 1,146 |
CREATE TABLE `events`
(
`device_id` INTEGER DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL
)
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"
] | 6 |
simple
|
{
"case_1": [
260
],
"case_2": [
260,
675
],
"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 list all the models of the devices used by a female user.
|
models of the devices refers to device_model; female refers to gender = 'F';
|
SELECT T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T2.gender = 'F'
|
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,147 | 1,147 |
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",
"INNER JOIN",
"ON",
"FROM"
] | 6 |
simple
|
{
"case_1": [
88,
160,
515,
555,
608,
671,
687,
849
],
"case_2": [
88,
160,
188,
319,
445,
515,
555,
595,
608,
671,
687,
849
],
"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
|
What are the categories that app user ID7324884708820020000 belongs to?
|
app user ID refers to app_id; app_id = 7324884708820020000;
|
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 = 7324884708820020000
|
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,148 | 1,148 |
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
|
Among the app users who were not active when event no.2 happened, how many of them belong to the category Property Industry 1.0?
|
not active refers to is_active = 0; event no. refers to event_id; event_id = 2;
|
SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id INNER JOIN app_events AS T3 ON T2.app_id = T3.app_id WHERE T3.is_active = 0 AND T1.category = 'Property Industry 1.0' AND T3.event_id = 2
|
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_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,149 | 1,149 |
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 `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",
"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 categories in total do the app users who were not active when event no.2 happened belong to?
|
not active refers to is_active = 0; event no. refers to event_id; event_id = 2;
|
SELECT COUNT(*) FROM ( SELECT COUNT(DISTINCT T1.category) AS result FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id INNER JOIN app_events AS T3 ON T2.app_id = T3.app_id WHERE T3.event_id = 2 AND T3.is_active = 0 GROUP BY T1.category ) T
|
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_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,150 | 1,150 |
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 `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`
)
|
[
"GROUP BY",
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 16 |
challenging
|
{
"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,
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
|
What is the device model used by the most female users over 30?
|
female users refers to gender = 'F'; most female users refers to MAX(COUNT(gender = 'F')); over 30 refers to age > 30;
|
SELECT T.device_model FROM ( SELECT T2.device_model, COUNT(T2.device_model) 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 > 30 AND T1.gender = 'F' GROUP BY T2.device_model ) 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,151 | 1,151 |
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",
"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,
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
|
Please list the models of all the devices with an event under the location coordinates (121, 31).
|
models of the devices refers to device_model; location coordinates (121, 31) refers to longitude = 121 AND latitude = 31;
|
SELECT T2.device_model FROM events AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.longitude = 121 AND T1.latitude = 31
|
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 `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,152 | 1,152 |
CREATE TABLE `events`
(
`device_id` INTEGER DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL
)
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": [
260
],
"case_2": [
260,
675
],
"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 top 3 categories with the most app users?
|
most app users refers to MAX(COUNT(app_id));
|
SELECT T.category FROM ( SELECT T2.category, COUNT(T1.app_id) AS num FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id GROUP BY T2.category ) AS T ORDER BY T.num DESC LIMIT 3
|
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,153 | 1,153 |
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`
)
|
[
"GROUP BY",
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"COUNT",
"FROM"
] | 15 |
medium
|
{
"case_1": [
611
],
"case_2": [
484,
611,
839
],
"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
|
Please list the event IDs of the events that have happened on the device of the oldest user.
|
oldest user refers to MAX(age);
|
SELECT T2.event_id FROM gender_age AS T1 INNER JOIN events AS T2 ON T1.device_id = T2.device_id ORDER BY T1.age DESC LIMIT 1
|
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 `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,154 | 1,154 |
CREATE TABLE `events`
(
CREATE TABLE `events`
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`
)
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",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"FROM"
] | 9 |
simple
|
{
"case_1": [
424
],
"case_2": [
382,
424,
1067
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
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,
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
]
}
|
talkingdata
|
How many events have happened on the device of the youngest female user?
|
youngest refers to MIN(age); female refers to gender = 'F';
|
SELECT COUNT(T1.event_id) FROM events AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T2.gender = 'F' GROUP BY T1.event_id, T2.age ORDER BY T2.age LIMIT 1
|
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 `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,155 | 1,155 |
CREATE TABLE `events`
(
CREATE TABLE `events`
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`
)
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",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 10 |
simple
|
{
"case_1": [
424
],
"case_2": [
382,
424,
1067
],
"case_3": [
88,
143,
160,
187,
188,
189,
228,
244,
260,
319,
357,
382,
424,
445,
484,
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,
3,
4,
5,
6,
7,
8,
10,
11,
12,
13,
14,
15,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
28,
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,
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,
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,
185,
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,
252,
254,
256,
257,
258,
260,
261,
262,
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,
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,
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,
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,
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,
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,
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,
710,
711,
712,
714,
715,
717,
719,
720,
721,
722,
723,
724,
725,
726,
727,
728,
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,
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,
869,
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,
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,
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,
1011,
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,
1070,
1071,
1072,
1074,
1076,
1077,
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
|
Among the devices on which an event happened on 2016/5/1, how many of them are used by a male user?
|
on 2016/5/1 refers to timestamp = '2016-05-01'; male refers to gender = 'M';
|
SELECT COUNT(T1.device_id) FROM events AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T1.timestamp = '2016-05-01' AND T2.gender = 'M'
|
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 `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,156 | 1,156 |
CREATE TABLE `events`
(
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL
)
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"
] | 10 |
simple
|
{
"case_1": [
424
],
"case_2": [
382,
424,
1067
],
"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,
32,
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,
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,
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,
667,
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,
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 category has more app users, Securities or Finance?
|
more app users refers to SUBTRACT(IF(SUM(category = 'Securities'), SUM(category = 'Finance')) > 0,'Securities','Finance') as more;
|
SELECT IIF(SUM(IIF(T2.category = 'Securities', 1, 0)) - SUM(IIF(T2.category = 'Finance', 1, 0)) > 0, 'Securities', 'Finance') AS diff FROM app_labels AS T1 INNER JOIN label_categories 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,157 | 1,157 |
CREATE TABLE `app_labels`
(
`label_id` INTEGER NOT NULL,
FOREIGN KEY `label_id` REFERENCES `label_categories` `label_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",
"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,
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
|
Please list the device models of all the devices used by a user in the M23-26 user group.
|
M23-26 user group refers to `group` = 'M23-26';
|
SELECT T2.device_model FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.`group` = 'M23-26'
|
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,158 | 1,158 |
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",
"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,
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
|
What is the average age of the female users who uses a vivo device?
|
average age = AVG(age); female refers to gender = 'F'; vivo device refers to phone_brand = 'vivo';
|
SELECT AVG(T1.age) 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' AND T1.gender = 'F'
|
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,159 | 1,159 |
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",
"AVG",
"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,
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
|
What is the ratio of female users to male users who uses a vivo device?
|
ratio = DIVIDE(SUM(gender = 'M' WHERE phone_brand = 'vivo'), SUM(gender = 'F' WHERE phone_brand = 'vivo')); female refers to gender = 'F'; male refers to gender = 'M'; vivo device refers to phone_brand = 'vivo';
|
SELECT SUM(IIF(T1.gender = 'M', 1, 0)) / SUM(IIF(T1.gender = 'F', 1, 0)) 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,160 | 1,160 |
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
|
What is the ratio of the number of app users that belong to the Securities category to the number of app users that belong to the Finance category?
|
ratio = DIVIDE(SUM(category = 'Securities'), SUM(category = 'Finance'));
|
SELECT SUM(IIF(T2.category = 'Securities', 1, 0)) / SUM(IIF(T2.category = 'Finance', 1, 0)) AS per FROM app_labels AS T1 INNER JOIN label_categories 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,161 | 1,161 |
CREATE TABLE `app_labels`
(
`label_id` INTEGER NOT NULL,
FOREIGN KEY `label_id` REFERENCES `label_categories` `label_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",
"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,
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
|
What is the label ID of "Third-party card management" category?
|
SELECT label_id FROM label_categories WHERE category = 'Third-party card management'
|
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,162 | 1,162 |
CREATE TABLE `label_categories`
(
CREATE TABLE `label_categories`
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY `label_id`
)
|
[
"-",
"SELECT",
"FROM"
] | 3 |
simple
|
{
"case_1": [
253,
737
],
"case_2": [
253,
737
],
"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 ratio of active and inactive app users of the event ID "58"?
|
ratio = DIVIDE(SUM(is_active = 1), SUM(is_active = 0)); active refers to is_active = 1; inactive refers to is_active = 0;
|
SELECT SUM(IIF(is_active = 1, 1, 0)) / SUM(IIF(is_active = 0, 1, 0)) AS per FROM app_events WHERE event_id = 58
|
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,163 | 1,163 |
CREATE TABLE `app_events`
(
CREATE TABLE `app_events`
`event_id` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY `event_id`,
FOREIGN KEY `event_id` REFERENCES `events` `event_id` ON DELETE CASCADE ON UPDATE CASCADE
)
|
[
"AS",
"SUM",
"SELECT",
"FROM"
] | 5 |
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,
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,
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,
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,
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,
232,
233,
234,
235,
236,
239,
240,
241,
242,
243,
244,
245,
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,
285,
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,
350,
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,
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,
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,
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,
929,
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,
978,
979,
980,
981,
982,
985,
986,
987,
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,
1093,
1094,
1095,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1110,
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 events did the device ID "3915082290673130000" join?
|
SELECT COUNT(event_id) FROM events WHERE device_id = 3915082290673130000
|
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,164 | 1,164 |
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
|
Calculate the percentage of male users among all device users.
|
percentage = DVIDE(SUM(gender = 'M'), COUNT(device_id)); male refers to gender = 'M';
|
SELECT SUM(IIF(gender = 'M', 1, 0)) / COUNT(device_id) AS per FROM 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 `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,165 | 1,165 |
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",
"COUNT",
"FROM"
] | 5 |
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,
54,
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,
122,
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,
205,
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,
245,
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,
350,
352,
353,
354,
356,
357,
358,
359,
360,
361,
363,
364,
365,
367,
368,
369,
370,
371,
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,
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,
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,
709,
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,
872,
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,
939,
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,
979,
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,
1093,
1094,
1095,
1096,
1098,
1099,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1110,
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 were participated by the users at longitude of "-156"?
|
SELECT COUNT(event_id) FROM events WHERE longitude = -156
|
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,166 | 1,166 |
CREATE TABLE `events`
(
CREATE TABLE `events`
`event_id` INTEGER NOT NULL,
`longitude` REAL 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 app users belong to label ID of "48"?
|
SELECT COUNT(app_id) FROM app_labels WHERE label_id = 48
|
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,167 | 1,167 |
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
|
How many category names start with the word "game"?
|
category names refers to category; start with the word game refers to category like 'game%';
|
SELECT COUNT(label_id) FROM label_categories WHERE category LIKE 'game%'
|
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,168 | 1,168 |
CREATE TABLE `label_categories`
(
CREATE TABLE `label_categories`
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY `label_id`
)
|
[
"COUNT",
"LIKE",
"SELECT",
"FROM"
] | 4 |
simple
|
{
"case_1": [
737
],
"case_2": [
737
],
"case_3": [
88,
143,
157,
160,
187,
188,
189,
244,
319,
382,
424,
445,
484,
515,
554,
595,
608,
611,
671,
675,
687,
737,
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,
3,
4,
6,
9,
11,
13,
15,
16,
20,
22,
25,
26,
27,
28,
30,
32,
35,
36,
37,
38,
40,
47,
51,
53,
55,
57,
59,
61,
62,
63,
67,
68,
69,
73,
74,
75,
77,
78,
81,
82,
86,
87,
88,
89,
90,
91,
93,
96,
98,
106,
108,
109,
113,
114,
115,
117,
118,
119,
121,
124,
125,
126,
127,
131,
136,
140,
142,
143,
146,
147,
148,
152,
157,
159,
160,
164,
167,
168,
169,
170,
173,
175,
179,
182,
183,
184,
185,
187,
188,
189,
190,
191,
192,
196,
197,
198,
199,
202,
203,
204,
206,
210,
212,
214,
216,
224,
225,
226,
227,
229,
230,
233,
234,
240,
243,
244,
247,
252,
254,
256,
258,
259,
261,
263,
264,
267,
268,
269,
271,
273,
276,
277,
286,
291,
293,
294,
299,
301,
303,
311,
314,
315,
316,
317,
319,
320,
323,
325,
330,
334,
335,
336,
338,
339,
341,
344,
345,
348,
349,
352,
354,
356,
358,
359,
360,
364,
370,
371,
373,
374,
375,
377,
380,
382,
383,
384,
391,
392,
394,
397,
399,
401,
402,
403,
406,
407,
409,
410,
411,
412,
415,
416,
417,
420,
421,
423,
424,
426,
430,
433,
436,
438,
443,
444,
445,
447,
448,
452,
453,
454,
458,
460,
462,
464,
465,
466,
467,
469,
471,
473,
476,
477,
478,
481,
484,
485,
487,
488,
490,
493,
500,
504,
505,
509,
510,
512,
515,
516,
517,
519,
520,
525,
526,
531,
532,
535,
536,
537,
538,
542,
543,
544,
545,
546,
547,
548,
552,
554,
557,
558,
559,
560,
563,
564,
566,
573,
580,
581,
582,
585,
591,
594,
595,
596,
597,
598,
603,
606,
608,
611,
613,
618,
620,
624,
627,
629,
630,
632,
633,
634,
641,
645,
646,
649,
654,
656,
658,
659,
661,
662,
663,
664,
665,
666,
667,
668,
669,
671,
673,
675,
680,
681,
687,
688,
689,
692,
694,
696,
698,
703,
705,
707,
712,
714,
718,
719,
721,
727,
730,
733,
734,
735,
736,
737,
738,
739,
740,
743,
747,
748,
749,
750,
752,
753,
754,
756,
757,
760,
762,
768,
769,
770,
772,
774,
778,
779,
787,
790,
795,
796,
797,
798,
799,
800,
802,
804,
811,
812,
813,
814,
817,
818,
819,
820,
821,
824,
827,
828,
830,
831,
832,
838,
839,
841,
843,
844,
849,
850,
851,
853,
857,
858,
865,
866,
867,
869,
870,
874,
875,
876,
877,
879,
886,
888,
890,
893,
894,
896,
897,
898,
899,
901,
902,
903,
907,
909,
911,
912,
913,
915,
917,
918,
922,
923,
924,
926,
927,
930,
934,
935,
941,
942,
943,
944,
945,
948,
950,
951,
954,
956,
958,
960,
961,
963,
965,
968,
969,
972,
975,
976,
977,
979,
980,
981,
983,
985,
986,
993,
996,
1000,
1005,
1006,
1008,
1010,
1011,
1013,
1014,
1015,
1018,
1019,
1020,
1022,
1023,
1030,
1037,
1042,
1043,
1047,
1050,
1051,
1053,
1054,
1055,
1057,
1058,
1059,
1062,
1064,
1067,
1069,
1070,
1071,
1072,
1076,
1077,
1078,
1079,
1082,
1084,
1086,
1087,
1090,
1094,
1096,
1098,
1100,
1101,
1103,
1104,
1106,
1111,
1112,
1113,
1117,
1119,
1121,
1123,
1124,
1126,
1127,
1128,
1131,
1133,
1134,
1135,
1137
]
}
|
talkingdata
|
Provide the number of events participated by the device users at coordinates of (80,37).
|
coordinates of (80,37) refers to longitude = 80 and latitude = 37;
|
SELECT COUNT(event_id) FROM events WHERE longitude = 80 AND latitude = 37
|
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,169 | 1,169 |
CREATE TABLE `events`
(
CREATE TABLE `events`
`event_id` INTEGER NOT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY `event_id`
)
|
[
"COUNT",
"AND",
"SELECT",
"FROM"
] | 4 |
simple
|
{
"case_1": [
554
],
"case_2": [
554
],
"case_3": [
88,
143,
157,
160,
187,
188,
189,
244,
319,
382,
424,
445,
484,
515,
554,
595,
608,
611,
671,
675,
687,
737,
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,
9,
10,
11,
12,
13,
15,
16,
19,
20,
21,
22,
24,
25,
26,
27,
28,
30,
32,
33,
35,
36,
37,
38,
39,
40,
43,
44,
45,
47,
50,
51,
52,
53,
55,
56,
57,
61,
62,
63,
66,
67,
68,
69,
71,
73,
74,
75,
76,
77,
78,
79,
82,
85,
86,
87,
88,
89,
90,
91,
93,
95,
96,
98,
99,
100,
106,
108,
109,
111,
112,
113,
115,
116,
117,
118,
119,
121,
124,
125,
126,
127,
128,
129,
131,
138,
140,
141,
142,
143,
144,
146,
147,
148,
152,
154,
157,
158,
159,
160,
163,
164,
167,
168,
169,
170,
172,
173,
175,
176,
177,
179,
180,
182,
183,
184,
185,
187,
188,
189,
190,
191,
192,
196,
197,
198,
199,
200,
202,
203,
206,
210,
212,
214,
216,
219,
223,
224,
225,
226,
227,
229,
230,
233,
234,
239,
240,
243,
244,
247,
252,
254,
255,
256,
258,
259,
261,
262,
265,
266,
267,
268,
269,
270,
271,
272,
273,
275,
276,
277,
278,
282,
286,
291,
293,
294,
296,
299,
301,
303,
305,
311,
314,
315,
316,
317,
319,
320,
323,
325,
330,
334,
335,
336,
338,
339,
341,
344,
345,
348,
349,
350,
352,
354,
356,
358,
359,
360,
361,
362,
364,
367,
368,
370,
371,
373,
374,
375,
376,
380,
382,
383,
384,
385,
391,
392,
393,
394,
395,
398,
399,
401,
402,
403,
405,
406,
408,
409,
410,
411,
412,
413,
414,
416,
417,
418,
419,
420,
421,
423,
424,
425,
426,
427,
428,
433,
436,
437,
438,
439,
440,
443,
444,
445,
446,
447,
448,
451,
452,
453,
454,
455,
458,
460,
462,
463,
464,
465,
466,
467,
469,
470,
471,
473,
475,
476,
477,
478,
480,
481,
482,
484,
485,
487,
488,
490,
492,
493,
494,
496,
497,
498,
500,
504,
505,
507,
509,
510,
512,
514,
515,
516,
517,
519,
520,
522,
524,
526,
528,
529,
530,
531,
532,
533,
535,
536,
537,
538,
539,
541,
542,
543,
544,
545,
547,
548,
551,
552,
554,
557,
558,
559,
560,
561,
562,
563,
564,
566,
573,
580,
581,
582,
584,
585,
586,
588,
589,
591,
594,
595,
596,
597,
598,
599,
601,
603,
605,
606,
608,
610,
611,
612,
613,
615,
618,
620,
622,
624,
625,
626,
627,
629,
630,
632,
633,
634,
637,
641,
643,
645,
646,
648,
649,
651,
654,
656,
658,
659,
661,
662,
663,
664,
665,
666,
667,
668,
669,
671,
673,
675,
677,
678,
679,
680,
681,
683,
684,
685,
686,
687,
688,
689,
690,
692,
693,
694,
696,
697,
698,
699,
702,
703,
705,
707,
712,
714,
715,
716,
718,
719,
721,
726,
727,
730,
733,
734,
735,
736,
737,
739,
740,
741,
743,
746,
747,
748,
749,
750,
752,
753,
754,
756,
757,
758,
760,
762,
763,
765,
767,
768,
769,
770,
772,
773,
775,
776,
777,
778,
779,
780,
783,
785,
787,
788,
790,
793,
794,
795,
796,
797,
798,
799,
800,
802,
804,
806,
807,
808,
810,
811,
812,
813,
814,
817,
818,
819,
820,
821,
824,
825,
827,
829,
830,
831,
832,
835,
838,
839,
840,
841,
843,
844,
848,
849,
851,
853,
855,
857,
858,
859,
860,
861,
864,
865,
866,
867,
869,
870,
873,
874,
876,
877,
878,
879,
886,
888,
890,
892,
893,
894,
895,
896,
897,
898,
899,
901,
902,
903,
905,
907,
909,
911,
912,
913,
915,
917,
918,
920,
922,
923,
924,
926,
927,
928,
930,
931,
932,
934,
935,
941,
942,
943,
944,
945,
949,
950,
951,
953,
954,
956,
958,
960,
961,
963,
965,
968,
969,
972,
974,
975,
976,
977,
981,
983,
985,
986,
991,
993,
996,
998,
1000,
1001,
1005,
1006,
1008,
1009,
1010,
1011,
1013,
1014,
1015,
1017,
1018,
1019,
1020,
1022,
1023,
1027,
1030,
1031,
1037,
1039,
1042,
1043,
1044,
1046,
1047,
1050,
1051,
1053,
1055,
1057,
1058,
1059,
1061,
1062,
1063,
1064,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1076,
1077,
1078,
1079,
1080,
1081,
1082,
1084,
1086,
1087,
1090,
1092,
1094,
1096,
1100,
1101,
1103,
1104,
1105,
1106,
1109,
1112,
1113,
1115,
1117,
1119,
1121,
1123,
1124,
1126,
1127,
1128,
1131,
1133,
1134,
1135,
1136,
1137
]
}
|
talkingdata
|
List down the labels' IDs and categories of the app ID "5758400314709850000".
|
SELECT T1.label_id, T2.category FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id WHERE T1.app_id = 5758400314709850000
|
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,170 | 1,170 |
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
|
List down the app IDs under the category of game-Rowing .
|
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-Rowing'
|
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,171 | 1,171 |
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
|
What are the label IDs and app IDs of the Chinese Classical Mythology category?
|
SELECT T1.label_id, T2.app_id FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T1.category = 'Chinese Classical Mythology'
|
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,172 | 1,172 |
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
|
Describe the number of app IDs and location of the event ID "79641".
|
location = longitude, latitude;
|
SELECT COUNT(T1.app_id), T2.longitude, T2.latitude FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id WHERE T1.event_id = 79641 GROUP BY T2.longitude, T2.latitude
|
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,173 | 1,173 |
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`
(
CREATE TABLE `events`
`event_id` INTEGER NOT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY `event_id`
)
|
[
"GROUP BY",
"AS",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 8 |
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,
13,
14,
15,
16,
18,
19,
20,
21,
22,
23,
24,
26,
27,
28,
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,
78,
80,
81,
82,
83,
84,
85,
86,
87,
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,
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,
182,
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,
252,
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,
348,
349,
352,
353,
354,
356,
357,
358,
359,
360,
361,
363,
364,
365,
368,
369,
370,
371,
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,
481,
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,
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,
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,
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,
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,
866,
867,
868,
869,
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,
972,
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,
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,
1069,
1070,
1071,
1072,
1074,
1076,
1077,
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
|
Provide the locations and times of the events of app ID "8715964299802120000".
|
locations = longitude, latitude; times of the events refers to timestamp;
|
SELECT T1.longitude, T1.latitude, T1.timestamp FROM events AS T1 INNER JOIN app_events AS T2 ON T1.event_id = T2.event_id WHERE T2.app_id = 8715964299802120000
|
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,174 | 1,174 |
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`
(
CREATE TABLE `events`
`event_id` INTEGER NOT NULL,
`timestamp` DATETIME DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
PRIMARY KEY `event_id`
)
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 6 |
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,
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 OPPO users participated in events which were held around 12 AM on 1st May,2016?
|
OPPO refers to phone_brand = 'OPPO'; around 12 AM on 1st May, 2016 refers to timestamp is '2016-05-01'
|
SELECT COUNT(T1.device_id) FROM events AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'OPPO' AND STRFTIME('%Y-%m-%d', T1.`timestamp`) = '2016-05-01'
|
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 `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,175 | 1,175 |
CREATE TABLE `events`
(
`device_id` INTEGER DEFAULT NULL,
`timestamp` DATETIME DEFAULT NULL
)
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",
"STRFTIME",
"COUNT",
"FROM"
] | 11 |
medium
|
{
"case_1": [
675
],
"case_2": [
260,
675
],
"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,
32,
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,
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,
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,
667,
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,
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,
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
|
What is the ratio of male and female users of vivo X5pro model?
|
ratio = DIVIDE(SUM(gender = 'M' WHERE device_model = 'X5Pro'), SUM(gender = 'F' WHERE device_model = 'X5Pro')); male refers to gender = 'M'; female refers to gender = 'F'; vivo X5pro model refers to phone_brand = 'vivo' AND device_model = 'X5Pro';
|
SELECT SUM(IIF(T1.gender = 'M', 1, 0)) / SUM(IIF(T1.gender = 'F', 1, 0)) 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' AND T2.device_model = 'X5Pro'
|
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,176 | 1,176 |
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",
"SUM",
"INNER JOIN",
"ON",
"FROM"
] | 10 |
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,
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,
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,
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,
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,
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,
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,
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
|
How many females use ZUK Z1 phones in the age group under 23?
|
females refers to gender = 'F'; ZUK Z1 refers to phone_brand = 'ZUK' AND device_model = 'Z1'; under 23 refers to `group` = 'F23-' ;
|
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.gender = 'F' AND T2.device_model = 'Z1' AND T1.`group` = 'F23-' AND T2.phone_brand = 'ZUK'
|
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,177 | 1,177 |
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",
"COUNT",
"FROM"
] | 10 |
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 the phone brands and models of the users under 10 years of age.
|
models refers to device_model; under 10 years of age refers to age < 10;
|
SELECT T2.phone_brand, T2.device_model FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.age < 10
|
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,178 | 1,178 |
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",
"INNER JOIN",
"ON",
"FROM"
] | 6 |
simple
|
{
"case_1": [
88,
160,
515,
555,
608,
671,
687,
849
],
"case_2": [
88,
160,
188,
319,
445,
515,
555,
595,
608,
671,
687,
849
],
"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
|
Among the HTC users, calculate the percentage of female users who are over 80.
|
HTC refers to phone_brand = 'HTC'; percentage = DIVIDE(SUM(gender = 'F' AND age > 80), COUNT(device_id)); female refers to gender = 'F'; over 80 refers to age > 80
|
SELECT SUM(IIF(T1.gender = 'F' AND T1.age > 80, 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 = '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,179 | 1,179 |
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",
"SUM",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 10 |
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,
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,
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,
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,
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,
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
|
Which phone brand and model was used for event ID "6701"?
|
model refers to device_model;
|
SELECT T2.phone_brand, T2.device_model FROM events AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.event_id = 6701
|
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 `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,180 | 1,180 |
CREATE TABLE `events`
(
CREATE TABLE `events`
`event_id` INTEGER NOT NULL,
`device_id` INTEGER DEFAULT NULL,
PRIMARY KEY `event_id`
)
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"
] | 6 |
simple
|
{
"case_1": [
260
],
"case_2": [
260,
675
],
"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
|
Between device ID of "-9215352913819630000" and "-9222956879900150000", mention the age and gender of device user who participated more events.
|
more events refers to MAX(COUNT(event_id));
|
SELECT T.age, T.gender FROM ( SELECT T2.age, T2.gender, COUNT(T1.device_id) AS num FROM events AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T1.device_id BETWEEN -9215352913819630000 AND -9222956879900150000 GROUP BY T2.age, T2.gender ) AS T ORDER BY T.num DESC LIMIT 1
|
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 `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,181 | 1,181 |
CREATE TABLE `events`
(
`device_id` INTEGER DEFAULT NULL
)
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"
] | 17 |
challenging
|
{
"case_1": [
1067
],
"case_2": [
382,
424,
1067
],
"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
|
List out the time of the event id 12.
|
time refers to timestamp;
|
SELECT timestamp FROM events WHERE event_id = 12
|
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,182 | 1,182 |
CREATE TABLE `events`
(
CREATE TABLE `events`
`event_id` INTEGER NOT NULL,
PRIMARY KEY `event_id`
)
|
[
"SELECT",
"FROM"
] | 2 |
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 active users are there in the event?
|
active refers to is_active = 1;
|
SELECT COUNT(app_id) FROM app_events WHERE is_active = 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,183 | 1,183 |
CREATE TABLE `app_events`
(
`app_id` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL, `app_id`
)
|
[
"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
|
How many devices belong to model "A51"?
|
model refers to device_model; device_model = 'A51';
|
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE device_model = 'A51'
|
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,184 | 1,184 |
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
|
State the gender of users who use the device "-9222956879900150000".
|
device refers to device_id; device_id = -9222956879900150000;
|
SELECT gender FROM gender_age WHERE device_id = -9222956879900150000
|
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,185 | 1,185 |
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
)
|
[
"SELECT",
"FROM"
] | 2 |
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
|
How many labels belong to the game-card category?
|
labels refers to label_id;
|
SELECT COUNT(label_id) FROM label_categories WHERE category = 'game-card'
|
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,186 | 1,186 |
CREATE TABLE `label_categories`
(
CREATE TABLE `label_categories`
`label_id` INTEGER NOT NULL,
`category` TEXT DEFAULT NULL,
PRIMARY KEY `label_id`
)
|
[
"COUNT",
"-",
"SELECT",
"FROM"
] | 4 |
simple
|
{
"case_1": [
253,
737
],
"case_2": [
253,
737
],
"case_3": [
88,
143,
157,
160,
187,
188,
189,
228,
244,
253,
319,
382,
424,
445,
484,
515,
554,
595,
608,
611,
671,
675,
687,
737,
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,
3,
4,
6,
9,
11,
13,
15,
16,
21,
22,
25,
27,
28,
30,
32,
34,
35,
36,
37,
39,
40,
42,
43,
45,
47,
51,
53,
55,
61,
62,
63,
67,
68,
69,
73,
74,
75,
77,
78,
79,
82,
85,
86,
87,
88,
89,
91,
93,
96,
97,
98,
105,
106,
108,
109,
112,
113,
115,
117,
118,
119,
121,
124,
125,
126,
128,
131,
135,
140,
141,
142,
143,
146,
147,
148,
152,
154,
157,
158,
159,
160,
164,
167,
169,
170,
172,
173,
175,
179,
180,
182,
183,
184,
185,
187,
188,
189,
190,
191,
192,
196,
197,
198,
199,
202,
203,
206,
210,
212,
214,
216,
224,
225,
226,
227,
228,
229,
230,
233,
234,
240,
243,
244,
247,
252,
253,
254,
256,
259,
261,
267,
268,
269,
271,
272,
273,
276,
277,
286,
291,
293,
294,
296,
299,
300,
301,
303,
311,
314,
316,
317,
319,
320,
323,
325,
330,
334,
335,
336,
338,
339,
341,
344,
345,
348,
349,
352,
354,
356,
358,
359,
360,
362,
364,
368,
370,
371,
373,
374,
375,
380,
382,
383,
384,
391,
392,
393,
394,
396,
399,
401,
403,
406,
409,
410,
411,
412,
416,
417,
420,
421,
423,
424,
425,
426,
436,
443,
444,
445,
446,
447,
448,
453,
454,
458,
460,
462,
464,
465,
466,
467,
469,
471,
473,
476,
477,
478,
481,
484,
485,
487,
488,
489,
490,
493,
496,
498,
500,
503,
504,
505,
507,
509,
510,
512,
514,
515,
516,
517,
519,
520,
522,
526,
529,
531,
532,
535,
536,
537,
538,
542,
543,
544,
545,
547,
548,
550,
552,
554,
558,
559,
560,
562,
563,
564,
566,
573,
580,
581,
582,
585,
591,
594,
595,
596,
597,
598,
601,
603,
606,
608,
611,
613,
617,
618,
620,
624,
627,
629,
630,
632,
633,
634,
641,
643,
645,
646,
647,
649,
654,
656,
658,
659,
660,
661,
662,
663,
664,
665,
667,
668,
669,
671,
673,
675,
677,
679,
680,
681,
684,
687,
688,
689,
692,
693,
694,
695,
696,
698,
703,
705,
707,
709,
712,
714,
718,
719,
721,
727,
729,
730,
733,
734,
735,
736,
737,
739,
740,
743,
746,
748,
749,
750,
752,
753,
754,
756,
757,
758,
760,
762,
768,
769,
770,
772,
777,
778,
779,
785,
787,
788,
790,
795,
796,
797,
798,
799,
800,
802,
804,
805,
811,
812,
813,
814,
817,
818,
819,
820,
821,
824,
826,
827,
829,
830,
831,
835,
838,
839,
841,
843,
849,
851,
853,
857,
858,
864,
865,
866,
867,
869,
870,
874,
876,
877,
878,
882,
886,
888,
890,
893,
894,
896,
897,
898,
899,
901,
902,
903,
905,
909,
911,
912,
913,
915,
917,
918,
922,
923,
924,
925,
926,
927,
930,
934,
935,
941,
942,
943,
945,
950,
951,
954,
955,
956,
958,
959,
960,
961,
963,
965,
968,
969,
972,
974,
975,
976,
977,
979,
980,
981,
983,
985,
986,
993,
996,
1005,
1006,
1008,
1010,
1011,
1013,
1014,
1015,
1020,
1022,
1023,
1030,
1031,
1037,
1042,
1043,
1047,
1050,
1051,
1052,
1053,
1055,
1057,
1058,
1059,
1062,
1064,
1067,
1068,
1069,
1070,
1071,
1072,
1074,
1076,
1077,
1078,
1079,
1082,
1084,
1086,
1087,
1090,
1092,
1093,
1094,
1096,
1100,
1101,
1103,
1104,
1106,
1111,
1112,
1113,
1119,
1121,
1123,
1124,
1126,
1127,
1128,
1131,
1132,
1133,
1134,
1135,
1137
]
}
|
talkingdata
|
What is the age group of users who use phone brand of vivo?
|
age group refers to group;
|
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 = '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,187 | 1,187 |
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",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 6 |
simple
|
{
"case_1": [
88,
160,
515,
555,
608,
671,
687,
849
],
"case_2": [
88,
160,
188,
319,
445,
515,
555,
595,
608,
671,
687,
849
],
"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 who are under 30 years old use device model of Galaxy Note 2?
|
under 30 refers to age < 30;
|
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 2' AND T1.age < 30
|
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,188 | 1,188 |
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
|
Among the users who use OPPO, calculate the percentage of those who are under 50 years old.
|
OPPO refers to phone_brand = 'OPPO'; percentage = MULTIPLY(DIVIDE(SUM(age < 50), COUNT(device_id)), 1.0); under 50 years old refers to age < 50;
|
SELECT SUM(IIF(T1.age < 50, 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 = 'OPPO'
|
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,189 | 1,189 |
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",
"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,
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 average age of the users who use model device of R7?
|
average age = AVG(age);
|
SELECT SUM(T1.age) / COUNT(T1.device_id) AS avg FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'R7'
|
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,190 | 1,190 |
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",
"avg",
"COUNT",
"FROM"
] | 10 |
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,
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,
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,
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,
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 category of the label that represented the behavior category of app id 5902120154267990000?
|
label that represented the behavior category refers to label_id;
|
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,191 | 1,191 |
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
|
Mention the group of age of users who use phone brand of LG.
|
group of age refers to group;
|
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'
|
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,192 | 1,192 |
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",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 6 |
simple
|
{
"case_1": [
88,
160,
515,
555,
608,
671,
687,
849
],
"case_2": [
88,
160,
188,
319,
445,
515,
555,
595,
608,
671,
687,
849
],
"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
|
State the category of the label that represented the behavior category of app id 4955831798976240000.
|
label that represented the behavior category refers to label_id;
|
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 = 4955831798976240000
|
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,193 | 1,193 |
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 female users use device model of MI 3?
|
female refers to gender = 'F';
|
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.gender = 'F' AND T2.device_model = 'MI 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 `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,194 | 1,194 |
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
|
Among the male users, how many users use device model of Desire 820?
|
male refers to gender = 'M';
|
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 = 'Desire 820' 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,195 | 1,195 |
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
|
Among the users who are above 20, how many users use device model of ELIFE E7 Mini?
|
above 20 refers to age > 20;
|
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 = 'ELIFE E7 Mini' AND T1.age > 20
|
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,196 | 1,196 |
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
|
State the number of users who are under 50 and above 20 use device model of Galaxy Premier.
|
under 50 and above 20 refers to age BTWEEEN 20 AND 50;
|
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 BETWEEN 20 AND 50 AND T2.device_model = 'Galaxy Premier'
|
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,197 | 1,197 |
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",
"BETWEEN",
"FROM"
] | 10 |
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,
32,
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,
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,
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,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
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,
656,
657,
658,
659,
660,
662,
663,
665,
666,
667,
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
]
}
|
talkingdata
|
Give the number of male users who use phone branded HTC.
|
male refers to gender = 'M';
|
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.gender = 'M' 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,198 | 1,198 |
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
|
How many users who are between 20 and 60 use phone brand of TCL?
|
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 BETWEEN 20 AND 60 AND T2.phone_brand = 'TCL'
|
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,199 | 1,199 |
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",
"BETWEEN",
"FROM"
] | 10 |
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,
32,
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,
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,
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,
399,
401,
402,
403,
405,
406,
407,
408,
409,
411,
412,
413,
414,
415,
416,
417,
419,
421,
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,
656,
657,
658,
659,
660,
662,
663,
665,
666,
667,
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
]
}
|
|
talkingdata
|
Among the users who use SUGAR, calculate the percentage of those who are above 20 years old.
|
SUGAR refers to phone_brand = 'SUGAR'; percentage = MULTIPLY(DIVIDE(SUM(age > 20), COUNT(device_id)) 1.0); above 20 years old refers to age > 20;
|
SELECT SUM(IIF(T1.age > 20, 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 = 'SUGAR'
|
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,200 | 1,200 |
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",
"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,
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
]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.