input
stringlengths
358
16.1k
output
stringlengths
24
805
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the average age of all the vivo device users? [/INST]
SELECT AVG(age) 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';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many female users belong to the age group of 27 to 28? [/INST]
SELECT COUNT(device_id) FROM gender_age WHERE `group` = 'F27-28' AND gender = 'F';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the age of the oldest male user of the app? [/INST]
SELECT MAX(age) FROM gender_age WHERE gender = 'M';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many users installed the app but are not active? [/INST]
SELECT COUNT(app_id) FROM app_events WHERE is_installed = 1 AND is_active = 0;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the age of the youngest female user of the app? [/INST]
SELECT MIN(age) FROM gender_age WHERE gender = 'F';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many models does the VIVO phone brand released? [/INST]
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE phone_brand = 'vivo';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: List at least 15 phone models released under the OPPO brand. [/INST]
SELECT device_model FROM phone_brand_device_model2 WHERE phone_brand = 'OPPO' LIMIT 15;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: List at least 10 device models that male users over the age of 39 usually use. [/INST]
SELECT T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T2.`group` = 'M39+' AND T2.gender = 'M' LIMIT 10;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: List 5 device models that users use to install the app and are active in using the app. [/INST]
SELECT T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN events AS T2 ON T1.device_id = T2.event_id INNER JOIN app_events AS T3 ON T2.event_id = T3.event_id WHERE T3.is_active = 1 AND T3.is_installed = 1 LIMIT 5;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many users belong to "Financial Information" category? [/INST]
SELECT COUNT(T1.app_id) FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id WHERE T2.category = 'Financial Information';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many users belong to "game-Art Style" category? [/INST]
SELECT COUNT(T1.app_id) FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id WHERE T2.category = 'game-Art Style';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Provide the total number of the male users that use OPPO as their phone brand. [/INST]
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'OPPO' AND T1.gender = 'M';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the brand of the youngest user's device? [/INST]
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 ) );
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: List at least 3 categories with the lowest number of users. [/INST]
SELECT T1.category FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id ORDER BY T2.label_id LIMIT 3;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many male users use the Galaxy Ace Plus model? [/INST]
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Galaxy Ace Plus' AND T1.gender = 'M';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the age group of most OPPO users? [/INST]
SELECT T.`group` FROM ( SELECT T1.`group`, COUNT(T1.`group`) AS num FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'OPPO' GROUP BY T1.`group` ) AS T ORDER BY T.num DESC LIMIT 1;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: List at least 5 device models that are commonly used by female users. [/INST]
SELECT T.device_model FROM ( SELECT T2.device_model, COUNT(T2.device_model) AS num FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'F' GROUP BY T2.device_model ) AS T ORDER BY T.num DESC LIMIT 5;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Calculate the ratio in percentage between the average number of app users belonging to "80s Japanese comic" and "90s Japanese comic". [/INST]
SELECT SUM(IIF(T1.category = '80s Japanese comic', 1, 0)) / COUNT(T1.label_id) AS J8 , SUM(IIF(T1.category = '90s Japanese comic', 1, 0)) / COUNT(T1.label_id) AS J9 FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following 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? [/INST]
SELECT SUM(IIF(T1.phone_brand = 'OPPO', 1, 0)) / SUM(IIF(T1.device_id = 'R815T', 1, 0)) AS num FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T2.gender = 'F';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the phone brand of the device model "坚果手机"? [/INST]
SELECT phone_brand FROM phone_brand_device_model2 WHERE device_model = '坚果手机';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Give the number of device models for "中兴" phone brand. [/INST]
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE device_model = '中兴';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Which group does age 24 belong to? [/INST]
SELECT `group` FROM gender_age WHERE age = '24';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Give the time stamp for event No.887711. [/INST]
SELECT timestamp FROM events WHERE event_id = '887711';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Provide the number of events that happened on 2016/5/6. [/INST]
SELECT COUNT(event_id) FROM events WHERE SUBSTR(`timestamp`, 1, 10) = '2016-05-06';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following 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. [/INST]
SELECT T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN events AS T2 ON T1.device_id = T2.event_id WHERE T2.longitude = '113' AND T2.latitude = '28' AND T2.timestamp = '2016-05-07 23:55:16';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Give the number of "game-Fishing" apps. [/INST]
SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T1.category = 'game-Fishing';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: State the number of the "魅蓝Note 2" users who are in the "F29-32" group. [/INST]
SELECT COUNT(T2.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.`group` = 'F29-32' AND T2.device_model = '魅蓝Note 2';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Give the number of 30-year-old users who were active in the events on 2016/5/2. [/INST]
SELECT COUNT(T3.device_id) FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id INNER JOIN gender_age AS T3 ON T2.device_id = T3.device_id WHERE SUBSTR(`timestamp`, 1, 10) = '2016-05-02' AND T1.is_active = 1 AND T3.age = '30';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: For the event which happened at 23:33:34 on 2016/5/6, how many installed apps were involved? [/INST]
SELECT COUNT(T1.event_id) FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id WHERE SUBSTR(T2.`timestamp`, 1, 10) = '2016-05-06' AND T1.is_installed = '1';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Give the number of female users of "E派" brand devices. [/INST]
SELECT COUNT(T2.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'F' AND T2.phone_brand = 'E派';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many male users of the "Galaxy S5" device model? [/INST]
SELECT COUNT(T1.device_id) FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T1.device_model = 'Galaxy S5' AND T2.gender = 'M';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many users from the group "F29-32" who were active in the events on 2016/5/7? [/INST]
SELECT COUNT(T1.app_id) FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id INNER JOIN gender_age AS T3 ON T2.event_id = T3.device_id WHERE SUBSTR(T2.`timestamp`, 1, 10) = '2016-05-07' AND T1.is_active = '1' AND T3.`group` = 'F29-32';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Which category does the app id No.894384172610331000 belong to? [/INST]
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 = '894384172610331000';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: For the event which happened at 14:09:49 on 2016/5/6, in the location coordinate(116, 40), how many apps were active? [/INST]
SELECT COUNT(T1.app_id) FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id WHERE T2.timestamp = '2016-05-06 14:09:49' AND T1.is_active = '1' AND T2.longitude = '116' AND T2.latitude = '40';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many times is the number of active apps in the event that happened at 7:50:28 on 2016/5/2 than in the event that happened at 7:41:03 on 2016/5/2? [/INST]
SELECT SUM(IIF(timestamp = '2016-05-02 7:50:28', 1, 0)) / SUM(IIF(timestamp = '2016-05-02 7:41:03', 1, 0)) AS num FROM events AS T1 INNER JOIN app_events AS T2 ON T1.event_id = T2.event_id WHERE T2.is_active = '1';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many devices are of the brand vivo? [/INST]
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE phone_brand = 'vivo';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many more devices are there of the brand vivo than of the brand LG? [/INST]
SELECT SUM(IIF(phone_brand = 'vivo', 1, 0)) - SUM(IIF(phone_brand = 'LG', 1, 0)) AS num FROM phone_brand_device_model2;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the ID of the device used by the youngest user? [/INST]
SELECT device_id FROM gender_age WHERE age = ( SELECT MIN(age) FROM gender_age );
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Among the female users of the devices, how many of them are over 30? [/INST]
SELECT COUNT(device_id) FROM gender_age WHERE age > 30 AND gender = 'F';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Is the oldest device user male or female? [/INST]
SELECT gender FROM gender_age WHERE age = ( SELECT MAX(age) FROM gender_age );
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the age of the youngest female device user? [/INST]
SELECT MIN(age) FROM gender_age WHERE gender = 'F';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Among all the users who use a vivo device, what is the age of the youngest user? [/INST]
SELECT T1.age 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' ORDER BY T1.age LIMIT 1;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Please list the app IDs of all the users in the Securities category. [/INST]
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 = 'Securities';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: For the device with an event occurring on 2016/5/1 at 0:55:25, what is the gender of its user? [/INST]
SELECT T1.gender FROM gender_age AS T1 INNER JOIN events AS T2 ON T1.device_id = T2.device_id WHERE T2.timestamp = '2016-05-01 00:55:25';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Among the devices with an event occurring in 2016, how many of them are owned by a user in the M23-26 user group? [/INST]
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN events AS T2 ON T1.device_id = T2.device_id WHERE STRFTIME('%Y', T2.timestamp) = '2016' AND T1.`group` = 'M23-26';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the brand of the device used by the most users in the M23-26 user group? [/INST]
SELECT T.phone_brand FROM ( SELECT T2.phone_brand, 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 T1.`group` = 'M23-26' GROUP BY T2.phone_brand ) AS T ORDER BY T.num DESC LIMIT 1;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Please list the location coordinates of all the Galaxy Note 2 devices when an event happened. [/INST]
SELECT T1.longitude, T1.latitude FROM events AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Galaxy Note 2';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Please list all the models of the devices used by a female user. [/INST]
SELECT T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T2.gender = 'F';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What are the categories that app user ID7324884708820020000 belongs to? [/INST]
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 = 7324884708820020000;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Among the app users who were not active when event no.2 happened, how many of them belong to the category Property Industry 1.0? [/INST]
SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id INNER JOIN app_events AS T3 ON T2.app_id = T3.app_id WHERE T3.is_active = 0 AND T1.category = 'Property Industry 1.0' AND T3.event_id = 2;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many categories in total do the app users who were not active when event no.2 happened belong to? [/INST]
SELECT COUNT(*) FROM ( SELECT COUNT(DISTINCT T1.category) AS result FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id INNER JOIN app_events AS T3 ON T2.app_id = T3.app_id WHERE T3.event_id = 2 AND T3.is_active = 0 GROUP BY T1.category ) T;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the device model used by the most female users over 30? [/INST]
SELECT T.device_model FROM ( SELECT T2.device_model, COUNT(T2.device_model) 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 > 30 AND T1.gender = 'F' GROUP BY T2.device_model ) AS T ORDER BY T.num DESC LIMIT 1;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Please list the models of all the devices with an event under the location coordinates (121, 31). [/INST]
SELECT T2.device_model FROM events AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.longitude = 121 AND T1.latitude = 31;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What are the top 3 categories with the most app users? [/INST]
SELECT T.category FROM ( SELECT T2.category, COUNT(T1.app_id) AS num FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id GROUP BY T2.category ) AS T ORDER BY T.num DESC LIMIT 3;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Please list the event IDs of the events that have happened on the device of the oldest user. [/INST]
SELECT T2.event_id FROM gender_age AS T1 INNER JOIN events AS T2 ON T1.device_id = T2.device_id ORDER BY T1.age DESC LIMIT 1;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many events have happened on the device of the youngest female user? [/INST]
SELECT COUNT(T1.event_id) FROM events AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T2.gender = 'F' GROUP BY T1.event_id, T2.age ORDER BY T2.age LIMIT 1;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Among the devices on which an event happened on 2016/5/1, how many of them are used by a male user? [/INST]
SELECT COUNT(T1.device_id) FROM events AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T1.timestamp = '2016-05-01' AND T2.gender = 'M';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Which category has more app users, Securities or Finance? [/INST]
SELECT IIF(SUM(IIF(T2.category = 'Securities', 1, 0)) - SUM(IIF(T2.category = 'Finance', 1, 0)) > 0, 'Securities', 'Finance') AS diff FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Please list the device models of all the devices used by a user in the M23-26 user group. [/INST]
SELECT T2.device_model FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.`group` = 'M23-26';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the average age of the female users who uses a vivo device? [/INST]
SELECT AVG(T1.age) 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' AND T1.gender = 'F';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the ratio of female users to male users who uses a vivo device? [/INST]
SELECT SUM(IIF(T1.gender = 'M', 1, 0)) / SUM(IIF(T1.gender = 'F', 1, 0)) 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';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the ratio of the number of app users that belong to the Securities category to the number of app users that belong to the Finance category? [/INST]
SELECT SUM(IIF(T2.category = 'Securities', 1, 0)) / SUM(IIF(T2.category = 'Finance', 1, 0)) AS per FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the label ID of "Third-party card management" category? [/INST]
SELECT label_id FROM label_categories WHERE category = 'Third-party card management';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the ratio of active and inactive app users of the event ID "58"? [/INST]
SELECT SUM(IIF(is_active = 1, 1, 0)) / SUM(IIF(is_active = 0, 1, 0)) AS per FROM app_events WHERE event_id = 58;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many events did the device ID "3915082290673130000" join? [/INST]
SELECT COUNT(event_id) FROM events WHERE device_id = 3915082290673130000;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Calculate the percentage of male users among all device users. [/INST]
SELECT SUM(IIF(gender = 'M', 1, 0)) / COUNT(device_id) AS per FROM gender_age;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many events were participated by the users at longitude of "-156"? [/INST]
SELECT COUNT(event_id) FROM events WHERE longitude = -156;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many app users belong to label ID of "48"? [/INST]
SELECT COUNT(app_id) FROM app_labels WHERE label_id = 48;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many category names start with the word "game"? [/INST]
SELECT COUNT(label_id) FROM label_categories WHERE category LIKE 'game%';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Provide the number of events participated by the device users at coordinates of (80,37). [/INST]
SELECT COUNT(event_id) FROM events WHERE longitude = 80 AND latitude = 37;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: List down the labels' IDs and categories of the app ID "5758400314709850000". [/INST]
SELECT T1.label_id, T2.category FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id WHERE T1.app_id = 5758400314709850000;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: List down the app IDs under the category of game-Rowing . [/INST]
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-Rowing';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What are the label IDs and app IDs of the Chinese Classical Mythology category? [/INST]
SELECT T1.label_id, T2.app_id FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T1.category = 'Chinese Classical Mythology';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Describe the number of app IDs and location of the event ID "79641". [/INST]
SELECT COUNT(T1.app_id), T2.longitude, T2.latitude FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id WHERE T1.event_id = 79641 GROUP BY T2.longitude, T2.latitude;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Provide the locations and times of the events of app ID "8715964299802120000". [/INST]
SELECT T1.longitude, T1.latitude, T1.timestamp FROM events AS T1 INNER JOIN app_events AS T2 ON T1.event_id = T2.event_id WHERE T2.app_id = 8715964299802120000;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many OPPO users participated in events which were held around 12 AM on 1st May,2016? [/INST]
SELECT COUNT(T1.device_id) FROM events AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'OPPO' AND STRFTIME('%Y-%m-%d', T1.`timestamp`) = '2016-05-01';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the ratio of male and female users of vivo X5pro model? [/INST]
SELECT SUM(IIF(T1.gender = 'M', 1, 0)) / SUM(IIF(T1.gender = 'F', 1, 0)) 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' AND T2.device_model = 'X5Pro';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many females use ZUK Z1 phones in the age group under 23? [/INST]
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'F' AND T2.device_model = 'Z1' AND T1.`group` = 'F23-' AND T2.phone_brand = 'ZUK';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: List the phone brands and models of the users under 10 years of age. [/INST]
SELECT T2.phone_brand, T2.device_model FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.age < 10;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Among the HTC users, calculate the percentage of female users who are over 80. [/INST]
SELECT SUM(IIF(T1.gender = 'F' AND T1.age > 80, 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 = 'HTC';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Which phone brand and model was used for event ID "6701"? [/INST]
SELECT T2.phone_brand, T2.device_model FROM events AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.event_id = 6701;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Between device ID of "-9215352913819630000" and "-9222956879900150000", mention the age and gender of device user who participated more events. [/INST]
SELECT T.age, T.gender FROM ( SELECT T2.age, T2.gender, COUNT(T1.device_id) AS num FROM events AS T1 INNER JOIN gender_age AS T2 ON T1.device_id = T2.device_id WHERE T1.device_id BETWEEN -9215352913819630000 AND -9222956879900150000 GROUP BY T2.age, T2.gender ) AS T ORDER BY T.num DESC LIMIT 1;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: List out the time of the event id 12. [/INST]
SELECT timestamp FROM events WHERE event_id = 12;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many active users are there in the event? [/INST]
SELECT COUNT(app_id) FROM app_events WHERE is_active = 1;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many devices belong to model "A51"? [/INST]
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE device_model = 'A51';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: State the gender of users who use the device "-9222956879900150000". [/INST]
SELECT gender FROM gender_age WHERE device_id = -9222956879900150000;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many labels belong to the game-card category? [/INST]
SELECT COUNT(label_id) FROM label_categories WHERE category = 'game-card';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the age group of users who use phone brand of vivo? [/INST]
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 = 'vivo';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many users who are under 30 years old use device model of Galaxy Note 2? [/INST]
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Galaxy Note 2' AND T1.age < 30;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Among the users who use OPPO, calculate the percentage of those who are under 50 years old. [/INST]
SELECT SUM(IIF(T1.age < 50, 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 = 'OPPO';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the average age of the users who use model device of R7? [/INST]
SELECT SUM(T1.age) / COUNT(T1.device_id) AS avg FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'R7';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: What is the category of the label that represented the behavior category of app id 5902120154267990000? [/INST]
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;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Mention the group of age of users who use phone brand of LG. [/INST]
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';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: State the category of the label that represented the behavior category of app id 4955831798976240000. [/INST]
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 = 4955831798976240000;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many female users use device model of MI 3? [/INST]
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'F' AND T2.device_model = 'MI 3';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Among the male users, how many users use device model of Desire 820? [/INST]
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Desire 820' AND T1.gender = 'M';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Among the users who are above 20, how many users use device model of ELIFE E7 Mini? [/INST]
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'ELIFE E7 Mini' AND T1.age > 20;
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: State the number of users who are under 50 and above 20 use device model of Galaxy Premier. [/INST]
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.age BETWEEN 20 AND 50 AND T2.device_model = 'Galaxy Premier';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: Give the number of male users who use phone branded HTC. [/INST]
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'M' AND T2.phone_brand = 'HTC';
[INST] Here is a database schema: app_all : app_id [ INTEGER ] primary_key app_events : event_id [ INTEGER ] app_events.event_id = events.event_id app_id [ INTEGER ] is_installed [ bool ] is_active [ bool ] app_events_relevant : event_id [ INTEGER ] app_events_relevant.event_id = events_relevant.event_id app_id [ INTEGER ] app_events_relevant.app_id = app_all.app_id is_installed [ bool ] is_active [ bool ] app_labels : app_id [ INTEGER ] app_labels.app_id = app_all.app_id label_id [ INTEGER ] app_labels.label_id = label_categories.label_id events : event_id [ INTEGER ] primary_key device_id [ INTEGER ] timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] events_relevant : event_id [ INTEGER ] primary_key device_id [ INTEGER ] events_relevant.device_id = gender_age.device_id timestamp [ DATETIME ] longitude [ REAL ] latitude [ REAL ] gender_age : device_id [ INTEGER ] primary_key gender_age.device_id = phone_brand_device_model2.device_id gender [ TEXT ] age [ INTEGER ] group [ TEXT ] gender_age_test : device_id [ INTEGER ] primary_key gender_age_train : device_id [ INTEGER ] primary_key gender [ TEXT ] age [ INTEGER ] group [ TEXT ] label_categories : label_id [ INTEGER ] primary_key category [ TEXT ] phone_brand_device_model2 : device_id [ INTEGER ] phone_brand [ TEXT ] device_model [ TEXT ] sample_submission : device_id [ INTEGER ] primary_key F23- [ REAL ] F24-26 [ REAL ] F27-28 [ REAL ] F29-32 [ REAL ] F33-42 [ REAL ] F43+ [ REAL ] M22- [ REAL ] M23-26 [ REAL ] M27-28 [ REAL ] M29-31 [ REAL ] M32-38 [ REAL ] M39+ [ REAL ] Please write me a SQL statement that answers the following question: How many users who are between 20 and 60 use phone brand of TCL? [/INST]
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.age BETWEEN 20 AND 60 AND T2.phone_brand = 'TCL';