db_id
stringclasses
69 values
schema
stringclasses
69 values
m_schema
stringclasses
69 values
question
stringlengths
24
325
sql
stringlengths
23
804
evidence
stringlengths
0
673
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Among the users who use SUGAR, calculate the percentage of those who are above 20 years old.
SELECT SUM(IIF(T1.age > 20, 1, 0)) / COUNT(T1.device_id) AS per FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'SUGAR'
SUGAR refers to phone_brand = 'SUGAR'; percentage = MULTIPLY(DIVIDE(SUM(age > 20), COUNT(device_id)) 1.0); above 20 years old refers to age > 20;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Indicate the location of all the events that occurred on April 30, 2016.
SELECT longitude, latitude FROM events WHERE date(timestamp) = '2016-04-30'
location = longitude, latitude; on April 30, 2016 refers timestamp BETWEEN '2016-04-30 00:00:00' AND '2016-04-30 23:59:59';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
How many different models does the HTC brand have?
SELECT COUNT(device_model) FROM phone_brand_device_model2 WHERE phone_brand = 'HTC'
models refers to device_model; HTC brand refers to phone_brand = 'HTC';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Identify all installed and activated apps by their id.
SELECT app_id FROM app_events WHERE is_active = 1 AND is_installed = 1
installed refers to is_installed = 1; activated refers to is_active = 1; id refers to app_id;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
How many apps are labeled 7?
SELECT COUNT(app_id) FROM app_labels WHERE label_id = 7
labeled 7 refers to label_id = 7;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Identify by their id all the devices that are used by women who are in the age range of 29 to 31 years.
SELECT device_id FROM gender_age_train WHERE age BETWEEN 29 AND 31 AND gender = 'F'
id refers to device_id; women refers to gender = 'F'; age range of 29 to 31 years refers to age between 29 and 31;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Identify by their id all the apps that belong to the game-stress reliever category.
SELECT T2.app_id FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T1.category = 'game-stress reliever'
id refers to device_id;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
On what date were the most events logged on devices for 40-year-old male users?
SELECT T.timestamp FROM ( SELECT T2.timestamp, COUNT(T2.event_id) AS num FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'M' AND T1.age = 40 GROUP BY T2.timestamp ) AS T ORDER BY T.num DESC LIMIT 1
date refers to timestamp; most events refers to MAX(COUNT(event_id)); 40-year-old  refers to age = 40; male refers to gender = 'M';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
On which brand of phone are the most applications installed?
SELECT T.phone_brand FROM ( SELECT T1.phone_brand, COUNT(T4.is_active) AS num FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id INNER JOIN events_relevant AS T3 ON T2.device_id = T3.device_id INNER JOIN app_events_relevant AS T4 ON T3.event_id = T4.event_id WHERE T4.is_acti...
brand of phone refers to phone_brand; most applications are installed refers to MAX(COUNT(is_installed = 1));
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
How many men under the age of 23 have apps installed but are not active on their devices?
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id INNER JOIN app_events_relevant AS T3 ON T2.event_id = T3.event_id WHERE T1.gender = 'M' AND T3.is_active = 0 AND T1.age < 23
men refers to gender = 'M'; under the age of 23 refers to age < 23; installed refers to is_installed = 1; not active refers to is_active = 0;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
How many women have apps from the game-Finding fault category installed on their device?
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id INNER JOIN app_events_relevant AS T3 ON T2.event_id = T3.event_id WHERE T1.age < 23 AND T1.gender = 'F' AND T3.is_active = 0 AND T3.is_installed = 1
women refers to gender = 'F'; installed refers to is_installed = 1;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Which gender logged in the most to an event in the first 10 days of May 2016?
SELECT T.gender FROM ( SELECT T1.gender, COUNT(T1.device_id) AS num FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE date(T2.timestamp) BETWEEN '2016-05-01' AND '2016-05-10' GROUP BY T1.gender ) AS T ORDER BY T.num DESC LIMIT 1
gender that logged in the most refers to MAX(COUNT(gender)); first 10 days of May 2016 refers to timestamp BETWEEN '2016-05-01 00:00:00' AND '2016-05-10 23:59:59';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
What age group is the most using SM-T2558 model phones?
SELECT T.`group` FROM ( SELECT T1.`group`, COUNT(T1.device_id) AS num FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'SM-T2558' GROUP BY T1.`group` ) AS T ORDER BY T.num DESC LIMIT 1
age group using SM-T2558 model phones the most refers to MAX(COUNT(group WHERE device_model = 'SM-T2558')); SM-T2558 model phones refers to device_model = 'SM-T2558';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
How many people over the age of 50 do not have HTC One M8 Eye phones?
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.age > 50 AND T2.device_model != 'One M8 Eye' AND T2.phone_brand != 'HTC'
over the age of 50 refers to age > 50; do not have HTC One M8 Eye phones refers to phone_brand ! = 'HTC' AND device_model ! = 'One M8 Eye';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Locate all events on devices of women under 30 years old.
SELECT T1.device_id FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'F' AND T1.age < 30
locate = longitude, latitude; women refers to gender = 'F'; under 30 years old refers to age < 30;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
What percentage of women do not have applications installed on their mobile with respect to men?
SELECT SUM(IIF(T1.gender = 'F', 1, 0)) / SUM(IIF(T1.gender = 'M', 1, 0)) AS per FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id INNER JOIN app_events_relevant AS T3 ON T2.event_id = T3.event_id WHERE T3.is_installed = 0
percentage = MULTIPLY(DIVIDE(SUM(gender = 'F'), SUM(gender = 'M')), 1.0); women refers to gender = 'F'; not installed refers to is_installed = 0; men refers to gender = 'M';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Calculate the average age of people who have apps installed but are not active on their devices.
SELECT AVG(T1.age) FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id INNER JOIN app_events_relevant AS T3 ON T2.event_id = T3.event_id WHERE T3.is_installed = 1 AND T3.is_active = 0
average age = AVG(age); installed refers to is_installed = 1; not active refers to is_active = 0;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Please list any three events that happened on the 1st of May 2016 that have the same latitude of 31.
SELECT event_id FROM events WHERE timestamp LIKE '2016-05-01%' AND latitude = 31 LIMIT 3
on the 1st of May 2016 refers to timestamp like '2016-05-01%';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Please list any three events that have the longitude and latitude of 0.
SELECT event_id FROM events WHERE longitude = 0 AND latitude = 0 LIMIT 3
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
What is the difference between the events of device number -9222956879900150000 that can be located and those that are unable to be located?
SELECT SUM(IIF(latitude != 0 AND longitude != 0, 1, 0)) - SUM(IIF(latitude = 0 AND longitude = 0, 1, 0)) AS diff FROM events WHERE device_id = '-922956879900150000'
difference = SUBTRACT(SUM(latitude! = 0 and longitude! = 0), SUM(latitude = 0 and longitude = 0)); device number refers to device_id; device_id = -922956879900150000; can be location refers to latitude ! = 0 and longitude ! = 0; unable to be location refers to latitude = 0 and longitude = 0;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Please list any three devices that are owned by female users.
SELECT device_id FROM gender_age WHERE gender = 'F' LIMIT 3
female refers to gender = 'F';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Please list any five app categories that are related to games, along with their label ID.
SELECT category, label_id FROM label_categories WHERE category LIKE '%game%' LIMIT 5
app categories refers to category; related to games refers to category like '%game%';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Please list any three OPPO device models.
SELECT device_model FROM phone_brand_device_model2 WHERE phone_brand = 'OPPO' LIMIT 3
OPPO refers to phone_brand = 'OPPO';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
What is the percentage of users who experienced event number 6 who have the app installed but do not use the app?
SELECT SUM(IIF(is_installed = 1 AND is_active = 0, 1, 0)) / COUNT(app_id) AS perrcent FROM app_events WHERE event_id = 6
percentage = MULTIPLY(DIVIDE(SUM(is_installed = 1 and is_active = 0), COUNT(app_id)), 1.0); event number refers to event_id = 6; installed refers to is_installed = 1; do not use refers to is_active = 0;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Which gender owned more of the Galaxy Note 2 device model?
SELECT IIF(SUM(IIF(T1.gender = 'M', 1, 0)) - SUM(IIF(T1.gender = 'F', 1, 0)) > 0, 'M', 'F') AS gender FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Galaxy Note 2'
gender that owned more = SUBTRACT(IF(SUM(gender = 'M'), SUM(gender = 'F'),'M','F'));
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
When did event number 2 happen and how many users were active?
SELECT COUNT(T1.app_id) AS num FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id WHERE T1.event_id = 2 AND T1.is_active = 1 GROUP BY T2.timestamp
event number refers to event_id; event_id = 2; active refers to is_active = 1;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Which behavior category does user number 5902120154267990000 belong to?
SELECT T1.category FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T2.app_id = 5902120154267990000
behavior category refers to category; number refers to app_id; app_id = 5902120154267990000;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
How many users belong to the same behavior category as comics?
SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T1.category = 'comics'
behavior category refers to category; category = 'comics';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
What is the age and gender of the person who uses the device number 29182687948017100 on event number 1?
SELECT T1.age, T1.gender FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T1.device_id = 29182687948017100 AND T2.event_id = 1
device number refers to device_id; device_id = 29182687948017100; event number refers to event_id; and event_id = 1;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
How many male users have the log of events at the same longitude of 114?
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T2.longitude = 114 AND T1.gender = 'M'
male refers to gender = 'M';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
When did event number 7 happen for user number -8022267440849930000?
SELECT T1.timestamp FROM events_relevant AS T1 INNER JOIN app_events AS T2 ON T1.event_id = T2.event_id WHERE T2.app_id = -8022267440849930000 AND T1.event_id = 7
event number refers to event_id; event_id = 7; user number refers to app_id; app_id = -8022267440849930000;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
What are the behavior categories that user number -9222198347540750000 belongs to?
SELECT T3.category FROM app_all AS T1 INNER JOIN app_labels AS T2 ON T1.app_id = T2.app_id INNER JOIN label_categories AS T3 ON T2.label_id = T3.label_id WHERE T1.app_id = -9222198347540750000
behavior categories refers to category; user number refers to app_id; app_id = -9222198347540750000;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Please provide the age group of any LG Nexus 4 device users.
SELECT T1.`group` FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'LG' AND T2.device_model = 'Nexus 4'
age group refers to `group`; LG Nexus 4 refers to phone_brand = 'LG' AND device_model = 'Nexus 4';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Please provide the gender of at least one user who owns an HTC Desire 826 device.
SELECT T1.gender FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Desire 826' AND T2.phone_brand = 'HTC'
HTC Desire 826 refers to phone_brand = 'HTC' AND device_model = 'Desire 826';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
What is the percentage of users who are in the same behavior category as "Academic Information"?
SELECT SUM(IIF(T1.category = 'Academic Information', 1.0, 0)) / COUNT(T2.app_id) AS per FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id
percentage = MULTIPLY(DIVIDE(SUM(category = 'Academic Information'), COUNT(app_id)), 1.0); behavior category refers to category; category = 'Academic Information';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
What is the percentage of device users in the F27-28 age group who experienced an event on the 3rd of May 2016?
SELECT SUM(IIF(T1.`group` = 'F27-28', 1, 0)) / COUNT(T1.device_id) AS per FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE SUBSTR(T2.timestamp, 1, 10) = '2016-05-03'
percentage = MULTIPLY(DIVIDE(SUM(`group` = 'F27-28'), COUNT(device_id)), 1.0); on the 3rd of May 2016 refers to timestamp = '2016-05-03%';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
How many OPPO devices are there?
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE phone_brand = 'OPPO'
OPPO devices refers to phone_brand = 'OPPO';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
What is the most common age group among all device users?
SELECT T.num FROM ( SELECT `group`, COUNT(`group`) AS num FROM gender_age GROUP BY `group` ) T
most common age group refers to MAX(COUNT(`group`));
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
How many events does the device "4069764298338760000" have?
SELECT COUNT(event_id) FROM events WHERE device_id = 4069764298338760000
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
How many of the apps belong in the "Equity Fund" category?
SELECT COUNT(T1.app_id) FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id WHERE T2.category = 'Equity Fund'
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
List all females aged 24 to 26 devices' locations.
SELECT T2.longitude, T2.latitude FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T1.`group` = 'F24-26' AND T1.gender = 'F'
females refers to gender = 'F'; aged 24 to 26 refers to `group` = 'F24-26';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
How many male users have a Galaxy Note 3?
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Galaxy Note 3' AND T1.gender = 'M'
male refers to gender = 'M'; Galaxy Note 3 refers to device_model = 'Galaxy Note 3';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
List all the devices' brands and models of events on 5/7/2016 at 6:03:22 AM.
SELECT T1.phone_brand, T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T2.timestamp = '2016-05-07 06:03:22'
devices' brands refers to phone_brand; models refers to device_model; on 5/7/2016 at 6:03:22 AM refers to timestamp = '2016-05-07 06:03:22';
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
Which brand is most common among people in their twenties?
SELECT T.phone_brand FROM ( SELECT T2.phone_brand, COUNT(T2.phone_brand) AS num FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.age BETWEEN 20 AND 30 GROUP BY T2.phone_brand ) AS T ORDER BY T.num DESC LIMIT 1
brand refers to phone_brand; brand that is most common refers to MAX(COUNT(phone_brand)); twenties refers to age BETWEEN 20 AND 30;
talkingdata
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `ev...
【DB_ID】 talkingdata 【Schema】 # Table: main.app_all [ (app_id:INTEGER, Primary Key, Examples: [-9223281467940916832, -9222877069545393219, -9222785464897897681]) ] # Table: main.app_events [ (event_id:INTEGER, Primary Key, Examples: [2, 6, 7]), (app_id:INTEGER, Primary Key, Examples: [-8942695423876075857, -802226744084...
What percentage of vivo devices belong to users with no information?
SELECT SUM(IIF(T1.gender IS NULL AND T1.age IS NULL AND T1.`group` IS NULL, 1, 0)) / COUNT(T1.device_id) AS per FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'vivo'
percentage = MULTIPLY(DIVIDE(SUM(gender = NULL and age = NULL and `group` = NULL), COUNT(device_id)), 1.0); vivo devices refers to phone_brand = 'vivo'; no information refers to gender = NULL AND age = NULL AND `group` = NULL;
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Please list all the keywords of the episode "Refuge: Part 1".
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Refuge: Part 1'
episode "Refuge: Part 1" refers to title = 'Refuge: Part 1'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many keywords are there for season 9, episode 23 of law_and_order?
SELECT COUNT(T2.keyword) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.season = 9 AND T1.episode = 23
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the title of the episode with the keyword "laundering money"?
SELECT T1.title FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.keyword = 'laundering money'
keyword "laundering money" refers to keyword = 'laundering money'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Please list all the keywords for the episodes with a rating of over 8.
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.rating > 8
a rating of over 8 refers to rating > 8
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many 10-star votes were given to the episode titled "Cherished"?
SELECT T2.votes FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Cherished' AND T2.stars = 10
10-star vote refers to stars = 10; titled "Cherished" refers to title = 'Cherished'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many votes did the episode titled "Cherished" get in total?
SELECT SUM(T2.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Cherished'
titled "Cherished" refers to title = 'Cherished'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the title of the episode that got the most 10-star votes?
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10 ORDER BY T2.votes DESC LIMIT 1
the most refers to max(votes); 10-star refers to stars = 10
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Park Dietz was credited in which role in the episode titled "Cherished"?
SELECT T2.role FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.title = 'Cherished' AND T3.name = 'Park Dietz' AND T2.credited = 'true'
credited refers to credited = 'true'; titled "Cherished" refers to title = 'Cherished'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many people had filled a role in the episode titled "Cherished", but did not show up in the on-screen credits?
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Cherished' AND T2.credited = 'false'
titled "Cherished" refers to title = 'Cherished'; did not show up in the on-screen credits refers to credited = ''
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who was credited as "technical advisor" in the episode titled "Cherished"?
SELECT T3.name FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.title = 'Cherished' AND T2.credited = 'true' AND T2.role = 'technical advisor'
who refers to name; credited refers to credited = 'true'; as "technical advisor" refers to role = 'technical advisor'; titled "Cherished" refers to title = 'Cherished'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
For how many times was Park Dietz credited?
SELECT COUNT(T3.person_id) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T2.credited = 'true' AND T3.name = 'Park Dietz'
credited refers to credited = 'true'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Please list the titles of all the episodes in which Park Dietz was credited.
SELECT T1.title FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T2.credited = 'true' AND T3.name = 'Park Dietz'
credited refers to credited = 'true'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Was Anthony Azzara's role in episode tt0629204 displayed in the credits at the end of the episode?
SELECT T1.credited FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'Anthony Azzara' AND T1.episode_id = 'tt0629204'
episode tt0629204 refers to episode_id = 'tt0629204'; credited refers to credited = 'true'; not credited refers to credited = ''
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many keywords are there in the episode Disciple?
SELECT COUNT(T2.keyword) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Disciple'
episode Disciple refers to title = 'Disciple'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Which episode got the most 1 star votes? Give its title.
SELECT T2.title FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.stars = 1 ORDER BY T1.votes DESC LIMIT 1
the most refers to max(votes); 1 star refers to stars = '1'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many nominations did Law and Order season 9, episode 20 get?
SELECT COUNT(T2.award_id) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.series = 'Law and Order' AND T1.season = 9 AND T1.episode = 20
Law and Order refers to series = 'Law and Order'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
For season 9, episode 17 of the show Law and Order, how many roles have been included in the credit?
SELECT COUNT(T2.role) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.series = 'Law and Order' AND T1.season = 9 AND T1.episode = 17 AND T2.credited = 'true'
Law and Order refers to series = 'Law and Order'; included in the credit refers to credited = 'true'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Describe what happened in the episode of award no.296.
SELECT T1.summary FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.award_id = 296
description of what happened refers to summary; award no.296 refers to award_id = '296'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Which role did Joseph Blair play in the show?
SELECT T1.role FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'Joseph Blair'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many awards has Rene Balcer been nominated for?
SELECT COUNT(T2.award_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.name = 'Rene Balcer'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
For the episode with the most votes, give its air date.
SELECT T2.air_date FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id GROUP BY T2.episode_id ORDER BY SUM(T1.votes) DESC LIMIT 1
the most votes refers to max(votes)
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who was nominated for award no.313? Give the full name.
SELECT T1.name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.award_id = 313
award no.313 refers to award_id = '313'; full name refers to name
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many episodes did J.K. Simmons' role appear on the show?
SELECT COUNT(T1.role) FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'J.K. Simmons'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Display the number of 9-star votes the episode Sideshow received.
SELECT T2.votes FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 9 AND T1.title = 'Sideshow'
9-star vote refers to stars = '9'; episode Sideshow refers to title = 'Sideshow'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many times is the number of keywords in "Refuge: Part 1" episode than "Shield" episode?
SELECT CAST(SUM(CASE WHEN T1.title = 'Refuge: Part 1' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.title = 'Shield' THEN 1 ELSE 0 END) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id
"Refuge: Part 1" episode refers to title = 'Refuge: Part 1'; "Shield" episode refers to title = 'Shield'; times = divide(count(keyword where title = 'Refuge: Part 1'), count(keyword where title = 'Shield'))
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Calculate the average number of cast members that appeared in the credit from the 185th to the 193rd episode.
SELECT CAST(COUNT(T1.episode_id) AS REAL) / (193 - 185 + 1) FROM Credit AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.category = 'Cast' AND T1.credited = 'true' AND T2.number_in_series BETWEEN 185 AND 193
appeared in the credit refers to credited = 'TRUE'; from the 185th to the 193rd episode refers to number_in_series between 185 and 193; cast refers to category = 'Cast'; average number = divide(count(episode_id), 9)
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What are the names of the person that were not credited at the end of episode tt0629391?
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.credited = 'false' AND T1.episode_id = 'tt0629391'
not credited refers to credited = ''; episode tt0629391 refers to episode_id = 'tt0629391'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many people have won at least 3 awards?
SELECT COUNT(T1.person_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.result = 'Winner' GROUP BY T1.person_id HAVING COUNT(T2.award_id) >= 3
won refers to result = 'Winner'; at least 3 awards refers to count(result) > 3
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who is the script supervisor of the series in episode tt0629204?
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.episode_id = 'tt0629204' AND T1.role = 'script supervisor'
who refers to name; script supervisor refers to role = 'script supervisor'; episode tt0629204 refers to episode_id = 'tt0629204'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many awards has Julia Roberts been nominated for?
SELECT COUNT(T2.award_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.name = 'Julia Roberts' AND T2.result = 'Nominee'
been nominated refers to result = 'Nominee'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who is the tallest camera operator?
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.role = 'camera operator' ORDER BY T2.height_meters DESC LIMIT 1
who refers to name; the tallest refers to max(height_meters); camera operator refers to role = 'camera operator'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many people, who were born in Canada, won an award in 1999?
SELECT COUNT(T1.person_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.year = 1999 AND T1.birth_country = 'Canada'
born in Canada refers to birth_country = 'Canada'; in 1999 refers to year = 1999
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many people gave the most enjoyed episode a 10-star rating?
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10
the most enjoyed refers max(rating); 10-star refers to stars = 10
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What are the keywords of the "Shield" episode?
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Shield'
"Shield" episode refers to title = 'Shield'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the percentage of people who gave the "True North" episode a 1-star rating?
SELECT CAST(SUM(CASE WHEN T2.stars = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'True North' AND T1.episode_id = 'tt0629477'
the "True North" episode refers to title = 'True North'; 1-star refers to stars = 1; percentage = divide(count(episode_id where stars = 1), count(episode_id)) * 100% where title = 'True North'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the title of the episode with the highest number of keywords?
SELECT T1.title FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id GROUP BY T1.episode_id ORDER BY COUNT(T2.keyword) DESC LIMIT 1
the highest number of keywords refers to max(count(keyword))
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Among the episodes that were aired in 1998, how many won an International Monitor Awards?
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE strftime('%Y', T1.air_date) = '1998' AND T2.organization = 'International Monitor Awards' AND T2.result = 'Winner'
aired in 1998 refers to air_date like '1998%'; won refers to result = 'Winner'; International Monitor Awards refers to organization = 'International Monitor Awards'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many times did the episode titled "Agony" win an award?
SELECT COUNT(T2.award_id) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Agony' AND T2.result = 'Winner'
titled "Agony" refers to title = 'Agony'; win an award refers to result = 'Winner'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many episodes are there in the 9th season of Law and Order? Calculate the average number of casts per season of the said series.
SELECT SUM(CASE WHEN T2.season = 9 THEN 1 ELSE 0 END) AS num , CAST(SUM(CASE WHEN T2.season = 9 THEN 1 ELSE 0 END) AS REAL) / COUNT(T1.episode_id) FROM Credit AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.category = 'Cast' AND T2.series = 'Law and Order'
the 9th season refers to season = 9; Law and Order refers to series = 'Law and Order'; cast refers to category = 'Cast'; average number of casts per season = divide(count(person_id), count(episode_id))
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What are the keywords of the episode which received the 2nd-highest number of votes?
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.votes NOT IN ( SELECT MAX(T1.votes) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id ) ORDER BY T1.votes DESC LIMIT 1
the 2nd-highest number of votes refers to second max(votes)
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many awards did the "Agony" win?
SELECT COUNT(T2.award) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Agony' AND T2.result = 'Winner'
the "Agony" refers to title = 'Agony'; win refers to result = 'Winner'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who is the narrator of the "Flight" episode?
SELECT T3.name FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.title = 'Flight' AND T2.role = 'Narrator'
who refers to name; narrator refers to role = 'Narrator'; the "Flight" episode refers to title = 'Flight'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
In which organization did Constantine Makris win the most awards?
SELECT T2.organization FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.name = 'Constantine Makris' AND T2.result = 'Winner' GROUP BY T2.organization ORDER BY COUNT(T2.award_id) DESC LIMIT 1
win refers to result = 'Winner'; the most awards refers to max(count(award_id))
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who is the stunt coordinator in episode 3?
SELECT T3.name FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.episode = 3 AND T2.role = 'stunt coordinator'
who refers to name; stunt coordinator refers to role = 'stunt coordinator'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many people were not credited at the end of the "Admissions" episode?
SELECT COUNT(T2.person_id) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Admissions' AND T2.credited = 'false'
not credited refers to credited = ''; the "Admissions" episode refers to title = 'Admissions'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What is the title of the episode that has the highest number of crews in the Art Department?
SELECT T2.title FROM Credit AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.category = 'Art Department' GROUP BY T2.episode_id ORDER BY COUNT(T1.category) DESC LIMIT 1
the highest number of crews refers to max(count(person_id)); in the Art Department refers to category = 'Art Department'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many roles did Julia Roberts play in the series?
SELECT COUNT(T1.role) FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'Julia Roberts'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What are the titles of the top 3 episodes that received no less than 30 votes in its 10-star rating?
SELECT T2.title FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.votes >= 30 AND T1.stars = 10 ORDER BY T1.votes DESC LIMIT 3
no less than 30 votes refers to votes > = 30; 10-star rating refers to stars = 10
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who is the youngest person to ever play a "clerk" role in the series?
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.role = 'Clerk' AND T2.birthdate IS NOT NULL ORDER BY T2.birthdate LIMIT 1
who refers to name; the youngest person refers to max(birthdate); a "clerk" role refers to role = 'Clerk'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many people did not enjoy the finale episode?
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.episode = 24 AND T2.stars = 1
did not enjoy refers to stars = 1; the finale episode refers to episode = 24
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
List the names of all the cast members in the series.
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.category = 'Cast'
cast member refers to category = 'Cast'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Who is the person who appeared the most in the series? Calculate in percentage how many times he or she appeared.
SELECT T2.person_id, CAST(COUNT(T2.person_id) AS REAL) * 100 / ( SELECT COUNT(T2.person_id) AS num FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id ) AS per FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id GROUP BY T2.person_id ORDER BY COUNT(T2.person_id) DESC LIMIT 1
who refers to name; appear the most refers to max(count(person_id)); percentage = divide(count(person_id where max(count(person_id))), count(person_id)) * 100%
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
Which episodes of the Law & Order have been nominated for the Primetime Emmy Awards?
SELECT DISTINCT episode_id FROM Award WHERE award_category = 'Primetime Emmy'
episode refers to award; the Primetime Emmy Awards refers to award_category like 'Primetime Emmy'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
How many episodes have not won any Law & Order series awards?
SELECT COUNT(award_id) FROM Award WHERE Result = 'Nominee'
have not won any award refers to Result = 'Nominee'
law_episode
CREATE TABLE Episode ( episode_id TEXT primary key, series TEXT, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date DATE, episode_image TEXT, rating ...
【DB_ID】 law_episode 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [258, 259, 260]), (organization:TEXT), (year:INTEGER, Examples: [1999, 2000]), (award_category:TEXT, Examples: [Monitor, Primetime Emmy, Silver Gavel Award]), (award:TEXT), (series:TEXT, Examples: [Law and Order]), (episode_id:...
What roles have not been credited at the end of the episodes?
SELECT DISTINCT role FROM Credit WHERE credited = 'false'
have not been credited refers to credited = ''