db_id
stringclasses
69 values
question
stringlengths
24
325
evidence
stringlengths
1
673
SQL
stringlengths
23
804
schema
stringclasses
69 values
computer_student
What is the average number of courses taught by a professor?
professor refers to professor = 1; average number of courses = divide(count(taughtBy.course_id), count(taughtBy.p_id) where professor = 1 )
SELECT CAST(COUNT(T1.course_id) AS REAL) / COUNT(DISTINCT T2.p_id) AS num FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = 1
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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'
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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'
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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'
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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'
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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'
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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'
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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 )
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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'
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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'
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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'
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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 )
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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'
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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'
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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
database name:db_id computer_student course table course Cols: course id dtype integer, course level dtype text, person table person Cols: person ID dtype integer, professor dtype integer, student dtype integer, has position dtype text, in phase dtype text, years in program dtype text, advisedBy table advisedBy Cols: person id dtype integer, person id dummy dtype integer, taughtBy table taughtBy Cols: course ID dtype integer, person ID dtype integer,
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 )
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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 )
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
talkingdata
How many users are there in the Home Decoration category?
null
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 name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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%'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
talkingdata
How many users belong to the MOBA category?
null
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 name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
talkingdata
What are the labels' IDs of online shopping and online malls categories?
null
SELECT label_id FROM label_categories WHERE category IN ('online shopping', 'online malls')
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
talkingdata
Describe the device user gender and age of the event ID of 15251.
null
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 name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
talkingdata
List the included categories in the event ID of 155.
null
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 name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
talkingdata
How many app IDs were included under science fiction category?
null
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 name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
talkingdata
How many device users are male?
male refers to gender = 'M';
SELECT COUNT(device_id) FROM gender_age WHERE gender = 'M'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
talkingdata
What is the age of the oldest device user?
oldest device user refers to MAX(age);
SELECT MAX(age) FROM gender_age
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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 ) )
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
talkingdata
How many app users belong to the category of Securities?
null
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 name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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 )
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,
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'
database name:db_id talkingdata app_all table app_all Cols: app_id dtype integer, app_events table app_events Cols: event id dtype integer, app id dtype integer, is installed dtype integer, is active dtype integer, app_events_relevant table app_events_relevant Cols: event_id dtype integer, app_id dtype integer, is_installed dtype integer, is_active dtype integer, app_labels table app_labels Cols: app id dtype integer, label id dtype integer, events table events Cols: event id dtype integer, device id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, events_relevant table events_relevant Cols: event_id dtype integer, device_id dtype integer, timestamp dtype datetime, longitude dtype real, latitude dtype real, gender_age table gender_age Cols: device id dtype integer, gender dtype text, age dtype integer, group dtype text, gender_age_test table gender_age_test Cols: device_id dtype integer, gender_age_train table gender_age_train Cols: device_id dtype integer, gender dtype text, age dtype integer, group dtype text, label_categories table label_categories Cols: label id dtype integer, category dtype text, phone_brand_device_model2 table phone_brand_device_model2 Cols: device id dtype integer, phone brand dtype text, device model dtype text, sample_submission table sample_submission Cols: device_id dtype integer, F23- dtype real, F24-26 dtype real, F27-28 dtype real, F29-32 dtype real, F33-42 dtype real, F43+ dtype real, M22- dtype real, M23-26 dtype real, M27-28 dtype real, M29-31 dtype real, M32-38 dtype real, M39+ dtype real,