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
computer_student
What is the ratio of professors and students?
professors refers to professor = 1; students refers to student = 1; ratio = divide(count(person.p_id) when professor = 1, count(person.p_id) when student = 1)
SELECT CAST(SUM(CASE WHEN professor = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN student = 1 THEN 1 ELSE 0 END) AS per FROM person
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,001
1,001
CREATE TABLE `person` ( professor INTEGER, student INTEGER )
[ "AS", "SELECT", "SUM", "CASE", "CAST", "FROM" ]
9
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ -1 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "case_5": [ 0, 6, 10, 16, 24, 35, 39, 42, 54, 61, 64, 71, 77, 81, 83, 87, 93, 94, 104, 106, 112, 113, 119, 120, 122, 127, 129, 141, 148, 152, 153, 155, 158, 169, 171, 173, 184, 186, 189, 191, 192, 195, 201, 205, 207, 212, 213, 215, 219, 223, 225, 226, 228, 234, 236, 245, 248, 254, 258, 261, 263, 264, 267, 271, 278, 279, 298, 299, 300, 303, 304, 305, 313, 316, 317, 322, 323, 335, 347, 356, 360, 363, 365, 367, 375, 378, 379, 380, 381, 383, 393, 398, 402, 406, 409, 412, 415, 423, 427, 438, 443, 448, 450, 451, 452, 453, 458, 470, 476, 478, 479, 483, 485, 486, 487, 488, 500, 504, 506, 508, 510, 514, 517, 518, 527, 528, 535, 537, 540, 547, 550, 560, 563, 564, 571, 573, 575, 579, 580, 581, 597, 601, 609, 612, 620, 623, 628, 630, 638, 640, 646, 650, 658, 661, 662, 666, 672, 676, 682, 686, 690, 695, 701, 706, 709, 710, 717, 723, 740, 744, 745, 747, 750, 753, 762, 772, 776, 777, 787, 788, 795, 796, 798, 800, 802, 805, 808, 810, 813, 823, 825, 827, 832, 841, 844, 848, 868, 870, 871, 872, 874, 880, 894, 896, 898, 909, 912, 913, 922, 924, 926, 929, 939, 941, 943, 944, 958, 959, 962, 973, 978, 979, 985, 998, 1004, 1008, 1012, 1023, 1027, 1031, 1036, 1038, 1048, 1062, 1064, 1066, 1068, 1069, 1070, 1072, 1075, 1078, 1082, 1087, 1092, 1093, 1098, 1100, 1110, 1121, 1128, 1129, 1131, 1133, 1134, 1135 ] }
computer_student
Calculate the percentage of high-level undergraduate course.
high-level undergraduate course refers to courseLevel = 'Level_400'; percentage = divide(count(course.course_id) when courseLevel = 'Level_400', count(course.course_id)) * 100%
SELECT CAST(SUM(CASE WHEN courseLevel = 'Level_400' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) AS per FROM course
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,002
1,002
CREATE TABLE `course` ( courseLevel TEXT )
[ "AS", "SELECT", "SUM", "CASE", "CAST", "COUNT", "FROM" ]
8
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 11, 36, 462, 552, 866, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "case_5": [ 0, 1, 2, 4, 6, 10, 11, 16, 22, 24, 27, 30, 35, 36, 37, 39, 42, 47, 51, 53, 54, 55, 61, 62, 63, 64, 68, 69, 71, 73, 74, 75, 77, 81, 82, 83, 86, 87, 88, 89, 91, 93, 94, 96, 98, 104, 106, 112, 113, 115, 117, 118, 119, 120, 121, 122, 125, 126, 127, 129, 131, 140, 141, 142, 143, 146, 148, 152, 153, 155, 158, 159, 160, 164, 167, 169, 170, 171, 173, 175, 179, 183, 184, 186, 187, 188, 189, 190, 191, 192, 195, 196, 197, 199, 201, 202, 205, 206, 207, 212, 213, 214, 215, 219, 223, 225, 226, 227, 228, 229, 233, 234, 236, 243, 244, 245, 247, 248, 254, 256, 258, 261, 263, 264, 267, 268, 269, 271, 276, 277, 278, 279, 286, 298, 299, 300, 301, 303, 304, 305, 311, 313, 314, 316, 317, 319, 320, 322, 323, 325, 330, 334, 335, 336, 338, 339, 341, 344, 345, 347, 349, 354, 356, 358, 360, 363, 364, 365, 367, 370, 373, 374, 375, 378, 379, 380, 381, 382, 383, 384, 391, 392, 393, 394, 398, 401, 402, 403, 406, 409, 411, 412, 415, 416, 417, 423, 424, 426, 427, 436, 438, 443, 444, 445, 447, 448, 450, 451, 452, 453, 454, 458, 460, 462, 464, 465, 466, 467, 469, 470, 471, 473, 476, 477, 478, 479, 483, 484, 485, 486, 487, 488, 490, 493, 500, 504, 505, 506, 508, 509, 510, 514, 515, 516, 517, 518, 519, 520, 526, 527, 528, 532, 535, 536, 537, 538, 540, 542, 544, 547, 548, 550, 552, 558, 559, 560, 563, 564, 566, 571, 573, 575, 579, 580, 581, 582, 595, 596, 597, 601, 606, 608, 609, 611, 612, 613, 620, 623, 627, 628, 630, 632, 633, 634, 638, 640, 641, 645, 646, 649, 650, 654, 658, 659, 661, 662, 663, 665, 666, 668, 669, 671, 672, 676, 681, 682, 686, 687, 688, 690, 694, 695, 696, 701, 705, 706, 709, 710, 712, 714, 717, 721, 723, 727, 733, 734, 735, 736, 739, 740, 743, 744, 745, 747, 749, 750, 752, 753, 756, 760, 762, 768, 769, 772, 776, 777, 778, 779, 787, 788, 790, 795, 796, 797, 798, 799, 800, 802, 804, 805, 808, 810, 812, 813, 814, 818, 819, 823, 824, 825, 827, 830, 832, 838, 839, 841, 844, 848, 849, 851, 853, 857, 866, 867, 868, 870, 871, 872, 874, 876, 877, 880, 886, 888, 893, 894, 896, 897, 898, 901, 902, 909, 911, 912, 913, 915, 917, 918, 922, 923, 924, 926, 927, 929, 930, 934, 935, 939, 941, 943, 944, 950, 951, 954, 956, 958, 959, 961, 962, 963, 969, 973, 975, 977, 978, 979, 981, 985, 986, 993, 996, 998, 1004, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1022, 1023, 1027, 1031, 1036, 1037, 1038, 1042, 1043, 1047, 1048, 1050, 1051, 1058, 1062, 1064, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1075, 1078, 1082, 1084, 1086, 1087, 1092, 1093, 1094, 1098, 1100, 1101, 1103, 1104, 1106, 1110, 1112, 1113, 1119, 1121, 1123, 1124, 1128, 1129, 1131, 1133, 1134, 1135, 1137 ] }
computer_student
List down all the person IDs who taught course ID of 18.
person IDs refers to taughtBy.p_id; course ID of 18  refers to taughtBy.course_id = 18
SELECT p_id FROM taughtBy WHERE course_id = 18
CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,003
1,003
CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "SELECT", "FROM" ]
2
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
Provide the position status and IDs of professor who advised student ID "303".
position status refers to hasPosition; IDs of professor refers to p_id_dummy; student ID "303" refers to advisedBy.p_id = 303
SELECT T2.hasPosition, T1.p_id_dummy FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id_dummy = T2.p_id WHERE T1.p_id = 303
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,004
1,004
CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, hasPosition TEXT ) CREATE TABLE `advisedBy` ( CREATE TABLE "advisedBy" p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key p_id, p_id_dummy, constraint advisedBy_person_p_id_p_id_fk foreign key p_id, p_id_dummy references person p_id, p_id )
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{ "case_1": [ 910, 1043 ], "case_2": [ 866, 910, 977, 1043 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
List the person IDs and course levels of the affiliated professors in faculty.
person IDs refers to person.p_id; affiliated professors in faculty refers to professor = 1 and hasPosition = 'Faculty_aff'
SELECT T1.p_id, T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_aff'
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,005
1,005
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, hasPosition TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{ "case_1": [ 58 ], "case_2": [ 11, 58, 552 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
Describe the year in program and in phase status for the student with most number in advisor.
student refers to advisedBy.p_id; most number in advisor refers to max(count(p_id_dummy))
SELECT T2.yearsInProgram, T2.inPhase FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,006
1,006
CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE `advisedBy` ( CREATE TABLE "advisedBy" p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key p_id, p_id_dummy, constraint advisedBy_person_p_id_p_id_fk foreign key p_id, p_id_dummy references person p_id, p_id )
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
11
medium
{ "case_1": [ 866, 977 ], "case_2": [ 866, 977, 1043 ], "case_3": [ 11, 36, 462, 552, 664, 866, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
List down the advised student IDs and IDs of employing professor in faculty.
advised student IDs refers to person.p_id; IDs of employing professor in faculty refers to p_id_dummy and hasPosition = 'Faculty_eme'
SELECT T1.p_id, T2.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id_dummy = T2.p_id WHERE hasPosition = 'Faculty_eme'
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,007
1,007
CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, hasPosition TEXT ) CREATE TABLE `advisedBy` ( CREATE TABLE "advisedBy" p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key p_id, p_id_dummy, constraint advisedBy_person_p_id_p_id_fk foreign key p_id, p_id_dummy references person p_id, p_id )
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{ "case_1": [ 910, 1043 ], "case_2": [ 866, 910, 977, 1043 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
List the course IDs and levels of person IDs from 40 to 50.
course IDs and levels refers to course.course_id and courseLevel; person IDs from 40 to 50 refers to taughtBy.p_id between 40 and 50
SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id BETWEEN 40 AND 50
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,008
1,008
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "BETWEEN", "FROM" ]
8
simple
{ "case_1": [ 711 ], "case_2": [ 36, 462, 711, 1005 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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, 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, 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, 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, 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, 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, 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 ] }
computer_student
Describe the course level and list of person IDs who taught course ID of 147.
person IDs refers to taughtBy.p_id; course ID of 147 refers to course.course_id = 147
SELECT T1.courseLevel, T1.course_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 141
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,009
1,009
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{ "case_1": [ 711 ], "case_2": [ 36, 462, 711, 1005 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
Mention the person ID of faculty professor who taught course ID 104 and the course level.
person ID refers to person.p_id; faculty professor refers to professor = 1 and hasPosition ! = 0
SELECT T1.p_id, T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.course_id = 104 AND T1.hasPosition <> 0
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,010
1,010
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, hasPosition TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
10
simple
{ "case_1": [ 58 ], "case_2": [ 11, 58, 552 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
Find the professor ID and position in faculty who taught high-level undergraduate course of less than 10 in ID.
professor ID refers to person.p_id when professor = 1; position in faculty refers to hasPosition; high-level undergraduate course refers to courseLevel = 'Level_400'; less than 10 in ID refers to course.course_id < 10
SELECT T1.p_id, T1.hasPosition FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T3.courseLevel = 'Level_400' AND T2.course_id < 10
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,011
1,011
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, hasPosition TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
10
simple
{ "case_1": [ 58 ], "case_2": [ 11, 58, 552 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
List the professor ID who taught the course ID from 121 to 130 of basic undergraduate courses.
professor ID refers to taughtBy.p_id; course ID from 121 to 130 of basic undergraduate courses refers to courseLevel = 'Level_300' and course.course_id between 121 and 130
SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_300' AND T1.course_id > 121 AND T1.course_id < 130
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,012
1,012
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
8
simple
{ "case_1": [ 711 ], "case_2": [ 36, 462, 711, 1005 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
List the advisor IDs for students with eighth year of program and position status in faculty of those professors.
advisor IDs refers to p_id_dummy and person.p_id where professor = 1; eighth year of program refers to yearsInprogram = 'Year_8'; position status in faculty of those professors refers to hasPosition
SELECT T1.p_id_dummy, T2.hasPosition FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_8'
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,013
1,013
CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, hasPosition TEXT, yearsInProgram TEXT ) CREATE TABLE `advisedBy` ( CREATE TABLE "advisedBy" p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key p_id, p_id_dummy, constraint advisedBy_person_p_id_p_id_fk foreign key p_id, p_id_dummy references person p_id, p_id )
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{ "case_1": [ 910, 1043 ], "case_2": [ 866, 910, 977, 1043 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
List any five of course IDs with professor IDs who taught master courses.
professor IDs refers to taughtBy.p_id; master course refers to courseLevel = 'Level_500'
SELECT T1.course_id, T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500' LIMIT 5
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,014
1,014
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "AS", "SELECT", "LIMIT", "INNER JOIN", "ON", "FROM" ]
7
simple
{ "case_1": [ 711 ], "case_2": [ 36, 462, 711, 1005 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "case_5": [ 0, 1, 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, 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, 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, 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, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 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, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 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, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
computer_student
How many students are under advisor 415?
advisor 415 refers to p_id_dummy = 415
SELECT COUNT(*) FROM advisedBy WHERE p_id_dummy = 415
CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,015
1,015
CREATE TABLE `advisedBy` ( CREATE TABLE "advisedBy" p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key p_id, p_id_dummy, constraint advisedBy_person_p_id_p_id_fk foreign key p_id, p_id_dummy references person p_id, p_id )
[ "COUNT", "SELECT", "FROM" ]
3
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
How many professional or master/graduate courses are there?
professional or master/graduate courses refers to courseLevel = 'Level_500'
SELECT COUNT(*) FROM course WHERE courseLevel = 'Level_500'
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,016
1,016
CREATE TABLE `course` ( courseLevel TEXT )
[ "COUNT", "SELECT", "FROM" ]
3
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
How many non-faculty members are not undergoing the phase of qualifications?
non-faculty members refers to hasPosition = 0; are not undergoing the phase of qualifications refers to inPhase = 0
SELECT COUNT(*) FROM person WHERE hasPosition = 0 AND inPhase = 0
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,017
1,017
CREATE TABLE `person` ( hasPosition TEXT, inPhase TEXT )
[ "COUNT", "AND", "SELECT", "FROM" ]
4
simple
{ "case_1": [ 216, 757 ], "case_2": [ 216, 757 ], "case_3": [ 11, 36, 216, 462, 481, 552, 664, 757, 866, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
Which professor taught the least amount of courses?
professor refers to taughtBy.p_id; least amount of courses refers to min(count(course_id))
SELECT p_id FROM taughtBy GROUP BY p_id ORDER BY COUNT(course_id) ASC LIMIT 1
CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,018
1,018
CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "GROUP BY", "SELECT", "ORDER BY", "LIMIT", "ASC", "COUNT", "FROM" ]
7
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 11, 36, 462, 481, 552, 664, 866, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "case_5": [ 1, 10, 11, 13, 15, 17, 20, 22, 28, 29, 36, 38, 49, 55, 59, 62, 69, 73, 75, 78, 86, 89, 108, 115, 121, 125, 126, 133, 138, 140, 142, 143, 150, 159, 162, 163, 167, 169, 173, 174, 179, 181, 182, 185, 187, 188, 191, 199, 202, 206, 208, 213, 214, 229, 233, 247, 252, 262, 275, 278, 281, 285, 286, 291, 309, 311, 313, 314, 319, 320, 324, 329, 334, 336, 337, 341, 342, 344, 345, 348, 349, 352, 353, 356, 359, 364, 365, 371, 373, 378, 379, 381, 385, 394, 395, 400, 403, 404, 409, 411, 424, 428, 429, 434, 435, 444, 445, 451, 454, 460, 462, 466, 469, 473, 481, 482, 495, 497, 505, 530, 532, 534, 536, 538, 542, 548, 552, 555, 560, 566, 567, 576, 578, 579, 583, 584, 586, 590, 592, 595, 611, 619, 621, 625, 626, 630, 634, 637, 638, 645, 654, 657, 659, 664, 665, 669, 681, 688, 690, 691, 696, 698, 701, 703, 708, 713, 718, 719, 721, 732, 733, 735, 743, 748, 752, 759, 760, 768, 778, 779, 790, 803, 810, 815, 817, 818, 823, 827, 830, 836, 850, 851, 861, 866, 869, 876, 886, 889, 891, 893, 901, 911, 918, 927, 929, 934, 946, 950, 951, 954, 956, 962, 963, 966, 967, 970, 972, 973, 975, 977, 981, 983, 987, 989, 993, 994, 1004, 1005, 1006, 1010, 1013, 1017, 1024, 1025, 1030, 1034, 1037, 1038, 1043, 1047, 1049, 1050, 1051, 1056, 1057, 1065, 1067, 1068, 1070, 1076, 1077, 1083, 1094, 1106, 1124, 1135, 1137, 1139, 1141 ] }
computer_student
Among the students being advised by Advisor 5, how many students are in the 5th year?
Advisor 5 refers to p_id_dummy = 5; are in the 5th year refers to yearsInProgram = 'Year_5'
SELECT COUNT(*) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.p_id_dummy = 5 AND T2.student = 1 AND T2.yearsInProgram = 'Year_5'
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,019
1,019
CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, student INTEGER, yearsInProgram TEXT ) CREATE TABLE `advisedBy` ( CREATE TABLE "advisedBy" p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key p_id, p_id_dummy, constraint advisedBy_person_p_id_p_id_fk foreign key p_id, p_id_dummy references person p_id, p_id )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
9
simple
{ "case_1": [ 910, 1043 ], "case_2": [ 866, 910, 977, 1043 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
Which professor teaches the highest number of professional or master/graduate courses?
professor refers to taughtBy.p_id; highest number of professional or master/graduate courses refers to max(count(taughtBy.course_id)) where courseLevel = 'Level_500'
SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500' GROUP BY T2.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,020
1,020
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
11
medium
{ "case_1": [ 36, 462, 1005 ], "case_2": [ 36, 462, 664, 1005 ], "case_3": [ 11, 36, 462, 552, 664, 866, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
Among the faculty affiliated professor, how many professors teaches professional or master/undergraduate courses?
faculty affiliated professor refers to professor = 1 and hasPosition = 'Faculty_aff'; professional or master/undergraduate courses refers to courseLevel = 'Level_500'
SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_aff' AND T1.professor = 1 AND T3.courseLevel = 'Level_500'
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,021
1,021
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, professor INTEGER, hasPosition TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
12
medium
{ "case_1": [ 11, 552 ], "case_2": [ 11, 58, 552 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
Who are the top 5 professors who teaches the highest number of professional or master/undergraduate courses?
professors refers to course.p_id; highest number of professional or master/undergraduate courses refers to max(count(course.course_id)) where courseLevel = 'Level_500'
SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500' GROUP BY T2.p_id ORDER BY COUNT(T2.p_id) DESC LIMIT 5
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,022
1,022
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
11
medium
{ "case_1": [ 36, 462, 1005 ], "case_2": [ 36, 462, 664, 1005 ], "case_3": [ 11, 36, 462, 552, 664, 866, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
How many advisors are in charge of advising all the students in 1st year?
advisors refers to p_id_dummy; students in 1st year refers to student = 1 and yearsInProgram = 'Year_1'
SELECT COUNT(T1.p_id_dummy) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_1' AND T2.student = 1
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,023
1,023
CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, student INTEGER, yearsInProgram TEXT ) CREATE TABLE `advisedBy` ( CREATE TABLE "advisedBy" p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key p_id, p_id_dummy, constraint advisedBy_person_p_id_p_id_fk foreign key p_id, p_id_dummy references person p_id, p_id )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
8
simple
{ "case_1": [ 910, 1043 ], "case_2": [ 866, 910, 977, 1043 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
How many professors teaches no more than two high-level or harder undergraduate courses?
professors refers to taughtBy.p_id; high-level or harder undergraduate courses  refers to courseLevel = 'Level_400' ; no more than two refers to count(taughtBy.course_id) < = 2
SELECT COUNT(*) FROM ( SELECT COUNT(T2.p_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_400' GROUP BY T2.p_id HAVING COUNT(DISTINCT T1.course_id) <= 2 )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,024
1,024
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "GROUP BY", "AS", "SELECT", "HAVING", "INNER JOIN", "ON", "COUNT", "FROM" ]
13
medium
{ "case_1": [ 36, 462, 1005 ], "case_2": [ 36, 462, 481, 711, 1005 ], "case_3": [ 11, 36, 58, 462, 481, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 182, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 718, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 817, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
computer_student
Between the faculty employee professors, how many teaches high-level or harder undergraduate courses? Indicate each of the professors unique identifying number.
faculty employee professors refers to hasPosition = 'Faculty_eme' and professor = 1; high-level or harder undergraduate courses refers to courseLevel = 'Level_400'; professors unique identifying number refers to person.p_id
SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_eme' AND T1.professor = 1 AND T3.courseLevel = 'Level_400'
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,025
1,025
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, professor INTEGER, hasPosition TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
12
medium
{ "case_1": [ 11, 552 ], "case_2": [ 11, 58, 552 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
What is the position in the faculty of the professor who teaches the highest number of courses?
position in the faculty refers to hasPosition; professor refers to professor = 1; teaches the highest number of courses refers to max(count(taughtBy.course_id))
SELECT T1.hasPosition FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1 GROUP BY T1.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,026
1,026
CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, professor INTEGER, hasPosition TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
11
medium
{ "case_1": [ 1006 ], "case_2": [ 1006 ], "case_3": [ 11, 36, 462, 552, 664, 866, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
What year in the program do the students with more than 2 advisors are in?
students refers to student = 1; more than 2 advisors refers to count(p_id_dummy) > 2
SELECT T2.yearsInProgram FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.student = 1 GROUP BY T2.p_id HAVING COUNT(T2.p_id) > 2
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,027
1,027
CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, student INTEGER, yearsInProgram TEXT ) CREATE TABLE `advisedBy` ( CREATE TABLE "advisedBy" p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key p_id, p_id_dummy, constraint advisedBy_person_p_id_p_id_fk foreign key p_id, p_id_dummy references person p_id, p_id )
[ "GROUP BY", "AS", "SELECT", "HAVING", "INNER JOIN", "ON", "COUNT", "FROM" ]
9
simple
{ "case_1": [ 910, 1043 ], "case_2": [ 866, 910, 977, 1043 ], "case_3": [ 11, 36, 58, 462, 481, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 182, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 718, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 817, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
computer_student
How many professors teaches basic or medium undergraduate courses?
professors refers to taughtBy.p_id; basic or medium undergraduate courses refers to couresLevel = 'Level_300'
SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_300'
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,028
1,028
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, primary key course_id, foreign key course_id references coursecourse_id )
[ "AS", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
7
simple
{ "case_1": [ 711 ], "case_2": [ 36, 462, 711, 1005 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
Among the students being advised by advisors, which students' year in the program do the advisors advise the majority of?
students refers to student = 1; students' year in the program do the advisors advise the majority of refers to max(count(yearsInProgram))
SELECT T2.yearsInProgram FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.student = 1 GROUP BY T2.yearsInProgram ORDER BY COUNT(T1.p_id_dummy) DESC LIMIT 1
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,029
1,029
CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, student INTEGER, yearsInProgram TEXT ) CREATE TABLE `advisedBy` ( CREATE TABLE "advisedBy" p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key p_id, p_id_dummy, constraint advisedBy_person_p_id_p_id_fk foreign key p_id, p_id_dummy references person p_id, p_id )
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
11
medium
{ "case_1": [ 866, 977 ], "case_2": [ 866, 977, 1043 ], "case_3": [ 11, 36, 462, 552, 664, 866, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
How many students that are undergoing the pre-phase of qualification have advisors?
students refers to student = 1 and ; undergoing the phase of pre-qualification refers to inPhase = 'Pre-Quals'; have advisors refers to advisedBy.p_id
SELECT COUNT(T1.p_id_dummy) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.inPhase = 'Pre_Quals' AND T2.student = 1
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,030
1,030
CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, student INTEGER, inPhase TEXT ) CREATE TABLE `advisedBy` ( CREATE TABLE "advisedBy" p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key p_id, p_id_dummy, constraint advisedBy_person_p_id_p_id_fk foreign key p_id, p_id_dummy references person p_id, p_id )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
8
simple
{ "case_1": [ 910, 1043 ], "case_2": [ 866, 910, 977, 1043 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
What is the average number of professional or master/undergraduate courses being taught by each professor?
professional or master/undergraduate courses refers to courseLevel = 'Level_500'; average number = divide(count(taughtBy.course_id), count(taughtBy.p_id))
SELECT CAST(COUNT(T1.course_id) AS REAL) / COUNT(DISTINCT T2.p_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500'
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,031
1,031
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "AS", "SELECT", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
10
simple
{ "case_1": [ 711 ], "case_2": [ 36, 462, 711, 1005 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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, 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, 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, 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, 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, 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, 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, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
computer_student
How many courses were taught by more than 4 people?
courses refers to taughtBy.course_id; more than 4 people refers to count(taughtBy.p_id) > 4
SELECT COUNT(*) FROM ( SELECT COUNT(course_id) FROM taughtBy GROUP BY course_id HAVING COUNT(course_id) > 4 )
CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,032
1,032
CREATE TABLE `taughtBy` ( course_id INTEGER, primary key course_id, foreign key course_id references coursecourse_id )
[ "GROUP BY", "SELECT", "HAVING", "COUNT", "FROM" ]
9
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 11, 36, 216, 462, 481, 552, 664, 757, 866, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "case_5": [ 0, 1, 2, 4, 6, 9, 11, 13, 15, 16, 20, 22, 25, 27, 28, 30, 32, 35, 36, 37, 40, 47, 51, 53, 55, 61, 62, 63, 67, 68, 69, 73, 74, 75, 77, 78, 82, 86, 87, 88, 89, 91, 93, 96, 98, 106, 108, 109, 113, 115, 117, 118, 119, 121, 124, 125, 126, 131, 140, 142, 143, 146, 147, 148, 152, 157, 159, 160, 164, 167, 169, 170, 173, 175, 179, 182, 183, 184, 185, 187, 188, 189, 190, 191, 192, 196, 197, 198, 199, 202, 203, 206, 210, 212, 213, 214, 216, 224, 225, 226, 227, 229, 230, 233, 234, 243, 244, 247, 252, 254, 256, 259, 261, 267, 268, 269, 271, 273, 276, 277, 285, 286, 291, 293, 294, 299, 301, 303, 311, 313, 314, 316, 317, 319, 320, 323, 325, 330, 334, 335, 336, 338, 339, 341, 344, 345, 348, 349, 352, 354, 356, 358, 359, 360, 364, 365, 370, 371, 373, 374, 375, 377, 378, 379, 380, 381, 382, 383, 384, 391, 392, 394, 399, 401, 403, 406, 409, 410, 411, 412, 416, 417, 420, 421, 423, 424, 426, 436, 443, 444, 445, 447, 448, 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, 526, 531, 532, 535, 536, 537, 538, 542, 543, 544, 545, 547, 548, 551, 552, 554, 558, 559, 560, 563, 564, 566, 573, 579, 580, 581, 582, 585, 586, 591, 594, 595, 596, 597, 598, 603, 606, 608, 611, 613, 618, 620, 627, 629, 630, 632, 633, 634, 638, 641, 645, 646, 649, 651, 654, 656, 658, 659, 661, 662, 663, 664, 665, 667, 668, 669, 671, 673, 680, 681, 687, 688, 689, 690, 692, 694, 696, 698, 701, 703, 705, 707, 712, 714, 718, 719, 720, 721, 727, 730, 733, 734, 735, 736, 737, 739, 740, 743, 748, 749, 750, 751, 752, 753, 756, 757, 760, 762, 768, 769, 770, 772, 778, 779, 787, 790, 795, 796, 797, 798, 799, 800, 802, 804, 810, 811, 812, 813, 814, 817, 818, 819, 820, 821, 823, 824, 827, 830, 831, 838, 839, 841, 843, 849, 851, 853, 857, 865, 866, 867, 869, 870, 874, 876, 877, 882, 886, 888, 889, 890, 893, 894, 896, 897, 898, 899, 901, 902, 903, 909, 911, 912, 913, 915, 917, 918, 922, 923, 924, 926, 927, 929, 930, 932, 934, 935, 941, 942, 943, 945, 950, 951, 954, 956, 958, 960, 961, 962, 963, 965, 968, 969, 972, 973, 975, 976, 977, 981, 983, 985, 986, 987, 993, 996, 1005, 1006, 1008, 1010, 1011, 1013, 1014, 1015, 1020, 1022, 1023, 1025, 1030, 1037, 1042, 1043, 1047, 1050, 1051, 1053, 1055, 1057, 1058, 1059, 1062, 1064, 1067, 1069, 1070, 1071, 1072, 1076, 1077, 1078, 1079, 1082, 1084, 1086, 1087, 1090, 1091, 1094, 1096, 1100, 1101, 1103, 1104, 1106, 1108, 1112, 1113, 1119, 1121, 1123, 1124, 1126, 1127, 1128, 1131, 1133, 1134, 1135, 1137 ] }
computer_student
What is the total of professional courses available at the university? List out all the course id.
professional courses refers to courseLevel = 'Level_500'; course id refers to course.course_id
SELECT COUNT(course_id) FROM course WHERE courseLevel = 'Level_500'
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,033
1,033
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT )
[ "COUNT", "SELECT", "FROM" ]
3
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
What is the sum of year 1 and year 2 students?
year 1 and year 2 students refers to yearsInProgram = 'Year_1' and yearsInProgram = 'Year_2' and student = 1
SELECT COUNT(*) FROM person WHERE yearsInProgram = 'Year_1' OR yearsInProgram = 'Year_2'
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,034
1,034
CREATE TABLE `person` ( yearsInProgram TEXT )
[ "COUNT", "OR", "SELECT", "FROM" ]
4
simple
{ "case_1": [ 216, 757 ], "case_2": [ 216, 757 ], "case_3": [ 11, 36, 216, 462, 481, 552, 664, 757, 866, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "case_5": [ 0, 1, 2, 4, 6, 9, 11, 13, 15, 16, 20, 22, 25, 27, 28, 30, 32, 35, 36, 37, 40, 42, 47, 51, 53, 54, 55, 61, 62, 63, 67, 68, 69, 73, 74, 75, 77, 78, 82, 86, 87, 88, 89, 91, 93, 96, 98, 106, 108, 109, 113, 115, 117, 118, 119, 121, 124, 125, 126, 131, 140, 142, 143, 146, 147, 148, 152, 157, 159, 160, 164, 167, 169, 170, 173, 175, 179, 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, 229, 230, 233, 234, 243, 244, 247, 252, 254, 256, 259, 261, 267, 268, 269, 271, 273, 276, 277, 286, 291, 293, 294, 299, 301, 303, 311, 314, 316, 317, 319, 320, 323, 325, 330, 334, 335, 336, 338, 339, 341, 344, 345, 348, 349, 352, 354, 358, 359, 360, 364, 370, 371, 373, 374, 375, 380, 382, 383, 384, 391, 392, 394, 399, 401, 403, 406, 409, 410, 411, 412, 416, 417, 420, 421, 423, 424, 426, 436, 443, 444, 445, 447, 448, 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, 526, 531, 532, 535, 536, 537, 538, 542, 543, 544, 545, 547, 548, 552, 554, 558, 559, 560, 563, 564, 566, 573, 580, 581, 582, 585, 591, 594, 595, 596, 597, 598, 603, 606, 608, 611, 613, 618, 620, 627, 629, 630, 632, 633, 634, 641, 645, 646, 649, 654, 656, 658, 659, 661, 662, 663, 664, 665, 667, 668, 669, 671, 673, 680, 681, 687, 688, 689, 692, 694, 696, 698, 703, 705, 707, 712, 713, 714, 718, 719, 721, 727, 730, 733, 734, 735, 736, 737, 739, 740, 743, 748, 749, 750, 752, 753, 756, 757, 760, 762, 768, 769, 770, 772, 778, 779, 787, 790, 795, 796, 797, 798, 799, 800, 802, 804, 811, 812, 813, 814, 817, 818, 819, 820, 821, 824, 827, 829, 830, 831, 838, 839, 841, 843, 849, 851, 853, 857, 865, 866, 867, 869, 870, 874, 876, 877, 886, 888, 890, 893, 894, 896, 897, 898, 899, 901, 902, 903, 909, 911, 912, 913, 915, 917, 918, 922, 923, 924, 926, 927, 930, 934, 935, 941, 942, 943, 945, 950, 951, 954, 956, 958, 960, 961, 963, 965, 968, 969, 972, 975, 976, 977, 981, 983, 985, 986, 993, 996, 1005, 1006, 1008, 1010, 1011, 1013, 1014, 1015, 1020, 1022, 1023, 1030, 1037, 1042, 1043, 1047, 1050, 1051, 1053, 1055, 1057, 1058, 1059, 1062, 1064, 1067, 1069, 1070, 1071, 1072, 1076, 1077, 1078, 1079, 1082, 1084, 1086, 1087, 1090, 1094, 1096, 1100, 1101, 1103, 1104, 1106, 1112, 1113, 1119, 1121, 1123, 1124, 1126, 1127, 1128, 1131, 1133, 1134, 1135, 1137 ] }
computer_student
How many courses were taught by a professor who is currently the member of faculty?
professor refers to professor = 1;  member of faculty refers to hasPosition <> 0
SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1 AND T1.hasPosition <> 0
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,035
1,035
CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, professor INTEGER, hasPosition TEXT ) CREATE TABLE `taughtBy` ( p_id INTEGER, p_id, foreign key p_id references personp_id )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
8
simple
{ "case_1": [ -1 ], "case_2": [ 1006 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
Which professor taught the most courses and what is the position of this person in the university?
professor refers to taughtBy.p_id; most courses refers to max(taughtBy.p_id); position refers to hasPosition
SELECT T1.p_id, T1.hasPosition FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,036
1,036
CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, hasPosition TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
11
medium
{ "case_1": [ 1006 ], "case_2": [ 1006 ], "case_3": [ 11, 36, 462, 552, 664, 866, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
Which courses were taught by a professor who is not a faculty member?
courses refers to taughtBy.course_id; professor refers to professor = 1; is not a faculty member refers to hasPosition = 0
SELECT DISTINCT T2.course_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1 AND T1.hasPosition = 0
CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,037
1,037
CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key, professor INTEGER, hasPosition TEXT ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{ "case_1": [ -1 ], "case_2": [ 1006 ], "case_3": [ 11, 36, 58, 462, 552, 711, 866, 910, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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 ] }
computer_student
Which member of the faculty are teaching the most courses and what is his/her general course level?
member of the faculty refers to hasPosition <> 0, most courses refers to max(count(course.course_id))
SELECT T1.p_id, T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id GROUP BY T1.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE person ( p_id INTEGER constraint person_pk primary key, professor INTEGER, student INTEGER, hasPosition TEXT, inPhase TEXT, yearsInProgram TEXT ) CREATE TABLE "advisedBy" ( p_id INTEGER, p_id_dummy INTEGER, constraint advisedBy_pk primary key (p_id, p_id_dummy), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id) ) CREATE TABLE taughtBy ( course_id INTEGER, p_id INTEGER, primary key (course_id, p_id), foreign key (p_id) references person(p_id), foreign key (course_id) references course(course_id) )
na
1,038
1,038
CREATE TABLE `course` ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT ) CREATE TABLE `person` ( p_id INTEGER constraint person_pk primary key ) CREATE TABLE `taughtBy` ( course_id INTEGER, p_id INTEGER, primary key course_id, p_id, foreign key p_id references personp_id, foreign key course_id references coursecourse_id )
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
14
medium
{ "case_1": [ 11, 552 ], "case_2": [ 11, 552 ], "case_3": [ 11, 36, 462, 552, 664, 866, 977, 1005, 1006, 1043 ], "case_4": [ 11, 36, 58, 216, 462, 481, 552, 664, 711, 757, 866, 910, 977, 1005, 1006, 1043 ], "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
What is the device id of the oldest user?
oldest user refers to MAX(age);
SELECT device_id 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,039
1,039
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", "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
How many events were held at coordinate 97,40?
coordinate 97,40 refers to longitude = 97 AND latitude = 40;
SELECT COUNT(event_id) FROM `events` WHERE latitude = 40 AND longitude = 97
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,040
1,040
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
How many male users are in the age group of M32-38?
male refers to gender = 'M'; age group refers to group; `group` = 'M32-38';
SELECT COUNT(gender) FROM gender_age WHERE gender = 'M' AND `group` = 'M32-38'
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,041
1,041
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 )
[ "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
How many female users over the age of 50 are there?
female refers to gender = 'F'; over the age of 50 refers to age > 50;
SELECT COUNT(gender) FROM gender_age WHERE age > 50 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,042
1,042
CREATE TABLE `gender_age` ( CREATE TABLE `gender_age` `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL )
[ "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
How many active users were there in the event id 2?
active users refers to is_active = 1;
SELECT COUNT(is_active) FROM app_events WHERE event_id = 2 AND 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,043
1,043
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 )
[ "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 gender of the youngest user?
youngest user refers to MIN(age);
SELECT gender 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,044
1,044
CREATE TABLE `gender_age` ( CREATE TABLE `gender_age` `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL )
[ "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
What is the name of the category which most users belong to?
most users belong to refers to MAX(COUNT(app_id)); name of category refers to category;
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 T2.label_id = T1.label_id GROUP BY T1.app_id, T2.category ) AS T ORDER BY T.num DESC LIMIT 1
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,045
1,045
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
What is the model of the oldest user's device?
model of the device refers to device_model; oldest user refers to MAX(age);
SELECT T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id ORDER BY T2.age 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,046
1,046
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", "DESC", "FROM" ]
9
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, 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 users are there in the Home Decoration category?
SELECT COUNT(T1.app_id) FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T2.label_id = T1.label_id WHERE T2.category = 'Home Decoration'
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,047
1,047
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 male users are active in the events held on 5/1/2016?
male refers to gender = 'M'; active refers to is_active = 1; on 5/1/2016 refers to timestamp LIKE '2016-05-01%';
SELECT COUNT(T3.gender) FROM app_events AS T1 INNER JOIN events_relevant AS T2 ON T2.event_id = T1.event_id INNER JOIN gender_age AS T3 ON T3.device_id = T2.device_id WHERE T1.is_active = 1 AND T3.gender = 'M' AND T2.timestamp LIKE '2016-05-01%'
CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `events_relevant` ( `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME NOT NULL, `longitude` REAL NOT NULL, `latitude` REAL NOT NULL, PRIMARY KEY (`event_id`), FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `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,048
1,048
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_relevant` ( CREATE TABLE `events_relevant` `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME NOT NULL, PRIMARY KEY `event_id`, FOREIGN KEY `device_id` REFERENCES `gender_age` `device_id` ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `gender_age` ( CREATE TABLE `gender_age` `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, PRIMARY KEY `device_id`, FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE )
[ "AS", "AND", "SELECT", "LIKE", "-", "INNER JOIN", "ON", "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, 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, 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, 591, 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, 1057, 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 female users use ZenFone 5 devices?
female refers to gender = 'F'; ZenFone 5 refers to device_model = 'ZenFone 5';
SELECT COUNT(T1.gender) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T2.device_id = T1.device_id WHERE T1.gender = 'F' AND T2.device_model = 'ZenFone 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,049
1,049
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 of the oldest active user that participated in the event held on 5/6/2016 at coordinates 121, 31?
oldest user refers to MAX(age); active user refers to is_active = 1; on 5/6/2016 refers to timestamp LIKE '2016-05-06%'; coordinates 121, 31 refers to longitude = 121 AND latitude = 31;
SELECT T3.age FROM app_events AS T1 INNER JOIN events_relevant AS T2 ON T1.event_id = T2.event_id INNER JOIN gender_age AS T3 ON T2.device_id = T3.device_id WHERE T1.is_active = 1 AND T2.longitude = 121 AND T2.latitude = 31 AND SUBSTR(T2.timestamp, 1, 10) = '2016-05-06' ORDER BY T3.age DESC LIMIT 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_relevant` ( `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME NOT NULL, `longitude` REAL NOT NULL, `latitude` REAL NOT NULL, PRIMARY KEY (`event_id`), FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `gender_age` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`), FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE )
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ) CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `app_events_relevant` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER DEFAULT NULL, `is_active` INTEGER DEFAULT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `app_labels` ( `app_id` INTEGER NOT NULL, `label_id` INTEGER NOT NULL, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `events` ( `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME DEFAULT NULL, `longitude` REAL DEFAULT NULL, `latitude` REAL DEFAULT NULL, PRIMARY KEY (`event_id`) ) CREATE TABLE `events_relevant` ( `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME NOT NULL, `longitude` REAL NOT NULL, `latitude` REAL NOT NULL, PRIMARY KEY (`event_id`), FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `gender_age` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`), FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `gender_age_test` ( `device_id` INTEGER NOT NULL, PRIMARY KEY (`device_id`) ) CREATE TABLE `gender_age_train` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`) ) CREATE TABLE `label_categories` ( `label_id` INTEGER NOT NULL, `category` TEXT DEFAULT NULL, PRIMARY KEY (`label_id`) ) CREATE TABLE `phone_brand_device_model2` ( `device_id` INTEGER NOT NULL, `phone_brand` TEXT NOT NULL, `device_model` TEXT NOT NULL, PRIMARY KEY (`device_id`,`phone_brand`,`device_model`) ) CREATE TABLE `sample_submission` ( `device_id` INTEGER NOT NULL, `F23-` REAL DEFAULT NULL, `F24-26` REAL DEFAULT NULL, `F27-28` REAL DEFAULT NULL, `F29-32` REAL DEFAULT NULL, `F33-42` REAL DEFAULT NULL, `F43+` REAL DEFAULT NULL, `M22-` REAL DEFAULT NULL, `M23-26` REAL DEFAULT NULL, `M27-28` REAL DEFAULT NULL, `M29-31` REAL DEFAULT NULL, `M32-38` REAL DEFAULT NULL, `M39+` REAL DEFAULT NULL, PRIMARY KEY (`device_id`) )
na
1,050
1,050
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_relevant` ( 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` ( 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", "ORDER BY", "LIMIT", "-", "INNER JOIN", "ON", "DESC", "SUBSTR", "FROM" ]
18
challenging
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 88, 143, 160, 187, 188, 189, 228, 244, 319, 382, 424, 445, 515, 595, 608, 611, 671, 675, 687, 756, 768, 849, 1067, 1094 ], "case_4": [ 88, 110, 143, 157, 160, 187, 188, 189, 222, 228, 244, 253, 260, 306, 319, 357, 382, 424, 445, 484, 506, 515, 554, 555, 595, 608, 611, 671, 675, 687, 737, 756, 768, 839, 842, 849, 938, 1026, 1067, 1094, 1138 ], "case_5": [ 1, 3, 4, 5, 8, 10, 11, 12, 19, 20, 21, 22, 24, 26, 29, 30, 33, 34, 36, 37, 38, 39, 42, 43, 44, 45, 47, 49, 51, 52, 53, 55, 57, 59, 62, 63, 66, 68, 69, 71, 73, 74, 75, 76, 85, 86, 88, 89, 90, 93, 95, 96, 97, 98, 99, 105, 111, 112, 113, 115, 116, 117, 118, 119, 121, 125, 127, 128, 129, 131, 135, 138, 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, 187, 188, 189, 197, 199, 200, 202, 206, 213, 214, 219, 227, 228, 229, 233, 239, 240, 244, 247, 256, 258, 262, 265, 266, 267, 268, 272, 275, 276, 277, 278, 281, 282, 286, 296, 300, 301, 309, 311, 313, 314, 315, 317, 319, 320, 324, 325, 329, 330, 334, 336, 339, 341, 342, 345, 349, 353, 356, 361, 364, 365, 368, 370, 373, 374, 376, 378, 379, 381, 382, 383, 385, 391, 392, 393, 394, 395, 398, 402, 403, 405, 406, 408, 409, 411, 413, 414, 416, 417, 419, 424, 425, 426, 427, 428, 429, 433, 434, 435, 436, 437, 438, 440, 444, 445, 446, 448, 451, 452, 454, 455, 460, 462, 463, 464, 469, 470, 475, 476, 477, 480, 482, 489, 490, 493, 494, 495, 496, 497, 498, 500, 503, 505, 507, 509, 514, 515, 516, 519, 520, 522, 524, 526, 528, 529, 530, 532, 533, 536, 537, 538, 539, 541, 542, 544, 548, 550, 552, 557, 558, 559, 560, 561, 562, 563, 566, 567, 578, 579, 580, 581, 582, 584, 586, 588, 589, 590, 592, 595, 605, 608, 610, 611, 612, 613, 615, 621, 624, 625, 626, 627, 632, 633, 634, 637, 638, 641, 643, 645, 647, 648, 649, 651, 654, 657, 659, 660, 663, 665, 666, 668, 669, 671, 675, 677, 678, 681, 683, 684, 685, 686, 687, 688, 690, 691, 693, 695, 697, 699, 701, 702, 712, 714, 715, 719, 726, 727, 733, 734, 735, 739, 740, 741, 743, 746, 747, 749, 752, 753, 754, 756, 758, 759, 760, 763, 765, 767, 768, 773, 775, 776, 777, 778, 780, 783, 788, 790, 793, 797, 799, 800, 803, 804, 805, 806, 807, 808, 810, 814, 818, 819, 823, 824, 825, 827, 829, 830, 832, 835, 838, 844, 848, 849, 850, 851, 853, 858, 859, 860, 861, 866, 867, 870, 873, 876, 877, 878, 879, 882, 886, 888, 889, 891, 892, 893, 895, 896, 901, 902, 905, 907, 911, 917, 918, 922, 923, 924, 925, 927, 928, 929, 930, 931, 932, 934, 935, 943, 944, 949, 950, 951, 953, 954, 956, 958, 959, 961, 962, 963, 966, 967, 969, 970, 973, 974, 975, 977, 980, 981, 985, 986, 991, 993, 994, 996, 1000, 1001, 1004, 1005, 1006, 1010, 1013, 1017, 1019, 1022, 1023, 1025, 1027, 1031, 1034, 1037, 1038, 1039, 1042, 1044, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1061, 1063, 1064, 1065, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1084, 1086, 1092, 1094, 1100, 1101, 1103, 1104, 1105, 1109, 1111, 1115, 1119, 1123, 1124, 1128, 1131, 1132, 1136, 1137 ] }
talkingdata
What is the most common device model among female users between the ages 27 to 28?
most common device model refers to MAX(COUNT(device_id)); female refers to gender = 'F'; between the ages 27 to 28 refers to group = 'F27-28';
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` = 'F27-28' AND T1.gender = 'F' ORDER BY T2.device_id 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,051
1,051
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", "ORDER BY", "LIMIT", "-", "INNER JOIN", "ON", "DESC", "FROM" ]
11
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, 228, 244, 319, 382, 424, 445, 515, 595, 608, 611, 671, 675, 687, 756, 768, 849, 1067, 1094 ], "case_4": [ 88, 110, 143, 157, 160, 187, 188, 189, 222, 228, 244, 253, 260, 306, 319, 357, 382, 424, 445, 484, 506, 515, 554, 555, 595, 608, 611, 671, 675, 687, 737, 756, 768, 839, 842, 849, 938, 1026, 1067, 1094, 1138 ], "case_5": [ 1, 3, 4, 5, 8, 10, 11, 12, 19, 20, 21, 22, 24, 26, 29, 30, 33, 34, 36, 37, 38, 39, 42, 43, 44, 45, 47, 49, 51, 52, 53, 55, 57, 59, 62, 63, 66, 68, 69, 71, 73, 74, 75, 76, 85, 86, 88, 89, 90, 93, 95, 96, 97, 98, 99, 105, 111, 112, 113, 115, 116, 117, 118, 119, 121, 125, 127, 128, 129, 131, 135, 138, 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, 187, 188, 189, 197, 199, 200, 202, 206, 213, 214, 219, 227, 228, 229, 233, 239, 240, 244, 247, 256, 258, 262, 265, 266, 267, 268, 272, 275, 276, 277, 278, 281, 282, 286, 296, 300, 301, 309, 311, 313, 314, 315, 317, 319, 320, 324, 325, 329, 330, 334, 336, 339, 341, 342, 345, 349, 353, 356, 361, 364, 365, 368, 370, 373, 374, 376, 378, 379, 381, 382, 383, 385, 391, 392, 393, 394, 395, 398, 402, 403, 405, 406, 408, 409, 411, 413, 414, 416, 417, 419, 424, 425, 426, 427, 428, 429, 433, 434, 435, 436, 437, 438, 440, 444, 445, 446, 448, 451, 452, 454, 455, 460, 462, 463, 464, 469, 470, 475, 476, 477, 480, 482, 489, 490, 493, 494, 495, 496, 497, 498, 500, 503, 505, 507, 509, 514, 515, 516, 519, 520, 522, 524, 526, 528, 529, 530, 532, 533, 536, 537, 538, 539, 541, 542, 544, 548, 550, 552, 557, 558, 559, 560, 561, 562, 563, 566, 567, 578, 579, 580, 581, 582, 584, 586, 588, 589, 590, 592, 595, 605, 608, 610, 611, 612, 613, 615, 621, 624, 625, 626, 627, 632, 633, 634, 637, 638, 641, 643, 645, 647, 648, 649, 651, 654, 657, 659, 660, 663, 665, 666, 668, 669, 671, 675, 677, 678, 681, 683, 684, 685, 686, 687, 688, 690, 691, 693, 695, 697, 699, 701, 702, 712, 714, 715, 719, 726, 727, 733, 734, 735, 739, 740, 741, 743, 746, 747, 749, 752, 753, 754, 756, 758, 759, 760, 763, 765, 767, 768, 773, 775, 776, 777, 778, 780, 783, 788, 790, 793, 797, 799, 800, 803, 804, 805, 806, 807, 808, 810, 814, 818, 819, 823, 824, 825, 827, 829, 830, 832, 835, 838, 844, 848, 849, 850, 851, 853, 858, 859, 860, 861, 866, 867, 870, 873, 876, 877, 878, 879, 882, 886, 888, 889, 891, 892, 893, 895, 896, 901, 902, 905, 907, 911, 917, 918, 922, 923, 924, 925, 927, 928, 929, 930, 931, 932, 934, 935, 943, 944, 949, 950, 951, 953, 954, 956, 958, 959, 961, 962, 963, 966, 967, 969, 970, 973, 974, 975, 977, 980, 981, 985, 986, 991, 993, 994, 996, 1000, 1001, 1004, 1005, 1006, 1010, 1013, 1017, 1019, 1022, 1023, 1025, 1027, 1031, 1034, 1037, 1038, 1039, 1042, 1044, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1061, 1063, 1064, 1065, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1084, 1086, 1092, 1094, 1100, 1101, 1103, 1104, 1105, 1109, 1111, 1115, 1119, 1123, 1124, 1128, 1131, 1132, 1136, 1137 ] }
talkingdata
What are the categories of the top 2 oldest events?
oldest event refers to MIN(timestamp);
SELECT T4.category FROM events_relevant AS T1 INNER JOIN app_events_relevant AS T2 ON T1.event_id = T2.event_id INNER JOIN app_labels AS T3 ON T3.app_id = T2.app_id INNER JOIN label_categories AS T4 ON T3.label_id = T4.label_id ORDER BY T1.timestamp LIMIT 2
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_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 `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,052
1,052
CREATE TABLE `app_events_relevant` ( CREATE TABLE `app_events_relevant` `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT 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` ( 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_relevant` ( CREATE TABLE `events_relevant` `event_id` INTEGER NOT NULL, `timestamp` DATETIME NOT NULL, PRIMARY KEY `event_id` ) 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" ]
14
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, 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
What is the gender of the majority of Vivo phone users?
majority of Vivo phone users refers to MAX(COUNT(phone_brand = 'vivo'));
SELECT T.gender FROM ( SELECT T2.gender, COUNT(T2.gender) AS num FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T1.phone_brand = 'vivo' GROUP BY T2.gender ) 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,053
1,053
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
Which category has the highest number of users?
highest number of 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 T2.label_id = T1.label_id GROUP BY T1.app_id, T2.category ) AS T ORDER BY T.num DESC LIMIT 1
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,054
1,054
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
How many users belong to the MOBA category?
SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T2.label_id = T1.label_id WHERE T1.category = 'MOBA'
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,055
1,055
CREATE TABLE `app_labels` ( CREATE TABLE `app_labels` `app_id` INTEGER NOT NULL, `label_id` INTEGER NOT NULL, FOREIGN KEY `label_id` REFERENCES `label_categories` `label_id` ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY `app_id` REFERENCES `app_all` `app_id` ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `label_categories` ( CREATE TABLE `label_categories` `label_id` INTEGER NOT NULL, `category` TEXT DEFAULT NULL, PRIMARY KEY `label_id` )
[ "AS", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
7
simple
{ "case_1": [ 357, 484, 839, 938 ], "case_2": [ 357, 484, 611, 839, 938 ], "case_3": [ 88, 143, 160, 187, 188, 189, 228, 244, 260, 319, 357, 382, 424, 445, 484, 515, 595, 608, 611, 671, 675, 687, 756, 768, 839, 849, 938, 1067, 1094 ], "case_4": [ 88, 110, 143, 157, 160, 187, 188, 189, 222, 228, 244, 253, 260, 306, 319, 357, 382, 424, 445, 484, 506, 515, 554, 555, 595, 608, 611, 671, 675, 687, 737, 756, 768, 839, 842, 849, 938, 1026, 1067, 1094, 1138 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 661, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
talkingdata
What is the percentage of female OPPO users against the male OPPO users?
percentage = DIVIDE(MULTIPLY(CONCAT(COUNT(device_id WHERE phone_brand = 'OPPO' AND gender = 'F'), 100), COUNT(device_id)), '%') AS 'the percentage of female OPPO users'; DIVIDE(MULTIPLY(CONCAT(COUNT(device_id WHERE phone_brand = 'OPPO' AND gender = 'M'), 100), COUNT(device_id)), '%') AS 'the percentage of male OPPO users';
SELECT SUM(IIF(T2.gender = 'F', 1, 0)) * 100 / COUNT(T2.device_id) AS perFemale , SUM(IIF(T2.gender = 'M', 1, 0)) * 100 / COUNT(T2.device_id) AS perMale FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T1.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,056
1,056
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" ]
12
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, 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 were the locations of the events on 8th May, 2016?
location = longitude, latitude; on 8th May, 2016 refers to `timestamp` LIKE '2016-05-08%';
SELECT longitude, latitude FROM `events` WHERE SUBSTR(`timestamp`, 1, 10) = '2016-05-08'
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,057
1,057
CREATE TABLE `events` ( `timestamp` DATETIME DEFAULT NULL, `longitude` REAL DEFAULT NULL, `latitude` REAL DEFAULT NULL )
[ "SUBSTR", "-", "SELECT", "FROM" ]
5
simple
{ "case_1": [ 554 ], "case_2": [ 554 ], "case_3": [ 187, 189, 228, 244, 253, 382, 445, 554, 675, 737, 756 ], "case_4": [ 88, 110, 143, 157, 160, 187, 188, 189, 222, 228, 244, 253, 260, 306, 319, 357, 382, 424, 445, 484, 506, 515, 554, 555, 595, 608, 611, 671, 675, 687, 737, 756, 768, 839, 842, 849, 938, 1026, 1067, 1094, 1138 ], "case_5": [ 2, 3, 21, 32, 34, 39, 42, 43, 45, 50, 54, 74, 79, 85, 89, 93, 97, 98, 105, 112, 115, 122, 128, 135, 141, 148, 154, 158, 172, 173, 180, 183, 184, 187, 189, 197, 199, 219, 228, 237, 240, 244, 253, 259, 272, 296, 300, 325, 339, 356, 362, 368, 382, 383, 391, 392, 393, 394, 396, 409, 416, 418, 425, 436, 445, 446, 448, 451, 489, 496, 498, 503, 507, 509, 510, 514, 520, 522, 529, 544, 550, 554, 559, 562, 580, 601, 617, 624, 643, 647, 649, 660, 667, 675, 677, 679, 681, 684, 693, 695, 709, 729, 737, 746, 754, 756, 758, 770, 777, 785, 788, 795, 798, 805, 817, 826, 829, 835, 838, 858, 864, 870, 878, 882, 905, 922, 925, 930, 943, 954, 955, 959, 974, 979, 980, 985, 993, 1008, 1031, 1052, 1057, 1068, 1070, 1074, 1078, 1092, 1093, 1097, 1101, 1111, 1123, 1132 ] }
talkingdata
List the app users IDs and installed status for the event ID of 844.
app user IDs refers to app_id; is_installed = 1 means the app status is installed; is_installed = 0 means the app status is not installed;
SELECT app_id , IIF(is_installed = 1, 'YES', 'NO') AS status FROM app_events WHERE event_id = 844
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,058
1,058
CREATE TABLE `app_events` ( CREATE TABLE `app_events` `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, PRIMARY KEY `event_id`, `app_id`, FOREIGN KEY `event_id` REFERENCES `events` `event_id` ON DELETE CASCADE ON UPDATE CASCADE )
[ "AS", "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 events were there on 30th April, 2016?
on 30th April, 2016 refers to `timestamp` LIKE '2016-04-30%';
SELECT COUNT(event_id) FROM events WHERE SUBSTR(`timestamp`, 1, 10) = '2016-04-30'
CREATE TABLE `events` ( `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME DEFAULT NULL, `longitude` REAL DEFAULT NULL, `latitude` REAL DEFAULT NULL, PRIMARY KEY (`event_id`) )
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ) CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `app_events_relevant` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER DEFAULT NULL, `is_active` INTEGER DEFAULT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `app_labels` ( `app_id` INTEGER NOT NULL, `label_id` INTEGER NOT NULL, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `events` ( `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME DEFAULT NULL, `longitude` REAL DEFAULT NULL, `latitude` REAL DEFAULT NULL, PRIMARY KEY (`event_id`) ) CREATE TABLE `events_relevant` ( `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME NOT NULL, `longitude` REAL NOT NULL, `latitude` REAL NOT NULL, PRIMARY KEY (`event_id`), FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `gender_age` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`), FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `gender_age_test` ( `device_id` INTEGER NOT NULL, PRIMARY KEY (`device_id`) ) CREATE TABLE `gender_age_train` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`) ) CREATE TABLE `label_categories` ( `label_id` INTEGER NOT NULL, `category` TEXT DEFAULT NULL, PRIMARY KEY (`label_id`) ) CREATE TABLE `phone_brand_device_model2` ( `device_id` INTEGER NOT NULL, `phone_brand` TEXT NOT NULL, `device_model` TEXT NOT NULL, PRIMARY KEY (`device_id`,`phone_brand`,`device_model`) ) CREATE TABLE `sample_submission` ( `device_id` INTEGER NOT NULL, `F23-` REAL DEFAULT NULL, `F24-26` REAL DEFAULT NULL, `F27-28` REAL DEFAULT NULL, `F29-32` REAL DEFAULT NULL, `F33-42` REAL DEFAULT NULL, `F43+` REAL DEFAULT NULL, `M22-` REAL DEFAULT NULL, `M23-26` REAL DEFAULT NULL, `M27-28` REAL DEFAULT NULL, `M29-31` REAL DEFAULT NULL, `M32-38` REAL DEFAULT NULL, `M39+` REAL DEFAULT NULL, PRIMARY KEY (`device_id`) )
na
1,059
1,059
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
How many users used Vivo Xplay3S model?
Vivo Xplay3S model refers to phone_brand = 'vivo' AND device_model = 'Xplay3S';
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE device_model = 'Xplay3S' AND 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,060
1,060
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", "AND", "SELECT", "FROM" ]
4
simple
{ "case_1": [ 157 ], "case_2": [ 157 ], "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 ratio of male and female users in 27-28 age group?
ratio = DIVIDE(COUNT(device_id WHERE gender = 'M' AND `group` = 'M27-28'), COUNT(device_id WHERE gender = 'F' AND `group` = 'F27-28')); 27-28 age group refers to `group` = 'F27-28';
SELECT SUM(IIF(gender = 'M' AND `group` = 'M27-28', 1, 0)) / SUM(IIF(gender = 'F' AND `group` = 'F27-28', 1, 0)) AS r 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,061
1,061
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 )
[ "AS", "AND", "SELECT", "SUM", "-", "FROM" ]
9
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 88, 143, 160, 187, 189, 228, 244, 319, 382, 424, 445, 506, 515, 595, 608, 671, 675, 687, 756, 768, 849, 1067 ], "case_4": [ 88, 110, 143, 157, 160, 187, 188, 189, 222, 228, 244, 253, 260, 306, 319, 357, 382, 424, 445, 484, 506, 515, 554, 555, 595, 608, 611, 671, 675, 687, 737, 756, 768, 839, 842, 849, 938, 1026, 1067, 1094, 1138 ], "case_5": [ 2, 3, 4, 5, 6, 8, 10, 12, 19, 20, 21, 22, 24, 26, 30, 32, 33, 34, 35, 37, 39, 42, 43, 44, 45, 47, 51, 52, 53, 57, 61, 63, 64, 66, 68, 69, 71, 73, 74, 75, 76, 77, 79, 81, 83, 85, 87, 88, 90, 93, 94, 95, 96, 97, 98, 99, 104, 105, 111, 112, 113, 115, 116, 117, 118, 119, 120, 125, 127, 128, 129, 131, 135, 138, 141, 142, 143, 144, 146, 148, 152, 153, 154, 155, 158, 160, 163, 164, 169, 170, 172, 173, 175, 176, 177, 180, 183, 184, 186, 187, 189, 191, 192, 195, 197, 199, 200, 201, 207, 212, 213, 214, 215, 219, 223, 225, 226, 227, 228, 234, 236, 239, 240, 244, 248, 254, 256, 258, 259, 261, 262, 264, 265, 266, 267, 268, 271, 272, 275, 276, 277, 278, 279, 282, 296, 300, 301, 304, 305, 313, 314, 315, 316, 317, 319, 323, 325, 330, 335, 339, 341, 347, 350, 356, 360, 361, 362, 363, 365, 367, 368, 370, 374, 376, 378, 379, 381, 382, 383, 385, 391, 392, 393, 394, 395, 398, 402, 403, 405, 406, 408, 409, 412, 413, 414, 415, 416, 417, 419, 424, 425, 426, 427, 428, 433, 436, 437, 438, 440, 444, 445, 446, 448, 450, 451, 452, 453, 455, 463, 464, 469, 470, 475, 476, 477, 480, 482, 483, 486, 487, 488, 489, 490, 493, 494, 496, 497, 498, 500, 503, 504, 506, 507, 509, 510, 514, 515, 516, 517, 518, 519, 520, 522, 524, 526, 527, 528, 529, 530, 533, 535, 537, 539, 540, 541, 544, 547, 550, 557, 558, 559, 561, 562, 563, 564, 571, 575, 579, 580, 581, 582, 584, 586, 588, 589, 595, 597, 601, 605, 608, 609, 610, 612, 613, 615, 623, 624, 625, 626, 627, 628, 630, 632, 633, 637, 638, 640, 641, 643, 647, 648, 649, 650, 651, 658, 660, 662, 663, 666, 667, 668, 671, 675, 676, 677, 678, 679, 681, 682, 683, 684, 685, 686, 687, 690, 693, 695, 697, 699, 701, 702, 709, 710, 712, 714, 715, 717, 723, 726, 727, 734, 735, 739, 740, 741, 743, 744, 745, 746, 747, 749, 750, 753, 754, 756, 758, 760, 762, 763, 765, 767, 768, 773, 775, 776, 777, 780, 783, 785, 787, 788, 793, 795, 796, 797, 798, 799, 800, 802, 804, 805, 806, 807, 808, 810, 813, 814, 817, 819, 823, 824, 825, 827, 829, 830, 832, 835, 838, 841, 844, 848, 849, 851, 853, 858, 859, 860, 861, 864, 867, 868, 870, 871, 873, 874, 877, 878, 879, 882, 886, 888, 892, 894, 895, 896, 902, 905, 907, 909, 912, 913, 917, 922, 923, 924, 925, 928, 929, 930, 931, 932, 935, 943, 944, 949, 953, 954, 956, 958, 959, 961, 962, 969, 973, 974, 979, 980, 985, 986, 991, 993, 996, 998, 1000, 1001, 1008, 1012, 1017, 1019, 1022, 1023, 1027, 1031, 1038, 1039, 1042, 1044, 1046, 1052, 1058, 1061, 1063, 1064, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1086, 1087, 1092, 1093, 1098, 1100, 1101, 1103, 1104, 1105, 1109, 1111, 1115, 1119, 1121, 1123, 1128, 1131, 1132, 1135, 1136 ] }
talkingdata
What are the labels' IDs of online shopping and online malls categories?
SELECT label_id FROM label_categories WHERE category IN ('online shopping', 'online malls')
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,062
1,062
CREATE TABLE `label_categories` ( CREATE TABLE `label_categories` `label_id` INTEGER NOT NULL, `category` TEXT DEFAULT NULL, PRIMARY KEY `label_id` )
[ "IN", "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
Describe the phone brands and models of the users who participated in events on 5th May, 2016 at the coordinates of (112,44).
models refers to device_model; on 5th May, 2016 refers to timestamp LIKE '2016-05-05%'; coordinates of (112,44) refers to longitude = 112 AND latitude = 44;
SELECT DISTINCT T2.phone_brand, T2.device_model FROM events AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T2.device_id = T1.device_id WHERE T1.timestamp LIKE '2016-05-05%' AND T1.longitude = 112 AND T1.latitude = 44
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,063
1,063
CREATE TABLE `events` ( `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME 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", "LIKE", "-", "INNER JOIN", "ON", "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, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 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, 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, 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, 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
Provide the app users IDs and time for the event ID of 82.
app user IDs refers to app_id; time refers to timestamp;
SELECT T1.app_id, T2.timestamp FROM app_events AS T1 INNER JOIN events AS T2 ON T2.event_id = T1.event_id WHERE T2.event_id = 82
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,064
1,064
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, 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
Describe the device user gender and age of the event ID of 15251.
SELECT T1.gender, T1.age FROM gender_age AS T1 INNER JOIN events AS T2 ON T2.device_id = T1.device_id WHERE T2.event_id = 15251
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,065
1,065
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", "INNER JOIN", "ON", "FROM" ]
6
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, 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 events did the 88-years-old male users participate on 4th May,2016?
88-years-old refers to age = 88; male refers to gender = 'M'; on 4th May, 2016 refers to timestamp LIKE '2016-05-04%';
SELECT COUNT(T2.event_id) FROM gender_age AS T1 INNER JOIN events AS T2 ON T2.device_id = T1.device_id WHERE T1.gender = 'M' AND SUBSTR(`timestamp`, 1, 10) = '2016-05-04' AND T1.age = 88
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,066
1,066
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" ]
12
medium
{ "case_1": [ 382 ], "case_2": [ 382, 424, 1067 ], "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
Describe the ages, genders and numbers of events participated by the users at coordinates of (-102,38).
coordinates of (-102,38) refers to longitude = -102, latitude = 38;
SELECT DISTINCT T1.age, T1.gender, COUNT(T2.event_id) FROM gender_age AS T1 INNER JOIN `events` AS T2 ON T2.device_id = T1.device_id WHERE T2.longitude = -102 AND T2.latitude = 38 GROUP BY T1.age, T1.gender, T2.longitude, T2.latitude
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,067
1,067
CREATE TABLE `events` ( CREATE TABLE `events` `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `longitude` REAL DEFAULT NULL, `latitude` REAL 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", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "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, 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
Provide the phone brands and models of the users who were at the coordinates of (80,44).
models refers to device_model; coordinates of (80,44) refers to longitude = 80 AND latitude = 44;
SELECT DISTINCT T1.phone_brand, T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN events AS T2 ON T2.device_id = T1.device_id WHERE T2.longitude = 80 AND T2.latitude = 44
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,068
1,068
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
List the included categories in the event ID of 155.
SELECT DISTINCT T1.category FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T2.label_id = T1.label_id INNER JOIN app_events AS T3 ON T3.app_id = T2.app_id WHERE T3.event_id = 155
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,069
1,069
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 `app_labels` ( CREATE TABLE `app_labels` `app_id` INTEGER NOT NULL, `label_id` INTEGER NOT NULL, FOREIGN KEY `label_id` REFERENCES `label_categories` `label_id` ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY `app_id` REFERENCES `app_all` `app_id` ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `label_categories` ( CREATE TABLE `label_categories` `label_id` INTEGER NOT NULL, `category` TEXT DEFAULT NULL, PRIMARY KEY `label_id` )
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 88, 143, 160, 187, 188, 189, 228, 244, 260, 319, 357, 382, 424, 445, 484, 506, 515, 555, 595, 608, 611, 671, 675, 687, 756, 768, 839, 849, 938, 1067, 1094 ], "case_4": [ 88, 110, 143, 157, 160, 187, 188, 189, 222, 228, 244, 253, 260, 306, 319, 357, 382, 424, 445, 484, 506, 515, 554, 555, 595, 608, 611, 671, 675, 687, 737, 756, 768, 839, 842, 849, 938, 1026, 1067, 1094, 1138 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 506, 507, 508, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 527, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 657, 658, 659, 660, 661, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 978, 980, 981, 982, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1075, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
talkingdata
Among HTC Butterfly phone users, list any five devices' IDs used by females.
HTC Butterfly refers to phone_brand = 'HTC' AND device_model = 'Butterfly'; females refers to gender = 'F';
SELECT T2.device_id FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T1.device_model = 'Butterfly' AND T2.gender = 'F' AND T1.phone_brand = 'HTC' 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,070
1,070
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", "LIMIT", "INNER JOIN", "ON", "FROM" ]
9
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
How many app IDs were included under science fiction category?
SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T2.label_id = T1.label_id WHERE T1.category = 'science fiction'
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,071
1,071
CREATE TABLE `app_labels` ( CREATE TABLE `app_labels` `app_id` INTEGER NOT NULL, `label_id` INTEGER NOT NULL, FOREIGN KEY `label_id` REFERENCES `label_categories` `label_id` ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY `app_id` REFERENCES `app_all` `app_id` ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `label_categories` ( CREATE TABLE `label_categories` `label_id` INTEGER NOT NULL, `category` TEXT DEFAULT NULL, PRIMARY KEY `label_id` )
[ "AS", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
7
simple
{ "case_1": [ 357, 484, 839, 938 ], "case_2": [ 357, 484, 611, 839, 938 ], "case_3": [ 88, 143, 160, 187, 188, 189, 228, 244, 260, 319, 357, 382, 424, 445, 484, 515, 595, 608, 611, 671, 675, 687, 756, 768, 839, 849, 938, 1067, 1094 ], "case_4": [ 88, 110, 143, 157, 160, 187, 188, 189, 222, 228, 244, 253, 260, 306, 319, 357, 382, 424, 445, 484, 506, 515, 554, 555, 595, 608, 611, 671, 675, 687, 737, 756, 768, 839, 842, 849, 938, 1026, 1067, 1094, 1138 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 661, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
talkingdata
What are the ages and genders of the LG L70 users?
LG L70 refers to phone_brand = 'LG' AND device_model = 'L70';
SELECT T2.age, T2.gender FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T1.phone_brand = 'LG' AND T1.device_model = 'L70'
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,072
1,072
CREATE TABLE `gender_age` ( CREATE TABLE `gender_age` `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, PRIMARY KEY `device_id`, FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `phone_brand_device_model2` ( CREATE TABLE `phone_brand_device_model2` `device_id` INTEGER NOT NULL, `phone_brand` TEXT NOT NULL, `device_model` TEXT NOT NULL, PRIMARY KEY `device_id`, `phone_brand`, `device_model` )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{ "case_1": [ 88, 160, 515, 608, 671, 687, 849 ], "case_2": [ 88, 160, 188, 319, 445, 515, 595, 608, 671, 687, 849 ], "case_3": [ 88, 143, 160, 187, 188, 189, 228, 244, 260, 319, 357, 382, 424, 445, 484, 515, 595, 608, 611, 671, 675, 687, 756, 768, 839, 849, 938, 1067, 1094 ], "case_4": [ 88, 110, 143, 157, 160, 187, 188, 189, 222, 228, 244, 253, 260, 306, 319, 357, 382, 424, 445, 484, 506, 515, 554, 555, 595, 608, 611, 671, 675, 687, 737, 756, 768, 839, 842, 849, 938, 1026, 1067, 1094, 1138 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 510, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
talkingdata
Calculate the percentage of the app user IDs under Industry tag category.
percentage = DIVIDE(MULTIPLY(CONCAT(COUNT(app_id WHERE category = 'Industry tag'), 100), COUNT(app_id)),'%');
SELECT SUM(IIF(T1.category = 'Industry tag', 1, 0)) * 100 / COUNT(T2.app_id) AS per FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T2.label_id = T1.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,073
1,073
CREATE TABLE `app_labels` ( CREATE TABLE `app_labels` `app_id` INTEGER NOT NULL, `label_id` INTEGER NOT NULL, FOREIGN KEY `label_id` REFERENCES `label_categories` `label_id` ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY `app_id` REFERENCES `app_all` `app_id` ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `label_categories` ( CREATE TABLE `label_categories` `label_id` INTEGER NOT NULL, `category` TEXT DEFAULT NULL, PRIMARY KEY `label_id` )
[ "AS", "SELECT", "SUM", "INNER JOIN", "ON", "COUNT", "FROM" ]
9
simple
{ "case_1": [ 357, 484, 839, 938 ], "case_2": [ 357, 484, 611, 839, 938 ], "case_3": [ 88, 143, 160, 187, 188, 189, 228, 244, 260, 319, 357, 382, 424, 445, 484, 506, 515, 595, 608, 611, 671, 675, 687, 756, 768, 839, 849, 938, 1067, 1094 ], "case_4": [ 88, 110, 143, 157, 160, 187, 188, 189, 222, 228, 244, 253, 260, 306, 319, 357, 382, 424, 445, 484, 506, 515, 554, 555, 595, 608, 611, 671, 675, 687, 737, 756, 768, 839, 842, 849, 938, 1026, 1067, 1094, 1138 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 506, 507, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 527, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 661, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
talkingdata
Among the LG brand users, calculate the percentage of the Nexus 5 model user. What is the ratio of male and female users of it?
LG brand refers to phone_brand = 'LG'; percentage = DIVIDE(MULTIPLY(CONCAT(COUNT(device_id WHERE device_model = 'Nexus 5'), 100), COUNT(device_id)),'%'); ratio = DIVIDE(COUNT(device_id WHERE device_model = 'Nexus 5' AND gender = 'M'), COUNT(device_id WHERE device_model = 'Nexus 5' AND gender = 'F')); Nexus 5 model refers to device_model = 'Nexus 5';
SELECT SUM(IIF(T1.device_model = 'Nexus 5', 1, 0)) * 100 / COUNT(T1.device_id) AS per , SUM(IIF(T1.device_model = 'Nexus 5' AND T2.gender = 'M', 1, 0)) / SUM(IIF(T1.device_model = 'Nexus 5' AND T2.gender = 'F', 1, 0)) AS r FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T1.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,074
1,074
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" ]
14
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, 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
How many users of the app were not active when event no.2 happened?
not active refers to is_active = 0; event no. refers to event_id; event_id = 2;
SELECT COUNT(event_id) FROM app_events WHERE event_id = 2 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,075
1,075
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 )
[ "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
How many events in total have happened on the devices in 2016?
in 2016 refers to `timestamp` LIKE '2016%';
SELECT COUNT(event_id) FROM `events` WHERE SUBSTR(`timestamp`, 1, 4) = '2016'
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,076
1,076
CREATE TABLE `events` ( CREATE TABLE `events` `event_id` INTEGER NOT NULL, `timestamp` DATETIME DEFAULT NULL, PRIMARY KEY `event_id` )
[ "SUBSTR", "COUNT", "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, 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, 6, 9, 11, 13, 15, 16, 22, 25, 27, 28, 30, 32, 35, 36, 37, 40, 47, 50, 51, 53, 54, 55, 61, 62, 63, 67, 68, 69, 73, 74, 75, 77, 78, 82, 86, 87, 88, 89, 91, 93, 96, 98, 106, 108, 109, 113, 115, 117, 118, 119, 121, 122, 124, 125, 126, 131, 140, 142, 143, 146, 147, 148, 152, 157, 159, 160, 164, 167, 169, 170, 173, 175, 179, 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, 229, 230, 233, 234, 237, 243, 244, 247, 252, 254, 256, 259, 261, 267, 268, 269, 271, 273, 276, 277, 286, 291, 293, 294, 299, 301, 303, 311, 314, 316, 317, 319, 320, 323, 325, 330, 334, 335, 336, 338, 339, 341, 344, 345, 348, 349, 352, 354, 358, 359, 360, 364, 370, 371, 373, 374, 375, 380, 382, 383, 384, 391, 392, 394, 399, 401, 403, 406, 409, 410, 411, 412, 416, 417, 418, 420, 421, 423, 424, 426, 436, 443, 444, 445, 447, 448, 451, 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, 526, 531, 532, 535, 536, 537, 538, 542, 543, 544, 545, 547, 548, 552, 554, 558, 559, 560, 563, 564, 566, 573, 580, 581, 582, 585, 591, 594, 595, 596, 597, 598, 603, 606, 608, 611, 613, 618, 620, 627, 629, 630, 632, 633, 634, 641, 645, 646, 649, 654, 656, 658, 659, 661, 662, 663, 664, 665, 667, 668, 669, 671, 673, 680, 681, 687, 688, 689, 692, 694, 696, 698, 703, 705, 707, 712, 714, 718, 719, 721, 727, 730, 733, 734, 735, 736, 737, 739, 740, 743, 748, 749, 750, 752, 753, 756, 757, 760, 762, 768, 769, 770, 772, 778, 779, 787, 790, 795, 796, 797, 798, 799, 800, 802, 804, 811, 812, 813, 814, 817, 818, 819, 820, 821, 824, 827, 830, 831, 838, 839, 841, 843, 849, 851, 853, 857, 865, 866, 867, 869, 870, 874, 876, 877, 886, 888, 890, 893, 894, 896, 897, 898, 899, 901, 902, 903, 909, 911, 912, 913, 915, 917, 918, 922, 923, 924, 926, 927, 930, 934, 935, 941, 942, 943, 945, 950, 951, 954, 956, 958, 960, 961, 963, 965, 968, 969, 972, 975, 976, 977, 981, 983, 985, 986, 993, 996, 1005, 1006, 1008, 1010, 1011, 1013, 1014, 1015, 1020, 1022, 1023, 1030, 1037, 1042, 1043, 1047, 1050, 1051, 1053, 1055, 1057, 1058, 1059, 1062, 1064, 1067, 1069, 1070, 1071, 1072, 1076, 1077, 1078, 1079, 1082, 1084, 1086, 1087, 1090, 1094, 1096, 1097, 1100, 1101, 1103, 1104, 1106, 1112, 1113, 1119, 1121, 1123, 1124, 1126, 1127, 1128, 1131, 1133, 1134, 1135, 1137 ] }
talkingdata
How many events have happened on device no.29182687948017100 in 2016?
device no. refers to device_id; device_id = 29182687948017100; in 2016 refers to `timestamp` LIKE '2016%';
SELECT COUNT(event_id) FROM `events` WHERE SUBSTR(`timestamp`, 1, 4) = '2016' AND device_id = 29182687948017100
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,077
1,077
CREATE TABLE `events` ( CREATE TABLE `events` `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME DEFAULT NULL, PRIMARY KEY `event_id` )
[ "AND", "SELECT", "SUBSTR", "COUNT", "FROM" ]
5
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, 54, 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, 122, 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, 237, 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, 1097, 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
How many device users are male?
male refers to gender = 'M';
SELECT COUNT(device_id) 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,078
1,078
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", "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
What is the age of the oldest device user?
oldest device user refers to MAX(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,079
1,079
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
Among the female users of the devices, how many of them are under 30?
female refers to gender = 'F'; under 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,080
1,080
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
Among the users who use a Galaxy Note 2, how many of them are female?
Galaxy Note 2 refers to device_model = 'Galaxy Note 2'; female refers to gender = 'F';
SELECT COUNT(T1.device_id) FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T2.gender = 'F' AND T1.device_model = 'Galaxy Note 2'
CREATE TABLE `gender_age` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`), FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `phone_brand_device_model2` ( `device_id` INTEGER NOT NULL, `phone_brand` TEXT NOT NULL, `device_model` TEXT NOT NULL, PRIMARY KEY (`device_id`,`phone_brand`,`device_model`) )
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ) CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `app_events_relevant` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER DEFAULT NULL, `is_active` INTEGER DEFAULT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `app_labels` ( `app_id` INTEGER NOT NULL, `label_id` INTEGER NOT NULL, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `events` ( `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME DEFAULT NULL, `longitude` REAL DEFAULT NULL, `latitude` REAL DEFAULT NULL, PRIMARY KEY (`event_id`) ) CREATE TABLE `events_relevant` ( `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME NOT NULL, `longitude` REAL NOT NULL, `latitude` REAL NOT NULL, PRIMARY KEY (`event_id`), FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `gender_age` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`), FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `gender_age_test` ( `device_id` INTEGER NOT NULL, PRIMARY KEY (`device_id`) ) CREATE TABLE `gender_age_train` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`) ) CREATE TABLE `label_categories` ( `label_id` INTEGER NOT NULL, `category` TEXT DEFAULT NULL, PRIMARY KEY (`label_id`) ) CREATE TABLE `phone_brand_device_model2` ( `device_id` INTEGER NOT NULL, `phone_brand` TEXT NOT NULL, `device_model` TEXT NOT NULL, PRIMARY KEY (`device_id`,`phone_brand`,`device_model`) ) CREATE TABLE `sample_submission` ( `device_id` INTEGER NOT NULL, `F23-` REAL DEFAULT NULL, `F24-26` REAL DEFAULT NULL, `F27-28` REAL DEFAULT NULL, `F29-32` REAL DEFAULT NULL, `F33-42` REAL DEFAULT NULL, `F43+` REAL DEFAULT NULL, `M22-` REAL DEFAULT NULL, `M23-26` REAL DEFAULT NULL, `M27-28` REAL DEFAULT NULL, `M29-31` REAL DEFAULT NULL, `M32-38` REAL DEFAULT NULL, `M39+` REAL DEFAULT NULL, PRIMARY KEY (`device_id`) )
na
1,081
1,081
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
Please list the ages of all the users who use a Galaxy Note 2.
Galaxy Note 2 refers to device_model = 'Galaxy Note 2';
SELECT T2.age FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T1.device_model = 'Galaxy Note 2'
CREATE TABLE `gender_age` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`), FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `phone_brand_device_model2` ( `device_id` INTEGER NOT NULL, `phone_brand` TEXT NOT NULL, `device_model` TEXT NOT NULL, PRIMARY KEY (`device_id`,`phone_brand`,`device_model`) )
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ) CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `app_events_relevant` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER DEFAULT NULL, `is_active` INTEGER DEFAULT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `app_labels` ( `app_id` INTEGER NOT NULL, `label_id` INTEGER NOT NULL, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `events` ( `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME DEFAULT NULL, `longitude` REAL DEFAULT NULL, `latitude` REAL DEFAULT NULL, PRIMARY KEY (`event_id`) ) CREATE TABLE `events_relevant` ( `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME NOT NULL, `longitude` REAL NOT NULL, `latitude` REAL NOT NULL, PRIMARY KEY (`event_id`), FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `gender_age` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`), FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `gender_age_test` ( `device_id` INTEGER NOT NULL, PRIMARY KEY (`device_id`) ) CREATE TABLE `gender_age_train` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`) ) CREATE TABLE `label_categories` ( `label_id` INTEGER NOT NULL, `category` TEXT DEFAULT NULL, PRIMARY KEY (`label_id`) ) CREATE TABLE `phone_brand_device_model2` ( `device_id` INTEGER NOT NULL, `phone_brand` TEXT NOT NULL, `device_model` TEXT NOT NULL, PRIMARY KEY (`device_id`,`phone_brand`,`device_model`) ) CREATE TABLE `sample_submission` ( `device_id` INTEGER NOT NULL, `F23-` REAL DEFAULT NULL, `F24-26` REAL DEFAULT NULL, `F27-28` REAL DEFAULT NULL, `F29-32` REAL DEFAULT NULL, `F33-42` REAL DEFAULT NULL, `F43+` REAL DEFAULT NULL, `M22-` REAL DEFAULT NULL, `M23-26` REAL DEFAULT NULL, `M27-28` REAL DEFAULT NULL, `M29-31` REAL DEFAULT NULL, `M32-38` REAL DEFAULT NULL, `M39+` REAL DEFAULT NULL, PRIMARY KEY (`device_id`) )
na
1,082
1,082
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 is the device model of the device used by the oldest user?
oldest user refers to MAX(age);
SELECT device_model FROM phone_brand_device_model2 WHERE device_id IN ( SELECT device_id 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 `phone_brand_device_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,083
1,083
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` )
[ "IN", "SELECT", "FROM", "MAX" ]
8
simple
{ "case_1": [ 306, 555, 1026 ], "case_2": [ 306, 555, 1026 ], "case_3": [ 306, 555, 842, 1026, 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": [ 7, 22, 31, 35, 72, 106, 109, 119, 123, 140, 166, 200, 207, 219, 241, 270, 306, 341, 386, 393, 399, 410, 466, 498, 514, 529, 555, 557, 565, 630, 633, 635, 642, 663, 817, 820, 842, 845, 851, 856, 872, 874, 903, 932, 948, 984, 1026, 1028, 1073, 1108, 1118, 1138 ] }
talkingdata
To which user group do most of the users who uses a vivo device belong?
user group where most of the users belong refers to MAX(COUNT(group)); vivo device refers to phone_brand = 'vivo';
SELECT T.`group` FROM ( SELECT T2.`group`, COUNT(`group`) AS num FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T1.phone_brand = 'vivo' GROUP BY T2.`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,084
1,084
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
How many app users belong to the category of Securities?
SELECT COUNT(T1.app_id) FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T2.label_id = T1.label_id WHERE T2.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,085
1,085
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
To which categories does app user no.1977658975649780000 belong?
app no. refers to app_id; app_id = 1977658975649780000;
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 = 1977658975649780000
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,086
1,086
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
Please list the categories of the app users who are not active when event no.2 happened.
not active refers to is_active = 0; event no. refers to event_id; event_id = 2;
SELECT DISTINCT T1.category 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
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,087
1,087
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", "FROM" ]
10
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 88, 143, 160, 187, 188, 189, 228, 244, 260, 319, 357, 382, 424, 445, 484, 515, 595, 608, 611, 671, 675, 687, 756, 768, 839, 849, 938, 1067, 1094 ], "case_4": [ 88, 110, 143, 157, 160, 187, 188, 189, 222, 228, 244, 253, 260, 306, 319, 357, 382, 424, 445, 484, 506, 515, 554, 555, 595, 608, 611, 671, 675, 687, 737, 756, 768, 839, 842, 849, 938, 1026, 1067, 1094, 1138 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 510, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
talkingdata
Please list the location coordinates of all the devices with an inactive app user when event no.2 happened.
location coordinates = longitude, latitude; inactive refers to is_active = 0; event no. refers to event_id; event_id = 2;
SELECT DISTINCT T2.longitude, T2.latitude FROM app_events AS T1 INNER JOIN events AS T2 ON T2.event_id = T1.event_id WHERE T2.event_id = 2 AND T1.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 `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,088
1,088
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, `longitude` REAL DEFAULT NULL, `latitude` REAL DEFAULT NULL, PRIMARY KEY `event_id` )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
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, 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
Among all the times event no.2 happened when the app user was not active, when was the earliest time this situation happened?
event no. refers to event_id; event_id = 2; not active refers to is_active = 0; earliest time refers to MIN(timestamp);
SELECT T2.timestamp FROM app_events AS T1 INNER JOIN events AS T2 ON T2.event_id = T1.event_id WHERE T1.is_active = 0 AND T2.event_id = 2 ORDER BY T2.timestamp LIMIT 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,089
1,089
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, `timestamp` DATETIME DEFAULT NULL, PRIMARY KEY `event_id` )
[ "AS", "AND", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "FROM" ]
9
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, 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, 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, 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, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 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, 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, 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, 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, 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, 1004, 1005, 1006, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
talkingdata
Please list the IDs of the events happened on all the vivo devices.
IDs of the events refers to event_id; vivo devices refers to phone_brand = 'vivo';
SELECT T2.event_id FROM phone_brand_device_model2 AS T1 INNER JOIN events AS T2 ON T2.device_id = T1.device_id WHERE T1.phone_brand = 'vivo'
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,090
1,090
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
Among the devices with event no.2 happening, how many of them are vivo devices?
event no. refers to event_id; event_id = 2; vivo devices refers to phone_brand = 'vivo';
SELECT COUNT(T1.device_id) FROM phone_brand_device_model2 AS T1 INNER JOIN events AS T2 ON T2.device_id = T1.device_id WHERE T1.phone_brand = 'vivo' AND T2.event_id = 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,091
1,091
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", "INNER JOIN", "ON", "COUNT", "FROM" ]
8
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, 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
Please list the time when event no.2 happened on a vivo device.
time refers to timestamp; event no. refers to event_id; event_id = '2'; vivo device refers to phone_brand = 'vivo';
SELECT T1.timestamp FROM events AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.event_id = T2.device_id WHERE T2.phone_brand = 'vivo' AND T1.event_id = '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,092
1,092
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 `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
How many events in total have happened on all the vivo devices in the year 2016?
vivo devices refers to phone_brand = 'vivo'; in the year 2016 refers to year(timestamp) = 2016;
SELECT COUNT(T1.event_id) FROM events AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.event_id = T2.device_id WHERE STRFTIME('%Y', T1.timestamp) = '2016' AND T2.phone_brand = 'vivo'
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,093
1,093
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 `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" ]
9
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, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 510, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 718, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 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 uses a vivo device, how many of them are female and under 30?
vivo device refers to phone_brand = 'vivo'; female refers to gender = 'F'; 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 T1.gender = 'F' AND T2.phone_brand = 'vivo' 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,094
1,094
CREATE TABLE `gender_age` ( CREATE TABLE `gender_age` `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, PRIMARY KEY `device_id`, FOREIGN KEY `device_id` REFERENCES `phone_brand_device_model2` `device_id` ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `phone_brand_device_model2` ( CREATE TABLE `phone_brand_device_model2` `device_id` INTEGER NOT NULL, `phone_brand` TEXT NOT NULL, `device_model` TEXT NOT NULL, PRIMARY KEY `device_id`, `phone_brand`, `device_model` )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
9
simple
{ "case_1": [ 88, 160, 515, 608, 671, 687, 849 ], "case_2": [ 88, 160, 188, 319, 445, 515, 595, 608, 671, 687, 849 ], "case_3": [ 88, 143, 160, 187, 188, 189, 228, 244, 260, 319, 357, 382, 424, 445, 484, 515, 554, 595, 608, 611, 671, 675, 687, 756, 768, 839, 849, 938, 1067, 1094 ], "case_4": [ 88, 110, 143, 157, 160, 187, 188, 189, 222, 228, 244, 253, 260, 306, 319, 357, 382, 424, 445, 484, 506, 515, 554, 555, 595, 608, 611, 671, 675, 687, 737, 756, 768, 839, 842, 849, 938, 1026, 1067, 1094, 1138 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 109, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 230, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 259, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 399, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 509, 510, 511, 512, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 554, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 618, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 665, 666, 667, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 680, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 692, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 707, 710, 711, 712, 714, 715, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 730, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 817, 818, 819, 820, 822, 823, 824, 825, 827, 828, 829, 830, 831, 832, 833, 834, 835, 837, 838, 839, 841, 843, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 903, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 945, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 965, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1019, 1020, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1078, 1079, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1126, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
talkingdata
What is the category that the most app users belong to?
most app users refers to MAX(COUNT(app_id));
SELECT T.category FROM ( SELECT T1.category, COUNT(T2.app_id) AS num FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id GROUP BY T1.label_id ) AS T ORDER BY T.num DESC LIMIT 1
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,095
1,095
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
What is the brand of the device used by the youngest female user?
brand of the device refers to phone_brand; youngest refers to MIN(age); female refers to gender = 'F';
SELECT phone_brand FROM phone_brand_device_model2 WHERE device_id IN ( SELECT * FROM ( SELECT device_id FROM gender_age WHERE gender = 'F' ORDER BY age LIMIT 1 ) AS T )
CREATE TABLE `gender_age` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`), FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `phone_brand_device_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,096
1,096
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", "IN", "FROM" ]
10
simple
{ "case_1": [ 555 ], "case_2": [ 188, 319, 445, 555, 595 ], "case_3": [ 187, 188, 319, 445, 555, 595, 611, 768, 1067, 1094 ], "case_4": [ 88, 110, 143, 157, 160, 187, 188, 189, 222, 228, 244, 253, 260, 306, 319, 357, 382, 424, 445, 484, 506, 515, 554, 555, 595, 608, 611, 671, 675, 687, 737, 756, 768, 839, 842, 849, 938, 1026, 1067, 1094, 1138 ], "case_5": [ 1, 7, 10, 11, 13, 15, 17, 20, 22, 28, 29, 36, 38, 49, 55, 59, 62, 69, 73, 75, 78, 86, 89, 106, 108, 119, 121, 125, 133, 138, 140, 150, 159, 162, 163, 166, 167, 173, 174, 179, 181, 185, 187, 188, 199, 200, 202, 206, 207, 208, 213, 219, 229, 233, 239, 247, 252, 262, 263, 275, 278, 281, 285, 286, 291, 309, 311, 313, 314, 319, 320, 324, 329, 334, 336, 337, 341, 342, 345, 348, 349, 352, 353, 356, 359, 364, 365, 371, 373, 378, 379, 381, 385, 393, 394, 395, 400, 403, 404, 409, 411, 428, 429, 434, 435, 444, 445, 451, 454, 460, 462, 469, 482, 495, 497, 505, 514, 530, 532, 534, 536, 538, 542, 548, 552, 555, 560, 566, 567, 576, 578, 579, 583, 584, 586, 590, 592, 595, 611, 619, 621, 625, 626, 630, 634, 637, 638, 645, 654, 657, 659, 663, 664, 665, 669, 681, 688, 690, 691, 698, 701, 703, 708, 713, 719, 732, 733, 735, 748, 752, 759, 760, 768, 778, 790, 803, 810, 815, 818, 823, 827, 830, 836, 850, 851, 861, 866, 869, 874, 876, 886, 889, 891, 893, 901, 911, 918, 927, 929, 934, 946, 950, 951, 953, 954, 956, 962, 963, 966, 967, 970, 972, 973, 975, 977, 981, 983, 987, 989, 994, 1004, 1005, 1006, 1010, 1013, 1017, 1024, 1025, 1030, 1034, 1037, 1038, 1047, 1049, 1050, 1051, 1056, 1057, 1065, 1067, 1068, 1075, 1076, 1077, 1083, 1094, 1124, 1137, 1139, 1141 ] }
talkingdata
How many users in user group M23-26 use a vivo device?
user group M23-26 refers to group = 'M23-26'; vivo device refers to phone_brand = 'vivo';
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` = 'M23-26' AND 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,097
1,097
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
Among all the users who use a vivo device, what is the percentage of the users in the M23-26 user group?
vivo device refers to phone_brand = 'vivo'; percentage = MULTIPLY(DIVIDE(COUNT(phone_brand = 'vivo WHERE group = 'M23-26), COUNT(phone_brand = 'vivo)), 100); M23-26 user group refers to group = 'M23-26';
SELECT SUM(IIF(T1.`group` = 'M23-26', 1.0, 0)) / COUNT(T1.device_id) AS per FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'vivo'
CREATE TABLE `gender_age` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`), FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `phone_brand_device_model2` ( `device_id` INTEGER NOT NULL, `phone_brand` TEXT NOT NULL, `device_model` TEXT NOT NULL, PRIMARY KEY (`device_id`,`phone_brand`,`device_model`) )
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ) CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `app_events_relevant` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER DEFAULT NULL, `is_active` INTEGER DEFAULT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `app_labels` ( `app_id` INTEGER NOT NULL, `label_id` INTEGER NOT NULL, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `events` ( `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME DEFAULT NULL, `longitude` REAL DEFAULT NULL, `latitude` REAL DEFAULT NULL, PRIMARY KEY (`event_id`) ) CREATE TABLE `events_relevant` ( `event_id` INTEGER NOT NULL, `device_id` INTEGER DEFAULT NULL, `timestamp` DATETIME NOT NULL, `longitude` REAL NOT NULL, `latitude` REAL NOT NULL, PRIMARY KEY (`event_id`), FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `gender_age` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`), FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE ) CREATE TABLE `gender_age_test` ( `device_id` INTEGER NOT NULL, PRIMARY KEY (`device_id`) ) CREATE TABLE `gender_age_train` ( `device_id` INTEGER NOT NULL, `gender` TEXT DEFAULT NULL, `age` INTEGER DEFAULT NULL, `group` TEXT DEFAULT NULL, PRIMARY KEY (`device_id`) ) CREATE TABLE `label_categories` ( `label_id` INTEGER NOT NULL, `category` TEXT DEFAULT NULL, PRIMARY KEY (`label_id`) ) CREATE TABLE `phone_brand_device_model2` ( `device_id` INTEGER NOT NULL, `phone_brand` TEXT NOT NULL, `device_model` TEXT NOT NULL, PRIMARY KEY (`device_id`,`phone_brand`,`device_model`) ) CREATE TABLE `sample_submission` ( `device_id` INTEGER NOT NULL, `F23-` REAL DEFAULT NULL, `F24-26` REAL DEFAULT NULL, `F27-28` REAL DEFAULT NULL, `F29-32` REAL DEFAULT NULL, `F33-42` REAL DEFAULT NULL, `F43+` REAL DEFAULT NULL, `M22-` REAL DEFAULT NULL, `M23-26` REAL DEFAULT NULL, `M27-28` REAL DEFAULT NULL, `M29-31` REAL DEFAULT NULL, `M32-38` REAL DEFAULT NULL, `M39+` REAL DEFAULT NULL, PRIMARY KEY (`device_id`) )
na
1,098
1,098
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", "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, 173, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
talkingdata
Among all the devices with event no.2 happening, what is the percentage of the device being a vivo phone?
event no. refers to event_id; event_id = '2'; percentage = SUM(IF(phone_brand = 'vivo',1,0)), COUNT(device_id) WHERE event_id = '2'; vivo phone refers to phone_brand = 'vivo';
SELECT SUM(IIF(T2.phone_brand = 'vivo', 1, 0)) / COUNT(T1.device_id) AS per FROM events AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.event_id = T2.device_id WHERE T1.event_id = '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,099
1,099
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", "SUM", "INNER JOIN", "ON", "COUNT", "FROM" ]
9
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, 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 all the vivo device users?
average age = AVG(age); vivo device refers to phone_brand = 'vivo';
SELECT AVG(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'
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,100
1,100
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", "AVG", "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, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }