Chinastark/bird_dataset huggingface dataset:
Database: talkingdata
Note: coordinates of (-102,38) refers to longitude = -102, latitude = 38;
Question: Describe the ages, genders and numbers of events participated by the users at coordinates of (-102,38).
SQL: SELECT DISTINCT gender_age.age, gender_age.gender, count(events.event_id) FROM gender_age INNER JOIN `events` ON events.device_id = gender_age.device_id WHERE events.longitude = -102 AND events.latitude = 38 GROUP BY gender_age.age, gender_age.gender, events.longitude, events.latitude
Database: talkingdata
Note: models refers to device_model; coordinates of (80,44) refers to longitude = 80 AND latitude = 44;
Question: Provide the phone brands and models of the users who were at the coordinates of (80,44).
SQL: SELECT DISTINCT phone_brand_device_model2.phone_brand, phone_brand_device_model2.device_model FROM phone_brand_device_model2 INNER JOIN EVENTS ON EVENTS.device_id = phone_brand_device_model2.device_id WHERE EVENTS.longitude = 80 AND EVENTS.latitude = 44
Database: talkingdata
Question: List the included categories in the event ID of 155.
SQL: SELECT DISTINCT label_categories.category FROM label_categories INNER JOIN app_labels ON app_labels.label_id = label_categories.label_id INNER JOIN app_events ON app_events.app_id = app_labels.app_id WHERE app_events.event_id = 155
Database: talkingdata
Note: HTC Butterfly refers to phone_brand = 'HTC' AND device_model = 'Butterfly'; females refers to gender = 'F';
Question: Among HTC Butterfly phone users, list any five devices' IDs used by females.
SQL: SELECT gender_age.device_id FROM phone_brand_device_model2 INNER JOIN gender_age ON gender_age.device_id = phone_brand_device_model2.device_id WHERE phone_brand_device_model2.device_model = 'Butterfly' AND gender_age.gender = 'F' AND phone_brand_device_model2.phone_brand = 'HTC' LIMIT 5
Database: talkingdata
Question: How many app IDs were included under science fiction category?
SQL: SELECT count(app_labels.app_id) FROM label_categories INNER JOIN app_labels ON app_labels.label_id = label_categories.label_id WHERE label_categories.category = 'science fiction'
Database: talkingdata
Note: LG L70 refers to phone_brand = 'LG' AND device_model = 'L70';
Question: What are the ages and genders of the LG L70 users?
SQL: SELECT gender_age.age, gender_age.gender FROM phone_brand_device_model2 INNER JOIN gender_age ON gender_age.device_id = phone_brand_device_model2.device_id WHERE phone_brand_device_model2.phone_brand = 'LG' AND phone_brand_device_model2.device_model = 'L70'
Database: talkingdata
Note: percentage = DIVIDE(MULTIPLY(CONCAT(COUNT(app_id WHERE category = 'Industry tag'), 100), COUNT(app_id)),'%');
Question: Calculate the percentage of the app user IDs under Industry tag category.
SQL: SELECT sum(iif(label_categories.category = 'Industry tag', 1, 0)) * 100 / count(app_labels.app_id) AS per FROM label_categories INNER JOIN app_labels ON app_labels.label_id = label_categories.label_id
Database: talkingdata
Note: 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';
Question: Among the LG brand users, calculate the percentage of the Nexus 5 model user. What is the ratio of male and female users of it?
SQL: SELECT sum(iif(phone_brand_device_model2.device_model = 'Nexus 5', 1, 0)) * 100 / count(phone_brand_device_model2.device_id) AS per , sum(iif(phone_brand_device_model2.device_model = 'Nexus 5' AND gender_age.gender = 'M', 1, 0)) / sum(iif(phone_brand_device_model2.device_model = 'Nexus 5' AND gender_age.gender = 'F', 1, 0)) AS r FROM phone_brand_device_model2 INNER JOIN gender_age ON gender_age.device_id = phone_brand_device_model2.device_id WHERE phone_brand_device_model2.phone_brand = 'LG'
Database: talkingdata
Note: not active refers to is_active = 0; event no. refers to event_id; event_id = 2;
Question: How many users of the app were not active when event no.2 happened?
SQL: SELECT count(event_id) FROM app_events WHERE event_id = 2 AND is_active = 0
Database: talkingdata
Note: in 2016 refers to `timestamp` LIKE '2016%';
Question: How many events in total have happened on the devices in 2016?
SQL: SELECT count(event_id) FROM `events` WHERE substr(`timestamp`, 1, 4) = '2016'
Database: talkingdata
Note: device no. refers to device_id; device_id = 29182687948017100; in 2016 refers to `timestamp` LIKE '2016%';
Question: How many events have happened on device no.29182687948017100 in 2016?
SQL: SELECT count(event_id) FROM `events` WHERE substr(`timestamp`, 1, 4) = '2016' AND device_id = 29182687948017100
Database: talkingdata
Note: male refers to gender = 'M';
Question: How many device users are male?
SQL: SELECT count(device_id) FROM gender_age WHERE gender = 'M'
Database: talkingdata
Note: oldest device user refers to MAX(age);
Question: What is the age of the oldest device user?
SQL: SELECT max(age) FROM gender_age
Database: talkingdata
Note: female refers to gender = 'F'; under 30 refers to age < 30;
Question: Among the female users of the devices, how many of them are under 30?
SQL: SELECT count(device_id) FROM gender_age WHERE age < 30 AND gender = 'F'
Database: talkingdata
Note: Galaxy Note 2 refers to device_model = 'Galaxy Note 2'; female refers to gender = 'F';
Question: Among the users who use a Galaxy Note 2, how many of them are female?
SQL: SELECT count(phone_brand_device_model2.device_id) FROM phone_brand_device_model2 INNER JOIN gender_age ON gender_age.device_id = phone_brand_device_model2.device_id WHERE gender_age.gender = 'F' AND phone_brand_device_model2.device_model = 'Galaxy Note 2'
Database: talkingdata
Note: Galaxy Note 2 refers to device_model = 'Galaxy Note 2';
Question: Please list the ages of all the users who use a Galaxy Note 2.
SQL: SELECT gender_age.age FROM phone_brand_device_model2 INNER JOIN gender_age ON gender_age.device_id = phone_brand_device_model2.device_id WHERE phone_brand_device_model2.device_model = 'Galaxy Note 2'
Database: talkingdata
Note: oldest user refers to MAX(age);
Question: What is the device model of the device used by the oldest user?
SQL: SELECT device_model FROM phone_brand_device_model2 WHERE device_id IN ( SELECT device_id FROM gender_age WHERE age = ( SELECT max(age) FROM gender_age ) )
Database: talkingdata
Note: user group where most of the users belong refers to MAX(COUNT(group)); vivo device refers to phone_brand = 'vivo';
Question: To which user group do most of the users who uses a vivo device belong?
SQL: SELECT t.`group` FROM ( SELECT gender_age.`group`, count(`group`) AS num FROM phone_brand_device_model2 INNER JOIN gender_age ON gender_age.device_id = phone_brand_device_model2.device_id WHERE phone_brand_device_model2.phone_brand = 'vivo' GROUP BY gender_age.`group` ) AS t ORDER BY t.num DESC LIMIT 1
Database: talkingdata
Question: How many app users belong to the category of Securities?
SQL: SELECT count(app_labels.app_id) FROM app_labels INNER JOIN label_categories ON label_categories.label_id = app_labels.label_id WHERE label_categories.category = 'Securities'
Database: talkingdata
Note: app no. refers to app_id; app_id = 1977658975649780000;
Question: To which categories does app user no.1977658975649780000 belong?
SQL: SELECT label_categories.category FROM label_categories INNER JOIN app_labels ON label_categories.label_id = app_labels.label_id WHERE app_labels.app_id = 1977658975649780000
Database: talkingdata
Note: not active refers to is_active = 0; event no. refers to event_id; event_id = 2;
Question: Please list the categories of the app users who are not active when event no.2 happened.
SQL: SELECT DISTINCT label_categories.category FROM label_categories INNER JOIN app_labels ON label_categories.label_id = app_labels.label_id INNER JOIN app_events ON app_labels.app_id = app_events.app_id WHERE app_events.event_id = 2 AND app_events.is_active = 0
Database: talkingdata
Note: location coordinates = longitude, latitude; inactive refers to is_active = 0; event no. refers to event_id; event_id = 2;
Question: Please list the location coordinates of all the devices with an inactive app user when event no.2 happened.
SQL: SELECT DISTINCT EVENTS.longitude, EVENTS.latitude FROM app_events INNER JOIN EVENTS ON EVENTS.event_id = app_events.event_id WHERE EVENTS.event_id = 2 AND app_events.is_active = 0
Database: talkingdata
Note: event no. refers to event_id; event_id = 2; not active refers to is_active = 0; earliest time refers to MIN(timestamp);
Question: Among all the times event no.2 happened when the app user was not active, when was the earliest time this situation happened?
SQL: SELECT EVENTS.timestamp FROM app_events INNER JOIN EVENTS ON EVENTS.event_id = app_events.event_id WHERE app_events.is_active = 0 AND EVENTS.event_id = 2 ORDER BY EVENTS.timestamp LIMIT 1
Database: talkingdata
Note: IDs of the events refers to event_id; vivo devices refers to phone_brand = 'vivo';
Question: Please list the IDs of the events happened on all the vivo devices.
SQL: SELECT EVENTS.event_id FROM phone_brand_device_model2 INNER JOIN EVENTS ON EVENTS.device_id = phone_brand_device_model2.device_id WHERE phone_brand_device_model2.phone_brand = 'vivo'
Database: talkingdata
Note: event no. refers to event_id; event_id = 2; vivo devices refers to phone_brand = 'vivo';
Question: Among the devices with event no.2 happening, how many of them are vivo devices?
SQL: SELECT count(phone_brand_device_model2.device_id) FROM phone_brand_device_model2 INNER JOIN EVENTS ON EVENTS.device_id = phone_brand_device_model2.device_id WHERE phone_brand_device_model2.phone_brand = 'vivo' AND EVENTS.event_id = 2
Database: talkingdata
Note: time refers to timestamp; event no. refers to event_id; event_id = '2'; vivo device refers to phone_brand = 'vivo';
Question: Please list the time when event no.2 happened on a vivo device.
SQL: SELECT EVENTS.timestamp FROM EVENTS INNER JOIN phone_brand_device_model2 ON EVENTS.event_id = phone_brand_device_model2.device_id WHERE phone_brand_device_model2.phone_brand = 'vivo' AND EVENTS.event_id = '2'
Database: talkingdata
Note: vivo devices refers to phone_brand = 'vivo'; in the year 2016 refers to year(timestamp) = 2016;
Question: How many events in total have happened on all the vivo devices in the year 2016?
SQL: SELECT count(EVENTS.event_id) FROM EVENTS INNER JOIN phone_brand_device_model2 ON EVENTS.event_id = phone_brand_device_model2.device_id WHERE strftime('%Y', EVENTS.timestamp) = '2016' AND phone_brand_device_model2.phone_brand = 'vivo'
Database: talkingdata
Note: vivo device refers to phone_brand = 'vivo'; female refers to gender = 'F'; under 30 refers to age < 30;
Question: Among the users who uses a vivo device, how many of them are female and under 30?
SQL: SELECT count(gender_age.device_id) FROM gender_age INNER JOIN phone_brand_device_model2 ON gender_age.device_id = phone_brand_device_model2.device_id WHERE gender_age.gender = 'F' AND phone_brand_device_model2.phone_brand = 'vivo' AND gender_age.age < 30
Database: talkingdata
Note: most app users refers to MAX(COUNT(app_id));
Question: What is the category that the most app users belong to?
SQL: SELECT t.category FROM ( SELECT label_categories.category, count(app_labels.app_id) AS num FROM label_categories INNER JOIN app_labels ON label_categories.label_id = app_labels.label_id GROUP BY label_categories.label_id ) AS t ORDER BY t.num DESC LIMIT 1
Database: talkingdata
Note: brand of the device refers to phone_brand; youngest refers to MIN(age); female refers to gender = 'F';
Question: What is the brand of the device used by the youngest female user?
SQL: 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: talkingdata
Note: user group m23-26 refers to group = 'm23-26'; vivo device refers to phone_brand = 'vivo';
Question: How many users in user group M23-26 use a vivo device?
SQL: SELECT count(phone_brand_device_model2.device_id) FROM gender_age INNER JOIN phone_brand_device_model2 ON gender_age.device_id = phone_brand_device_model2.device_id WHERE gender_age.`group` = 'M23-26' AND phone_brand_device_model2.phone_brand = 'vivo'
Database: talkingdata
Note: 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';
Question: Among all the users who use a vivo device, what is the percentage of the users in the M23-26 user group?
SQL: SELECT sum(iif(gender_age.`group` = 'M23-26', 1.0, 0)) / count(gender_age.device_id) AS per FROM gender_age INNER JOIN phone_brand_device_model2 ON gender_age.device_id = phone_brand_device_model2.device_id WHERE phone_brand_device_model2.phone_brand = 'vivo'
Database: talkingdata
Note: 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';
Question: Among all the devices with event no.2 happening, what is the percentage of the device being a vivo phone?
SQL: SELECT sum(iif(phone_brand_device_model2.phone_brand = 'vivo', 1, 0)) / count(EVENTS.device_id) AS per FROM EVENTS INNER JOIN phone_brand_device_model2 ON EVENTS.event_id = phone_brand_device_model2.device_id WHERE EVENTS.event_id = '2'
Database: talkingdata
Note: average age = AVG(age); vivo device refers to phone_brand = 'vivo';
Question: What is the average age of all the vivo device users?
SQL: SELECT avg(age) FROM gender_age INNER JOIN phone_brand_device_model2 ON gender_age.device_id = phone_brand_device_model2.device_id WHERE phone_brand_device_model2.phone_brand = 'vivo'
Database: talkingdata
Note: female refers to gender = 'F'; age group of 27 to 28 refers to `group` = 'f27-28';
Question: How many female users belong to the age group of 27 to 28?
SQL: SELECT count(device_id) FROM gender_age WHERE `group` = 'F27-28' AND gender = 'F'
Database: talkingdata
Note: oldest user refers to MAX(age); male refers to gender = 'M';
Question: What is the age of the oldest male user of the app?
SQL: SELECT max(age) FROM gender_age WHERE gender = 'M'
Database: talkingdata
Note: installed refers to is_installed = 1; not active refers to is_active = 0;
Question: How many users installed the app but are not active?
SQL: SELECT count(app_id) FROM app_events WHERE is_installed = 1 AND is_active = 0
Database: talkingdata
Note: youngest user refers to MIN(age); female refers to gender = 'F';
Question: What is the age of the youngest female user of the app?
SQL: SELECT min(age) FROM gender_age WHERE gender = 'F'
Database: talkingdata
Note: models refers to device_model;
Question: How many models does the VIVO phone brand released?
SQL: SELECT count(device_id) FROM phone_brand_device_model2 WHERE phone_brand = 'vivo'
Database: talkingdata
Note: phone models refers to device_model; OPPO brand refers to phone_brand = 'OPPO';
Question: List at least 15 phone models released under the OPPO brand.
SQL: SELECT device_model FROM phone_brand_device_model2 WHERE phone_brand = 'OPPO' LIMIT 15
Database: talkingdata
Note: male refers to gender = 'M'; over the age of 39 refers to group = 'm39+';
Question: List at least 10 device models that male users over the age of 39 usually use.
SQL: SELECT phone_brand_device_model2.device_model FROM phone_brand_device_model2 INNER JOIN gender_age ON phone_brand_device_model2.device_id = gender_age.device_id WHERE gender_age.`group` = 'M39+' AND gender_age.gender = 'M' LIMIT 10
Database: talkingdata
Note: install refers to is_installed = 1; active refers to is_active = 1;
Question: List 5 device models that users use to install the app and are active in using the app.
SQL: SELECT phone_brand_device_model2.device_model FROM phone_brand_device_model2 INNER JOIN EVENTS ON phone_brand_device_model2.device_id = EVENTS.event_id INNER JOIN app_events ON EVENTS.event_id = app_events.event_id WHERE app_events.is_active = 1 AND app_events.is_installed = 1 LIMIT 5
Database: talkingdata
Question: How many users belong to "Financial Information" category?
SQL: SELECT count(app_labels.app_id) FROM app_labels INNER JOIN label_categories ON app_labels.label_id = label_categories.label_id WHERE label_categories.category = 'Financial Information'
Database: talkingdata
Question: How many users belong to "game-Art Style" category?
SQL: SELECT count(app_labels.app_id) FROM app_labels INNER JOIN label_categories ON app_labels.label_id = label_categories.label_id WHERE label_categories.category = 'game-Art Style'
Database: talkingdata
Note: male refers to gender = 'Male';
Question: Provide the total number of the male users that use OPPO as their phone brand.
SQL: SELECT count(gender_age.device_id) FROM gender_age INNER JOIN phone_brand_device_model2 ON gender_age.device_id = phone_brand_device_model2.device_id WHERE phone_brand_device_model2.phone_brand = 'OPPO' AND gender_age.gender = 'M'
Database: talkingdata
Note: brand of the device refers to phone_brand; youngest user refers to MIN(age);
Question: What is the brand of the youngest user's device?
SQL: SELECT device_model FROM phone_brand_device_model2 WHERE device_id IN ( SELECT device_id FROM gender_age WHERE age = ( SELECT min(age) FROM gender_age ) )
Database: talkingdata
Note: lowest number of users refers to MIN(COUNT(label_id));
Question: List at least 3 categories with the lowest number of users.
SQL: SELECT label_categories.category FROM label_categories INNER JOIN app_labels ON label_categories.label_id = app_labels.label_id ORDER BY app_labels.label_id LIMIT 3
Database: talkingdata
Note: male refers to gender = 'M'; Galaxy Ace Plus refers to device_model = 'Galaxy Ace Plus';
Question: How many male users use the Galaxy Ace Plus model?
SQL: SELECT count(gender_age.device_id) FROM gender_age INNER JOIN phone_brand_device_model2 ON gender_age.device_id = phone_brand_device_model2.device_id WHERE phone_brand_device_model2.device_model = 'Galaxy Ace Plus' AND gender_age.gender = 'M'
Database: talkingdata
Note: age group refers to group; most OPPO users refers to MAX(COUNT(phone_brand = 'OPPO')); OPPO users refers to phone_brand = 'OPPO';
Question: What is the age group of most OPPO users?
SQL: SELECT t.`group` FROM ( SELECT gender_age.`group`, count(gender_age.`group`) AS num FROM gender_age INNER JOIN phone_brand_device_model2 ON gender_age.device_id = phone_brand_device_model2.device_id WHERE phone_brand_device_model2.phone_brand = 'OPPO' GROUP BY gender_age.`group` ) AS t ORDER BY t.num DESC LIMIT 1
Database: talkingdata
Note: device models that are commonly used refers to MAX(COUNT(device_model)); female refers to gender = 'F';
Question: List at least 5 device models that are commonly used by female users.
SQL: SELECT t.device_model FROM ( SELECT phone_brand_device_model2.device_model, count(phone_brand_device_model2.device_model) AS num FROM gender_age INNER JOIN phone_brand_device_model2 ON gender_age.device_id = phone_brand_device_model2.device_id WHERE gender_age.gender = 'F' GROUP BY phone_brand_device_model2.device_model ) AS t ORDER BY t.num DESC LIMIT 5
Database: talkingdata
Note: ratio in percentage = DIVIDE(SUM(IF(category = '80s Japanese comic',1,0)), COUNT(app_id)) as '80s'; DIVIDE(SUM(IF(category = '90s Japanese comic',1,0)), COUNT(app_id)) as '90s'; 80s Japanese comic refers to category = '80s Japanese comic'; 90s Japanese comic refers to category = '80s Japanese comic';
Question: Calculate the ratio in percentage between the average number of app users belonging to "80s Japanese comic" and "90s Japanese comic".
SQL: SELECT sum(iif(label_categories.category = '80s Japanese comic', 1, 0)) / count(label_categories.label_id) AS j8 , sum(iif(label_categories.category = '90s Japanese comic', 1, 0)) / count(label_categories.label_id) AS j9 FROM label_categories INNER JOIN app_labels ON label_categories.label_id = app_labels.label_id
Database: talkingdata
Note: female refers to gender = 'F'; percentage = DIVIDE(SUM(IF(phone_brand = 'OPPO',1,0)), SUM(IF(device_id = 'R815T',1,0))); R815T refers to device_id = 'R815T';
Question: Among the female users that uses OPPO as their phone brand, what is the percentage of them of the user that uses R815T model to install the app?
SQL: SELECT sum(iif(phone_brand_device_model2.phone_brand = 'OPPO', 1, 0)) / sum(iif(phone_brand_device_model2.device_id = 'R815T', 1, 0)) AS num FROM phone_brand_device_model2 INNER JOIN gender_age ON phone_brand_device_model2.device_id = gender_age.device_id WHERE gender_age.gender = 'F'
Database: talkingdata
Question: What is the phone brand of the device model "坚果手机"?
SQL: SELECT phone_brand FROM phone_brand_device_model2 WHERE device_model = '坚果手机'
Database: talkingdata
Question: Give the number of device models for "中兴" phone brand.
SQL: SELECT count(device_id) FROM phone_brand_device_model2 WHERE device_model = '中兴'
Database: talkingdata
Question: Which group does age 24 belong to?
SQL: SELECT `group` FROM gender_age WHERE age = '24'
Database: talkingdata
Note: event no. refers to event_id; event_id = '887711';
Question: Give the time stamp for event No.887711.
SQL: SELECT TIMESTAMP FROM EVENTS WHERE event_id = '887711'
Database: talkingdata
Note: on 2016/5/6 refers to timestamp = '2016/5/6 XX:XX:XX';
Question: Provide the number of events that happened on 2016/5/6.
SQL: SELECT count(event_id) FROM EVENTS WHERE substr(`timestamp`, 1, 10) = '2016-05-06'
Database: talkingdata
Note: at 23:55:16 on 2016/5/7 refers to timestamp = '2016/5/7 23:55:16'; location coordinate (113, 28) refers to longitude = '113' AND latitude = '28';
Question: For the event which happened at 23:55:16 on 2016/5/7, in the location coordinate(113, 28), on what device did it happen? Give the name of the device model.
SQL: SELECT phone_brand_device_model2.device_model FROM phone_brand_device_model2 INNER JOIN EVENTS ON phone_brand_device_model2.device_id = EVENTS.event_id WHERE EVENTS.longitude = '113' AND EVENTS.latitude = '28' AND EVENTS.timestamp = '2016-05-07 23:55:16'
Database: talkingdata
Note: game-Fishing refers to category = 'game-Fishing';
Question: Give the number of "game-Fishing" apps.
SQL: SELECT count(app_labels.app_id) FROM label_categories INNER JOIN app_labels ON label_categories.label_id = app_labels.label_id WHERE label_categories.category = 'game-Fishing'
Database: talkingdata
Note: 魅蓝Note 2 refers to device_model = '魅蓝Note 2';
Question: State the number of the "魅蓝Note 2" users who are in the "F29-32" group.
SQL: SELECT count(phone_brand_device_model2.device_id) FROM gender_age INNER JOIN phone_brand_device_model2 ON gender_age.device_id = phone_brand_device_model2.device_id WHERE gender_age.`group` = 'F29-32' AND phone_brand_device_model2.device_model = '魅蓝Note 2'
Database: talkingdata
Note: 30-year-old refers to age = '30'; active refers to is_active = 1; on 2016/5/2 refers to timestamp = '2016/5/2 XX:XX:XX';
Question: Give the number of 30-year-old users who were active in the events on 2016/5/2.
SQL: SELECT count(gender_age.device_id) FROM app_events INNER JOIN EVENTS ON app_events.event_id = EVENTS.event_id INNER JOIN gender_age ON EVENTS.device_id = gender_age.device_id WHERE substr(`timestamp`, 1, 10) = '2016-05-02' AND app_events.is_active = 1 AND gender_age.age = '30'
Database: talkingdata
Note: at 23:33:34 on 2016/5/6 refers to timestamp = '2016/5/6 23:33:34'; installed refers to is_installed = '1';
Question: For the event which happened at 23:33:34 on 2016/5/6, how many installed apps were involved?
SQL: SELECT count(app_events.event_id) FROM app_events INNER JOIN EVENTS ON app_events.event_id = EVENTS.event_id WHERE substr(EVENTS.`timestamp`, 1, 10) = '2016-05-06' AND app_events.is_installed = '1'
Database: talkingdata
Note: female refers to gender = 'F'; E派 brand refers to phone_brand = 'E派';
Question: Give the number of female users of "E派" brand devices.
SQL: SELECT count(phone_brand_device_model2.device_id) FROM gender_age INNER JOIN phone_brand_device_model2 ON gender_age.device_id = phone_brand_device_model2.device_id WHERE gender_age.gender = 'F' AND phone_brand_device_model2.phone_brand = 'E派'