db_id
stringclasses
68 values
question
stringlengths
24
325
evidence
stringlengths
0
580
SQL
stringlengths
23
728
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
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
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
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'
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'
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
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
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
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
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'
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
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
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'
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
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'
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
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'
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
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
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 )
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'
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
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
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'
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
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
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'
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 )
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'
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'
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
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'
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
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'
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'
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'
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'
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'
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
talkingdata
How many device users are male?
male refers to gender = 'M';
SELECT COUNT(device_id) FROM gender_age WHERE gender = 'M'
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'
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'
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'
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
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
talkingdata
How many users installed the app but are not active?
installed refers to is_installed = 1; not active refers to is_active = 0;
SELECT COUNT(app_id) FROM app_events WHERE is_installed = 1 AND is_active = 0
talkingdata
How many models does the VIVO phone brand released?
models refers to device_model;
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE phone_brand = 'vivo'
talkingdata
How many users belong to "Financial Information" category?
SELECT COUNT(T1.app_id) FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id WHERE T2.category = 'Financial Information'
talkingdata
How many users belong to "game-Art Style" category?
SELECT COUNT(T1.app_id) FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id WHERE T2.category = 'game-Art Style'
talkingdata
Provide the total number of the male users that use OPPO as their phone brand.
male refers to gender = 'Male';
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'OPPO' AND T1.gender = 'M'
talkingdata
How many male users use the Galaxy Ace Plus model?
male refers to gender = 'M'; Galaxy Ace Plus refers to device_model = 'Galaxy Ace Plus';
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Galaxy Ace Plus' AND T1.gender = 'M'
talkingdata
Give the number of device models for "中兴" phone brand.
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE device_model = '中兴'
talkingdata
Give the number of "game-Fishing" apps.
game-Fishing refers to category = 'game-Fishing';
SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T1.category = 'game-Fishing'
talkingdata
Give the number of female users of "E派" brand devices.
female refers to gender = 'F'; E派 brand refers to phone_brand = 'E派';
SELECT COUNT(T2.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'F' AND T2.phone_brand = 'E派'
talkingdata
How many male users of the "Galaxy S5" device model?
male refers to gender = 'M';
SELECT COUNT(T1.device_id) FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T1.device_model = 'Galaxy S5' AND T2.gender = 'M'
talkingdata
For the event which happened at 14:09:49 on 2016/5/6, in the location coordinate(116, 40), how many apps were active?
at 14:09:49 on 2016/5/6 refers to timestamp = '2016/5/6 14:09:49'; location coordinate(116, 40) refers to longitude = '116' AND latitude = '40'; active refers to is_active = '1';
SELECT COUNT(T1.app_id) FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id WHERE T2.timestamp = '2016-05-06 14:09:49' AND T1.is_active = '1' AND T2.longitude = '116' AND T2.latitude = '40'
talkingdata
How many devices are of the brand vivo?
brand vivo refers to phone_brand = 'vivo';
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE phone_brand = 'vivo'
talkingdata
Among the female users of the devices, how many of them are over 30?
female refers to gender = 'F'; over 30 refers to age > 30;
SELECT COUNT(device_id) FROM gender_age WHERE age > 30 AND gender = 'F'
talkingdata
Among the app users who were not active when event no.2 happened, how many of them belong to the category Property Industry 1.0?
not active refers to is_active = 0; event no. refers to event_id; event_id = 2;
SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id INNER JOIN app_events AS T3 ON T2.app_id = T3.app_id WHERE T3.is_active = 0 AND T1.category = 'Property Industry 1.0' AND T3.event_id = 2
talkingdata
How many categories in total do the app users who were not active when event no.2 happened belong to?
not active refers to is_active = 0; event no. refers to event_id; event_id = 2;
SELECT COUNT(*) FROM ( SELECT COUNT(DISTINCT T1.category) AS result FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id INNER JOIN app_events AS T3 ON T2.app_id = T3.app_id WHERE T3.event_id = 2 AND T3.is_active = 0 GROUP BY T1.category ) T
talkingdata
Among the devices on which an event happened on 2016/5/1, how many of them are used by a male user?
on 2016/5/1 refers to timestamp = '2016-05-01'; male refers to gender = 'M';
SELECT COUNT(T1.device_id) FROM events AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T1.timestamp = '2016-05-01' AND T2.gender = 'M'
talkingdata
How many events did the device ID "3915082290673130000" join?
SELECT COUNT(event_id) FROM events WHERE device_id = 3915082290673130000
talkingdata
How many events were participated by the users at longitude of "-156"?
SELECT COUNT(event_id) FROM events WHERE longitude = -156
talkingdata
How many app users belong to label ID of "48"?
SELECT COUNT(app_id) FROM app_labels WHERE label_id = 48
talkingdata
How many category names start with the word "game"?
category names refers to category; start with the word game refers to category like 'game%';
SELECT COUNT(label_id) FROM label_categories WHERE category LIKE 'game%'
talkingdata
Provide the number of events participated by the device users at coordinates of (80,37).
coordinates of (80,37) refers to longitude = 80 and latitude = 37;
SELECT COUNT(event_id) FROM events WHERE longitude = 80 AND latitude = 37
talkingdata
How many active users are there in the event?
active refers to is_active = 1;
SELECT COUNT(app_id) FROM app_events WHERE is_active = 1
talkingdata
How many devices belong to model "A51"?
model refers to device_model; device_model = 'A51';
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE device_model = 'A51'
talkingdata
How many labels belong to the game-card category?
labels refers to label_id;
SELECT COUNT(label_id) FROM label_categories WHERE category = 'game-card'
talkingdata
How many users who are under 30 years old use device model of Galaxy Note 2?
under 30 refers to age < 30;
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Galaxy Note 2' AND T1.age < 30
talkingdata
How many female users use device model of MI 3?
female refers to gender = 'F';
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'F' AND T2.device_model = 'MI 3'
talkingdata
Among the male users, how many users use device model of Desire 820?
male refers to gender = 'M';
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Desire 820' AND T1.gender = 'M'
talkingdata
Among the users who are above 20, how many users use device model of ELIFE E7 Mini?
above 20 refers to age > 20;
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'ELIFE E7 Mini' AND T1.age > 20
talkingdata
State the number of users who are under 50 and above 20 use device model of Galaxy Premier.
under 50 and above 20 refers to age BTWEEEN 20 AND 50;
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.age BETWEEN 20 AND 50 AND T2.device_model = 'Galaxy Premier'
talkingdata
Give the number of male users who use phone branded HTC.
male refers to gender = 'M';
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'M' AND T2.phone_brand = 'HTC'
talkingdata
How many users who are between 20 and 60 use phone brand of TCL?
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.age BETWEEN 20 AND 60 AND T2.phone_brand = 'TCL'
talkingdata
How many different models does the HTC brand have?
models refers to device_model; HTC brand refers to phone_brand = 'HTC';
SELECT COUNT(device_model) FROM phone_brand_device_model2 WHERE phone_brand = 'HTC'
talkingdata
How many apps are labeled 7?
labeled 7 refers to label_id = 7;
SELECT COUNT(app_id) FROM app_labels WHERE label_id = 7
talkingdata
How many men under the age of 23 have apps installed but are not active on their devices?
men refers to gender = 'M'; under the age of 23 refers to age < 23; installed refers to is_installed = 1; not active refers to is_active = 0;
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id INNER JOIN app_events_relevant AS T3 ON T2.event_id = T3.event_id WHERE T1.gender = 'M' AND T3.is_active = 0 AND T1.age < 23
talkingdata
How many women have apps from the game-Finding fault category installed on their device?
women refers to gender = 'F'; installed refers to is_installed = 1;
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id INNER JOIN app_events_relevant AS T3 ON T2.event_id = T3.event_id WHERE T1.age < 23 AND T1.gender = 'F' AND T3.is_active = 0 AND T3.is_installed = 1
talkingdata
How many people over the age of 50 do not have HTC One M8 Eye phones?
over the age of 50 refers to age > 50; do not have HTC One M8 Eye phones refers to phone_brand ! = 'HTC' AND device_model ! = 'One M8 Eye';
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.age > 50 AND T2.device_model != 'One M8 Eye' AND T2.phone_brand != 'HTC'
talkingdata
How many users belong to the same behavior category as comics?
behavior category refers to category; category = 'comics';
SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T1.category = 'comics'
talkingdata
How many male users have the log of events at the same longitude of 114?
male refers to gender = 'M';
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T2.longitude = 114 AND T1.gender = 'M'
talkingdata
How many OPPO devices are there?
OPPO devices refers to phone_brand = 'OPPO';
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE phone_brand = 'OPPO'
talkingdata
How many events does the device "4069764298338760000" have?
SELECT COUNT(event_id) FROM events WHERE device_id = 4069764298338760000
talkingdata
How many of the apps belong in the "Equity Fund" category?
SELECT COUNT(T1.app_id) FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id WHERE T2.category = 'Equity Fund'
talkingdata
How many male users have a Galaxy Note 3?
male refers to gender = 'M'; Galaxy Note 3 refers to device_model = 'Galaxy Note 3';
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Galaxy Note 3' AND T1.gender = 'M'
law_episode
Please list all the keywords of the episode "Refuge: Part 1".
episode "Refuge: Part 1" refers to title = 'Refuge: Part 1'
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Refuge: Part 1'
law_episode
How many keywords are there for season 9, episode 23 of law_and_order?
SELECT COUNT(T2.keyword) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.season = 9 AND T1.episode = 23
law_episode
What is the title of the episode with the keyword "laundering money"?
keyword "laundering money" refers to keyword = 'laundering money'
SELECT T1.title FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.keyword = 'laundering money'
law_episode
Please list all the keywords for the episodes with a rating of over 8.
a rating of over 8 refers to rating > 8
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.rating > 8
law_episode
How many 10-star votes were given to the episode titled "Cherished"?
10-star vote refers to stars = 10; titled "Cherished" refers to title = 'Cherished'
SELECT T2.votes FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Cherished' AND T2.stars = 10
law_episode
How many votes did the episode titled "Cherished" get in total?
titled "Cherished" refers to title = 'Cherished'
SELECT SUM(T2.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Cherished'
law_episode
What is the title of the episode that got the most 10-star votes?
the most refers to max(votes); 10-star refers to stars = 10
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10 ORDER BY T2.votes DESC LIMIT 1
law_episode
Park Dietz was credited in which role in the episode titled "Cherished"?
credited refers to credited = 'true'; titled "Cherished" refers to title = 'Cherished'
SELECT T2.role FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.title = 'Cherished' AND T3.name = 'Park Dietz' AND T2.credited = 'true'
law_episode
How many people had filled a role in the episode titled "Cherished", but did not show up in the on-screen credits?
titled "Cherished" refers to title = 'Cherished'; did not show up in the on-screen credits refers to credited = ''
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Cherished' AND T2.credited = 'false'
law_episode
Who was credited as "technical advisor" in the episode titled "Cherished"?
who refers to name; credited refers to credited = 'true'; as "technical advisor" refers to role = 'technical advisor'; titled "Cherished" refers to title = 'Cherished'
SELECT T3.name FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.title = 'Cherished' AND T2.credited = 'true' AND T2.role = 'technical advisor'
law_episode
For how many times was Park Dietz credited?
credited refers to credited = 'true'
SELECT COUNT(T3.person_id) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T2.credited = 'true' AND T3.name = 'Park Dietz'
law_episode
Please list the titles of all the episodes in which Park Dietz was credited.
credited refers to credited = 'true'
SELECT T1.title FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T2.credited = 'true' AND T3.name = 'Park Dietz'
law_episode
Was Anthony Azzara's role in episode tt0629204 displayed in the credits at the end of the episode?
episode tt0629204 refers to episode_id = 'tt0629204'; credited refers to credited = 'true'; not credited refers to credited = ''
SELECT T1.credited FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'Anthony Azzara' AND T1.episode_id = 'tt0629204'