Chinastark/bird_dataset huggingface dataset:
Database: computer_student
Question: How many professors teaches basic or medium undergraduate courses?
Evidence: professors refers to taughtBy.p_id; basic or medium undergraduate courses refers to couresLevel = 'Level_300'
SQL: SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_300'
Database: computer_student
Question: Among the students being advised by advisors, which students' year in the program do the advisors advise the majority of?
Evidence: students refers to student = 1; students' year in the program do the advisors advise the majority of refers to max(count(yearsInProgram))
SQL: 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
Database: computer_student
Question: How many students that are undergoing the pre-phase of qualification have advisors?
Evidence: students refers to student = 1 and ; undergoing the phase of pre-qualification refers to inPhase = 'Pre-Quals'; have advisors refers to advisedBy.p_id
SQL: 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
Database: computer_student
Question: What is the average number of professional or master/undergraduate courses being taught by each professor?
Evidence: professional or master/undergraduate courses refers to courseLevel = 'Level_500'; average number = divide(count(taughtBy.course_id), count(taughtBy.p_id))
SQL: 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'
Database: computer_student
Question: How many courses were taught by more than 4 people?
Evidence: courses refers to taughtBy.course_id; more than 4 people refers to count(taughtBy.p_id) > 4
SQL: SELECT COUNT(*) FROM ( SELECT COUNT(course_id) FROM taughtBy GROUP BY course_id HAVING COUNT(course_id) > 4 )
Database: computer_student
Question: What is the total of professional courses available at the university? List out all the course id.
Evidence: professional courses refers to courseLevel = 'Level_500'; course id refers to course.course_id
SQL: SELECT COUNT(course_id) FROM course WHERE courseLevel = 'Level_500'
Database: computer_student
Question: What is the sum of year 1 and year 2 students?
Evidence: year 1 and year 2 students refers to yearsInProgram = 'Year_1' and yearsInProgram = 'Year_2' and student = 1
SQL: SELECT COUNT(*) FROM person WHERE yearsInProgram = 'Year_1' OR yearsInProgram = 'Year_2'
Database: computer_student
Question: How many courses were taught by a professor who is currently the member of faculty?
Evidence: professor refers to professor = 1;  member of faculty refers to hasPosition <> 0
SQL: 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
Database: computer_student
Question: Which professor taught the most courses and what is the position of this person in the university?
Evidence: professor refers to taughtBy.p_id; most courses refers to max(taughtBy.p_id); position refers to hasPosition
SQL: 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
Database: computer_student
Question: Which courses were taught by a professor who is not a faculty member?
Evidence: courses refers to taughtBy.course_id; professor refers to professor = 1; is not a faculty member refers to hasPosition = 0
SQL: 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
Database: computer_student
Question: Which member of the faculty are teaching the most courses and what is his/her general course level?
Evidence: member of the faculty refers to hasPosition <> 0, most courses refers to max(count(course.course_id))
SQL: 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
Database: talkingdata
Question: What is the device id of the oldest user?
Evidence: oldest user refers to MAX(age);
SQL: SELECT device_id FROM gender_age WHERE age = ( SELECT MAX(age) FROM gender_age )
Database: talkingdata
Question: How many events were held at coordinate 97,40?
Evidence: coordinate 97,40 refers to longitude = 97 AND latitude = 40;
SQL: SELECT COUNT(event_id) FROM `events` WHERE latitude = 40 AND longitude = 97
Database: talkingdata
Question: How many male users are in the age group of M32-38?
Evidence: male refers to gender = 'M'; age group refers to group; `group` = 'M32-38';
SQL: SELECT COUNT(gender) FROM gender_age WHERE gender = 'M' AND `group` = 'M32-38'
Database: talkingdata
Question: How many female users over the age of 50 are there?
Evidence: female refers to gender = 'F'; over the age of 50 refers to age > 50;
SQL: SELECT COUNT(gender) FROM gender_age WHERE age > 50 AND gender = 'F'
Database: talkingdata
Question: How many active users were there in the event id 2?
Evidence: active users refers to is_active = 1;
SQL: SELECT COUNT(is_active) FROM app_events WHERE event_id = 2 AND is_active = 1
Database: talkingdata
Question: What is the gender of the youngest user?
Evidence: youngest user refers to MIN(age);
SQL: SELECT gender FROM gender_age WHERE age = ( SELECT MIN(age) FROM gender_age )
Database: talkingdata
Question: What is the name of the category which most users belong to?
Evidence: most users belong to refers to MAX(COUNT(app_id)); name of category refers to category;
SQL: 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
Database: talkingdata
Question: What is the model of the oldest user's device?
Evidence: model of the device refers to device_model; oldest user refers to MAX(age);
SQL: 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
Database: talkingdata
Question: How many users are there in the Home Decoration category?
SQL: 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'
Database: talkingdata
Question: How many male users are active in the events held on 5/1/2016?
Evidence: male refers to gender = 'M'; active refers to is_active = 1; on 5/1/2016 refers to timestamp LIKE '2016-05-01%';
SQL: 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%'
Database: talkingdata
Question: How many female users use ZenFone 5 devices?
Evidence: female refers to gender = 'F'; ZenFone 5 refers to device_model = 'ZenFone 5';
SQL: 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'
Database: talkingdata
Question: What is the age of the oldest active user that participated in the event held on 5/6/2016 at coordinates 121, 31?
Evidence: 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;
SQL: 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
Database: talkingdata
Question: What is the most common device model among female users between the ages 27 to 28?
Evidence: 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';
SQL: 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
Database: talkingdata
Question: What are the categories of the top 2 oldest events?
Evidence: oldest event refers to MIN(timestamp);
SQL: 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
Database: talkingdata
Question: What is the gender of the majority of Vivo phone users?
Evidence: majority of Vivo phone users refers to MAX(COUNT(phone_brand = 'vivo'));
SQL: 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
Database: talkingdata
Question: Which category has the highest number of users?
Evidence: highest number of users refers to MAX(COUNT(app_id));
SQL: 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
Database: talkingdata
Question: How many users belong to the MOBA category?
SQL: 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'
Database: talkingdata
Question: What is the percentage of female OPPO users against the male OPPO users?
Evidence: 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';
SQL: 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'
Database: talkingdata
Question: What were the locations of the events on 8th May, 2016?
Evidence: location = longitude, latitude; on 8th May, 2016 refers to `timestamp` LIKE '2016-05-08%';
SQL: SELECT longitude, latitude FROM `events` WHERE SUBSTR(`timestamp`, 1, 10) = '2016-05-08'
Database: talkingdata
Question: List the app users IDs and installed status for the event ID of 844.
Evidence: 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;
SQL: SELECT app_id , IIF(is_installed = 1, 'YES', 'NO') AS status FROM app_events WHERE event_id = 844
Database: talkingdata
Question: How many events were there on 30th April, 2016?
Evidence: on 30th April, 2016 refers to `timestamp` LIKE '2016-04-30%';
SQL: SELECT COUNT(event_id) FROM events WHERE SUBSTR(`timestamp`, 1, 10) = '2016-04-30'
Database: talkingdata
Question: How many users used Vivo Xplay3S model?
Evidence: Vivo Xplay3S model refers to phone_brand = 'vivo' AND device_model = 'Xplay3S';
SQL: SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE device_model = 'Xplay3S' AND phone_brand = 'vivo'
Database: talkingdata
Question: What is the ratio of male and female users in 27-28 age group?
Evidence: 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';
SQL: 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
Database: talkingdata
Question: Describe the phone brands and models of the users who participated in events on 5th May, 2016 at the coordinates of (112,44).
Evidence: 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;
SQL: 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
Database: talkingdata
Question: Provide the app users IDs and time for the event ID of 82.
Evidence: app user IDs refers to app_id; time refers to timestamp;
SQL: 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
Database: talkingdata
Question: Describe the device user gender and age of the event ID of 15251.
SQL: 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
Database: talkingdata
Question: How many events did the 88-years-old male users participate on 4th May,2016?
Evidence: 88-years-old refers to age = 88; male refers to gender = 'M'; on 4th May, 2016 refers to timestamp LIKE '2016-05-04%';
SQL: 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
Database: talkingdata
Question: Describe the ages, genders and numbers of events participated by the users at coordinates of (-102,38).
Evidence: coordinates of (-102,38) refers to longitude = -102, latitude = 38;
SQL: 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
Database: talkingdata
Question: Provide the phone brands and models of the users who were at the coordinates of (80,44).
Evidence: models refers to device_model; coordinates of (80,44) refers to longitude = 80 AND latitude = 44;
SQL: 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
Database: talkingdata
Question: List the included categories in the event ID of 155.
SQL: 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
Database: talkingdata
Question: Among HTC Butterfly phone users, list any five devices' IDs used by females.
Evidence: HTC Butterfly refers to phone_brand = 'HTC' AND device_model = 'Butterfly'; females refers to gender = 'F';
SQL: 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
Database: talkingdata
Question: How many app IDs were included under science fiction category?
SQL: 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'
Database: talkingdata
Question: What are the ages and genders of the LG L70 users?
Evidence: LG L70 refers to phone_brand = 'LG' AND device_model = 'L70';
SQL: 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'
Database: talkingdata
Question: Calculate the percentage of the app user IDs under Industry tag category.
Evidence: percentage = DIVIDE(MULTIPLY(CONCAT(COUNT(app_id WHERE category = 'Industry tag'), 100), COUNT(app_id)),'%');
SQL: 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
Database: talkingdata
Question: 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?
Evidence: 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';
SQL: 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'
Database: talkingdata
Question: How many users of the app were not active when event no.2 happened?
Evidence: not active refers to is_active = 0; event no. refers to event_id; event_id = 2;
SQL: SELECT COUNT(event_id) FROM app_events WHERE event_id = 2 AND is_active = 0
Database: talkingdata
Question: How many events in total have happened on the devices in 2016?
Evidence: in 2016 refers to `timestamp` LIKE '2016%';
SQL: SELECT COUNT(event_id) FROM `events` WHERE SUBSTR(`timestamp`, 1, 4) = '2016'
Database: talkingdata
Question: How many events have happened on device no.29182687948017100 in 2016?
Evidence: device no. refers to device_id; device_id = 29182687948017100; in 2016 refers to `timestamp` LIKE '2016%';
SQL: SELECT COUNT(event_id) FROM `events` WHERE SUBSTR(`timestamp`, 1, 4) = '2016' AND device_id = 29182687948017100
Database: talkingdata
Question: How many device users are male?
Evidence: male refers to gender = 'M';
SQL: SELECT COUNT(device_id) FROM gender_age WHERE gender = 'M'
Database: talkingdata
Question: What is the age of the oldest device user?
Evidence: oldest device user refers to MAX(age);
SQL: SELECT MAX(age) FROM gender_age
Database: talkingdata
Question: Among the female users of the devices, how many of them are under 30?
Evidence: female refers to gender = 'F'; under 30 refers to age < 30;
SQL: SELECT COUNT(device_id) FROM gender_age WHERE age < 30 AND gender = 'F'
Database: talkingdata
Question: Among the users who use a Galaxy Note 2, how many of them are female?
Evidence: Galaxy Note 2 refers to device_model = 'Galaxy Note 2'; female refers to gender = 'F';
SQL: 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'
Database: talkingdata
Question: Please list the ages of all the users who use a Galaxy Note 2.
Evidence: Galaxy Note 2 refers to device_model = 'Galaxy Note 2';
SQL: 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'
Database: talkingdata
Question: What is the device model of the device used by the oldest user?
Evidence: oldest user refers to MAX(age);
SQL: 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 ) )
Database: talkingdata
Question: To which user group do most of the users who uses a vivo device belong?
Evidence: user group where most of the users belong refers to MAX(COUNT(group)); vivo device refers to phone_brand = 'vivo';
SQL: 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
Database: talkingdata
Question: How many app users belong to the category of Securities?
SQL: 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'
Database: talkingdata
Question: To which categories does app user no.1977658975649780000 belong?
Evidence: app no. refers to app_id; app_id = 1977658975649780000;
SQL: 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
Database: talkingdata
Question: Please list the categories of the app users who are not active when event no.2 happened.
Evidence: not active refers to is_active = 0; event no. refers to event_id; event_id = 2;
SQL: 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
Database: talkingdata
Question: Please list the location coordinates of all the devices with an inactive app user when event no.2 happened.
Evidence: location coordinates = longitude, latitude; inactive refers to is_active = 0; event no. refers to event_id; event_id = 2;
SQL: 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
Database: talkingdata
Question: Among all the times event no.2 happened when the app user was not active, when was the earliest time this situation happened?
Evidence: event no. refers to event_id; event_id = 2; not active refers to is_active = 0; earliest time refers to MIN(timestamp);
SQL: 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
Database: talkingdata
Question: Please list the IDs of the events happened on all the vivo devices.
Evidence: IDs of the events refers to event_id; vivo devices refers to phone_brand = 'vivo';
SQL: 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'
Database: talkingdata
Question: Among the devices with event no.2 happening, how many of them are vivo devices?
Evidence: event no. refers to event_id; event_id = 2; vivo devices refers to phone_brand = 'vivo';
SQL: 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
Database: talkingdata
Question: Please list the time when event no.2 happened on a vivo device.
Evidence: time refers to timestamp; event no. refers to event_id; event_id = '2'; vivo device refers to phone_brand = 'vivo';
SQL: 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'
Database: talkingdata
Question: How many events in total have happened on all the vivo devices in the year 2016?
Evidence: vivo devices refers to phone_brand = 'vivo'; in the year 2016 refers to year(timestamp) = 2016;
SQL: 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'
Database: talkingdata
Question: Among the users who uses a vivo device, how many of them are female and under 30?
Evidence: vivo device refers to phone_brand = 'vivo'; female refers to gender = 'F'; under 30 refers to age < 30;
SQL: 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
Database: talkingdata
Question: What is the category that the most app users belong to?
Evidence: most app users refers to MAX(COUNT(app_id));
SQL: 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