db_id stringclasses 66
values | question stringlengths 24 325 | evidence stringlengths 1 673 ⌀ | gold_query stringlengths 23 804 | db_schema stringclasses 66
values |
|---|---|---|---|---|
retail_world | Among the employees working as Sales Representatives, how many of them are located in the UK? | Sales Representatives refers to Title = 'Sales Representative'; UK refers to Country = 'UK'; | SELECT COUNT(Country) FROM Employees WHERE Title = 'Sales Representative' AND Country = 'UK' | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
Supplier... |
shakespeare | How many acts are there in Sonnets? | Sonnets refers to Title = 'Sonnets' | SELECT SUM(DISTINCT T2.Act) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.Title = 'Sonnets' | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
Paragraph... |
soccer_2016 | How many times did Yuvraj Singh receive the Man of the Match award? | Yuvraj Singh refers to Player_Name = 'Yuvraj Singh'; receive the Man of the Match award refers to Player_Id = Man_of_the_Match | SELECT SUM(CASE WHEN T2.Player_Name = 'Yuvraj Singh' THEN 1 ELSE 0 END) FROM Match AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ... |
sales_in_weather | What is the total units of products sold on the day with the highest max temperature in store no.3 in 2012? | highest max temperature refers to Max(tmax); store no.3 refers to store_nbr = 3; in 2012 refers to substring (date, 1, 4) = '2012'; total units refers to sum(units) | SELECT SUM(units) FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND T1.`date` LIKE '%2012%' GROUP BY T3.tmax ORDER BY T3.tmax DESC LIMIT 1 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreig... |
retail_world | Which phone number should I call if I want to reach Nancy Davolio's home? | phone number of Nancy Davolio's home refers to HomePhone WHERE FirstName = 'Nancy' AND LastName = 'Davolio'; | SELECT HomePhone FROM Employees WHERE LastName = 'Davolio' AND FirstName = 'Nancy' | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
Supplier... |
video_games | What is the ratio of game sales between North America and Japan? | ratio = DIVIDE(SUM(num_sales WHERE region_name = 'North America'), SUM(num_sales WHERE region_name = 'Japan')); North America refers to region_name = 'North America'; Japan refers to region_name = 'Japan'; | SELECT SUM(CASE WHEN T2.region_name = 'North America' THEN T1.num_sales ELSE 0 END) / SUM(CASE WHEN T2.region_name = 'Japan' THEN T1.num_sales ELSE 0 END) FROM region_sales AS T1 INNER JOIN region AS T2 ON T1.region_id = T2.id | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `... |
shakespeare | List the chapter ID of the works with a year greater than the 89% of average year of all listed works of Shakespeare. | a year greater than the 89% of average year refers to DATE > multiply(divide(SUM(DATE) , COUNT(DATE)), 0.89) | SELECT T2.id FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.DATE > ( SELECT AVG(DATE) FROM works ) * 0.89 | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
Paragraph... |
soccer_2016 | From 2011 to 2012, how many Australian players became the "Man of the Match"? | From 2011 to 2012 refers to Match_Date between '2011%' and '2012%'; Australian players refers to Country_Name = 'Australia' | SELECT SUM(CASE WHEN T1.Match_Date BETWEEN '2011%' AND '2012%' THEN 1 ELSE 0 END) FROM `Match` AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match INNER JOIN Country AS T3 ON T3.Country_Id = T2.Country_Name WHERE T3.Country_Name = 'Australia' | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ... |
sales_in_weather | Please list the dates on which the sale of item no.5 in store no.3 exceeded 100 and the average wind speed exceeded 10. | item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; exceed 100 refers to units > 100; average wind speed exceeded 10 refers to avgspeed > 10 | SELECT T1.`date` FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND T1.item_nbr = 5 AND T1.units > 100 AND T3.avgspeed > 10 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreig... |
retail_world | How much higher is the salary of Andrew Fuller than that of Nancy Davolio? | how much higher = SUBTRACT(SUM(Salary WHERE LastName = 'Fuller' and FirstName = 'Andrew'), SUM(Salary WHERE LastName = 'Davolio' and FirstName = 'Nancy')); | SELECT ( SELECT Salary FROM Employees WHERE LastName = 'Fuller' AND FirstName = 'Andrew' ) - ( SELECT Salary FROM Employees WHERE LastName = 'Davolio' AND FirstName = 'Nancy' ) AS RESULT | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
Supplier... |
video_games | List down the name of strategy games. | strategy games refers to game_name WHERE genre_name = 'Strategy'; | SELECT T1.game_name FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T2.genre_name = 'Strategy' | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `... |
shakespeare | What is the description of the chapter where the character whose abrreviated name is 1Play appeared first? | abbreviated name is 1Play; appeared first refers to Abbrev = '1Play' and min(chapter_id) | SELECT T2.Description FROM paragraphs AS T1 INNER JOIN chapters AS T2 ON T1.chapter_id = T2.id INNER JOIN characters AS T3 ON T1.character_id = T3.id WHERE T3.Abbrev = '1Play' ORDER BY T1.chapter_id LIMIT 1 | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
Paragraph... |
soccer_2016 | Among the South African players, how many were born before 4/11/1980? | South African players refers to Country_Name = 'South Africa'; born before 4/11/1980 refers to DOB < '1980-4-11' | SELECT SUM(CASE WHEN T1.DOB < '1980-4-11' THEN 1 ELSE 0 END) FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_Id WHERE T2.Country_Name = 'South Africa' | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ... |
sales_in_weather | How many units of item no.5 were sold in store no.3 in total on days with a total precipitation of over 0.05? | item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; with a total precipitation of over 0.05 refers to preciptotal > 0.05 | SELECT SUM(CASE WHEN T3.preciptotal > 0.05 THEN units ELSE 0 END) AS sum FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND T1.item_nbr = 5 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreig... |
food_inspection_2 | How much salary does Jessica Anthony receive? | null | SELECT salary FROM employee WHERE first_name = 'Jessica' AND last_name = 'Anthony' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
soccer_2016 | Tally the match IDs in which V Kohli is the "Man of the Match". | null | SELECT T1.Match_Id FROM `Match` AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Match = T2.Player_Id WHERE T2.Player_Name = 'V Kohli' | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ... |
sales_in_weather | Among the days on which over 100 units of item no.5 were sold in store no.3, on which date was the temperature range the biggest? | over 100 units refers to units > 100; item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; the temperature range was the biggest refers to Max(Subtract(tmax, tmin)) | SELECT T2.`date` FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T1.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND T2.item_nbr = 5 AND T2.units > 100 ORDER BY tmax - tmin DESC LIMIT 1 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreig... |
retail_world | The sales of how many territories is Nancy Davolio in charge of? | null | SELECT COUNT(T2.TerritoryID) FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Nancy' AND T1.LastName = 'Davolio' | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
Supplier... |
video_games | What is the genre of the game ID 119? | genre of the game refers to genre_name; game ID 119 refers to game.id = 119; | SELECT T2.genre_name FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T1.id = 119 | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `... |
soccer_2016 | When did the Sunrisers Hyderabad win their first match? | Sunrisers Hyderabad refers to Team_Name = 'Sunrisers Hyderabad'; win their first match refers to Match_Winner and min(Match_Date) | SELECT T1.Match_Date FROM `Match` AS T1 INNER JOIN Team AS T2 ON T1.Match_Winner = T2.Team_Id WHERE T2.Team_Name = 'Sunrisers Hyderabad' | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ... |
sales_in_weather | How many units of item no.5 were sold in store no.3 on the day the temperature range was the biggest? | item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; when the temperature range was the biggest refers to Max(Subtract(tmax, tmin)) | SELECT t2.units FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T1.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND T2.item_nbr = 5 ORDER BY t3.tmax - t3.tmin DESC LIMIT 1 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreig... |
retail_world | Which employee has the highest salary? Please give his or her full name. | highest salary refers to MAX(Salary); full name = FirstName, LastName; | SELECT FirstName, LastName FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees ) | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
Supplier... |
olympics | What is Vijay Singh Chauhan's region name? | null | SELECT T1.region_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Vijay Singh Chauhan' | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
shakespeare | In Shakespeare's works before 1600, list down the title of the tragic story he had written that involved a character named "Tybalt". | works before 1600 refers to DATE < 1600; tragic story refers to GenreType = 'Tragedy'; character named "Tybalt" refers to CharName = 'Tybalt' | SELECT DISTINCT T1.title FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id WHERE T1.DATE < 1600 AND T1.GenreType = 'Tragedy' AND T4.CharName = 'Tybalt' | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
Paragraph... |
soccer_2016 | When and for what role did the youngest player appear in his first match? | When refers to Match_Date; youngest player refers to max(DOB); first match refers to min(Match_Date) | SELECT T1.Match_Date, T4.Role_Desc FROM `Match` AS T1 INNER JOIN Player_Match AS T2 ON T1.Match_Id = T2.Match_Id INNER JOIN Player AS T3 ON T2.Player_Id = T3.Player_Id INNER JOIN Rolee AS T4 ON T2.Role_Id = T4.Role_Id ORDER BY T3.DOB DESC LIMIT 1 | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ... |
sales_in_weather | On how many days with the max temperature over 90 did the sale of item no.5 in store no.3 exceed 100? | max temperature over 90 refers to tmax > 90; item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; sale exceed 100 refers to units > 100; number of days refers to count (date) | SELECT SUM(CASE WHEN units > 100 THEN 1 ELSE 0 END) AS count FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND SUBSTR(T1.`date`, 1, 4) = '2012' AND T1.item_nbr = 5 AND tmax > 90 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreig... |
retail_world | The sales of how many territories in total do the employees in London take charge of? | London refers to city = 'London'; | SELECT COUNT(T2.TerritoryID) FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.City = 'London' | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
Supplier... |
video_games | Give the genre of the following game titled 'Airlock' , 'Airline Tycoon' , and 'Airblade', respectively. | genre refers to genre_name; 'Airlock', 'Airline Tycoon' , and 'Airblade' refers to game_name IN ('Airlock', 'Airline Tycoon', 'Airblade'); | SELECT T2.genre_name FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T1.game_name IN ('Airlock', 'Airline Tycoon', 'Airblade') | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `... |
soccer_2016 | Who among the players won both "Man of the Series" and "Orange Cap" in the same season? | Who refers to Player_Name; | SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Season AS T2 ON T1.Player_Id = T2.Man_of_the_Series = T2.Orange_Cap | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ... |
sales_in_weather | What was the dew point on the day the most units of item no.5 were sold in store no.3 in 2012? | item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; in 2012 refers to SUBSTR(date, 1, 4) = '2012': most units sold refers to Max(units) | SELECT dewpoint FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND SUBSTR(T1.`date`, 1, 4) = '2012' AND T1.item_nbr = 5 ORDER BY units DESC LIMIT 1 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreig... |
retail_world | Which employee is in charge of the sales in Hollis? Please give the employee's full name. | Hollis refers to TerritoryDescription = 'Hollis'; full name = FirstName, LastName; | SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T3.TerritoryDescription = 'Hollis' | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
Supplier... |
shakespeare | How many paragraphs are there in "Ay, surely, mere the truth: I know his lady."? | "Ay, surely, mere the truth: I know his lady." refers to PlainText = 'Ay, surely, mere the truth: I know his lady.' | SELECT ParagraphNum FROM paragraphs WHERE PlainText = 'Ay, surely, mere the truth: I know his lady.' | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
Paragraph... |
soccer_2016 | Write down the player names and IDs of the English umpires. | English umpires refers to Country_Name = 'England' | SELECT T1.Umpire_Name, T1.Umpire_Id FROM Umpire AS T1 INNER JOIN Country AS T2 ON T1.Umpire_Country = T2.Country_Id WHERE T2.Country_Name = 'England' | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ... |
sales_in_weather | How many units of item no.5 were sold in store no.3 on the day in 2012 when the max temperature was the highest? | item no.5 refers to item_nbr = 5; store no. 3 refers to store_nbr = 3; when the max temperature was highest refers to Max(tmax); in 2012 refers to SUBSTR(date, 1, 4) = '2012' | SELECT T1.units FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND SUBSTR(T1.`date`, 1, 4) = '2012' AND T1.item_nbr = 5 ORDER BY tmax DESC LIMIT 1 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreig... |
retail_world | Please list the names of all the territories whose sales are taken in charge by Nancy Davolio. | names of all territories refers to TerritoryDescription; | SELECT T3.TerritoryDescription FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T1.FirstName = 'Nancy' AND T1.LastName = 'Davolio' | CREATE TABLE Products
(
CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0
Unit TEXT, --
ReorderLevel INT, --
ProductName TEXT, --
Price REAL DEFAULT 0, --
FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID),
Supplier... |
video_games | In which region where a game had the lowest number of sales? | which region refers to region_name; lowest number of sales refers to MIN(num_sales); | SELECT DISTINCT T1.region_name FROM region AS T1 INNER JOIN region_sales AS T2 ON T1.id = T2.region_id ORDER BY T2.num_sales LIMIT 1 | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `... |
soccer_2016 | List the players' names who were born in 1971. | players' name refers to Player_name; born in 1971 refers to DOB LIKE '1971%' | SELECT Player_name FROM Player WHERE DOB LIKE '1971%' | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ... |
sales_in_weather | What is the total number of units of item no.5 sold in store no.3 in 2012 on days when the temperature was below the 30-year normal? | item no.5 refers to item_nbr = 5; store no. 3 refers to store_nbr = 3; when the temperature was below the 30-year normal refers to depart < 0; in 2012 refers to SUBSTR(date, 1, 4) = '2012'; total number of units refers to Sum(units) | SELECT SUM(CASE WHEN T3.depart < 0 THEN units ELSE 0 END) AS sum FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND SUBSTR(T1.`date`, 1, 4) = '2012' AND T1.item_nbr = 5 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreig... |
food_inspection_2 | What is the facility type of the establishment named "Kinetic Playground"? | the establishment named "Kinetic Playground" refers to dba_name = 'Kinetic Playground' | SELECT facility_type FROM establishment WHERE dba_name = 'Kinetic Playground' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
video_games | In what platform does the game ID 178 available? | platform refers to platform_name; | SELECT T3.platform_name FROM game_publisher AS T1 INNER JOIN game_platform AS T2 ON T1.id = T2.game_publisher_id INNER JOIN platform AS T3 ON T2.platform_id = T3.id WHERE T1.game_id = 178 | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `... |
shakespeare | What are the titles and genres of the one-act works of Shakespeare? | one-act works refers to count(Act) = 1; genre refers to GenreType
| SELECT DISTINCT T1.Title, T1.GenreType FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T2.Act = 1 | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
Paragraph... |
computer_student | How many students that are undergoing the pre-phase of qualification have advisors? | students refers to student = 1 and ; undergoing the phase of pre-qualification refers to inPhase = 'Pre-Quals'; have advisors refers to advisedBy.p_id | SELECT COUNT(T1.p_id_dummy) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.inPhase = 'Pre_Quals' AND T2.student = 1 | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
computer_student | Between the faculty employee professors, how many teaches high-level or harder undergraduate courses? Indicate each of the professors unique identifying number. | faculty employee professors refers to hasPosition = 'Faculty_eme' and professor = 1; high-level or harder undergraduate courses refers to courseLevel = 'Level_400'; professors unique identifying number refers to person.p_id | SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_eme' AND T1.professor = 1 AND T3.courseLevel = 'Level_400' | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
computer_student | How many courses were taught by more than 4 people? | courses refers to taughtBy.course_id; more than 4 people refers to count(taughtBy.p_id) > 4 | SELECT COUNT(*) FROM ( SELECT COUNT(course_id) FROM taughtBy GROUP BY course_id HAVING COUNT(course_id) > 4 ) | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
computer_student | Among the students being advised by advisors, which students' year in the program do the advisors advise the majority of? | students refers to student = 1; students' year in the program do the advisors advise the majority of refers to max(count(yearsInProgram)) | SELECT T2.yearsInProgram FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.student = 1 GROUP BY T2.yearsInProgram ORDER BY COUNT(T1.p_id_dummy) DESC LIMIT 1 | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
computer_student | What is the average number of professional or master/undergraduate courses being taught by each professor? | professional or master/undergraduate courses refers to courseLevel = 'Level_500'; average number = divide(count(taughtBy.course_id), count(taughtBy.p_id)) | SELECT CAST(COUNT(T1.course_id) AS REAL) / COUNT(DISTINCT T2.p_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500' | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
computer_student | What is the sum of year 1 and year 2 students? | year 1 and year 2 students refers to yearsInProgram = 'Year_1' and yearsInProgram = 'Year_2' and student = 1 | SELECT COUNT(*) FROM person WHERE yearsInProgram = 'Year_1' OR yearsInProgram = 'Year_2' | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
computer_student | What year in the program do the students with more than 2 advisors are in? | students refers to student = 1; more than 2 advisors refers to count(p_id_dummy) > 2 | SELECT T2.yearsInProgram FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.student = 1 GROUP BY T2.p_id HAVING COUNT(T2.p_id) > 2 | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
computer_student | Which professor taught the most courses and what is the position of this person in the university? | professor refers to taughtBy.p_id; most courses refers to max(taughtBy.p_id); position refers to hasPosition | SELECT T1.p_id, T1.hasPosition FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1 | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
computer_student | What is the total of professional courses available at the university? List out all the course id. | professional courses refers to courseLevel = 'Level_500'; course id refers to course.course_id | SELECT COUNT(course_id) FROM course WHERE courseLevel = 'Level_500' | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
computer_student | How many courses were taught by a professor who is currently the member of faculty? | professor refers to professor = 1; member of faculty refers to hasPosition <> 0 | SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1 AND T1.hasPosition <> 0 | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
computer_student | Which member of the faculty are teaching the most courses and what is his/her general course level? | member of the faculty refers to hasPosition <> 0, most courses refers to max(count(course.course_id)) | SELECT T1.p_id, T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id GROUP BY T1.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1 | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
talkingdata | How many events were held at coordinate 97,40? | coordinate 97,40 refers to longitude = 97 AND latitude = 40; | SELECT COUNT(event_id) FROM `events` WHERE latitude = 40 AND longitude = 97 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
computer_student | Which courses were taught by a professor who is not a faculty member? | courses refers to taughtBy.course_id; professor refers to professor = 1; is not a faculty member refers to hasPosition = 0 | SELECT DISTINCT T2.course_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1 AND T1.hasPosition = 0 | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
talkingdata | What is the device id of the oldest user? | oldest user refers to MAX(age); | SELECT device_id FROM gender_age WHERE age = ( SELECT MAX(age) FROM gender_age ) | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | How many female users over the age of 50 are there? | female refers to gender = 'F'; over the age of 50 refers to age > 50; | SELECT COUNT(gender) FROM gender_age WHERE age > 50 AND gender = 'F' | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
computer_student | List the advisor IDs for students with eighth year of program and position status in faculty of those professors. | advisor IDs refers to p_id_dummy and person.p_id where professor = 1; eighth year of program refers to yearsInprogram = 'Year_8'; position status in faculty of those professors refers to hasPosition | SELECT T1.p_id_dummy, T2.hasPosition FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_8' | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
talkingdata | What is the gender of the youngest user? | youngest user refers to MIN(age); | SELECT gender FROM gender_age WHERE age = ( SELECT MIN(age) FROM gender_age ) | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | How many male users are in the age group of M32-38? | male refers to gender = 'M'; age group refers to group; `group` = 'M32-38'; | SELECT COUNT(gender) FROM gender_age WHERE gender = 'M' AND `group` = 'M32-38' | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | How many active users were there in the event id 2? | active users refers to is_active = 1; | SELECT COUNT(is_active) FROM app_events WHERE event_id = 2 AND is_active = 1 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | What is the model of the oldest user's device? | model of the device refers to device_model; oldest user refers to MAX(age); | SELECT T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id ORDER BY T2.age DESC LIMIT 1 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
computer_student | What is the position in the faculty of the professor who teaches the highest number of courses? | position in the faculty refers to hasPosition; professor refers to professor = 1; teaches the highest number of courses refers to max(count(taughtBy.course_id)) | SELECT T1.hasPosition FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1 GROUP BY T1.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1 | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
talkingdata | How many male users are active in the events held on 5/1/2016? | male refers to gender = 'M'; active refers to is_active = 1; on 5/1/2016 refers to timestamp LIKE '2016-05-01%'; | SELECT COUNT(T3.gender) FROM app_events AS T1 INNER JOIN events_relevant AS T2 ON T2.event_id = T1.event_id INNER JOIN gender_age AS T3 ON T3.device_id = T2.device_id WHERE T1.is_active = 1 AND T3.gender = 'M' AND T2.timestamp LIKE '2016-05-01%' | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | What is the name of the category which most users belong to? | most users belong to refers to MAX(COUNT(app_id)); name of category refers to category; | SELECT T.category FROM ( SELECT T2.category, COUNT(T1.app_id) AS num FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T2.label_id = T1.label_id GROUP BY T1.app_id, T2.category ) AS T ORDER BY T.num DESC LIMIT 1 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | How many users are there in the Home Decoration category? | null | SELECT COUNT(T1.app_id) FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T2.label_id = T1.label_id WHERE T2.category = 'Home Decoration' | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | What is the age of the oldest active user that participated in the event held on 5/6/2016 at coordinates 121, 31? | oldest user refers to MAX(age); active user refers to is_active = 1; on 5/6/2016 refers to timestamp LIKE '2016-05-06%'; coordinates 121, 31 refers to longitude = 121 AND latitude = 31; | SELECT T3.age FROM app_events AS T1 INNER JOIN events_relevant AS T2 ON T1.event_id = T2.event_id INNER JOIN gender_age AS T3 ON T2.device_id = T3.device_id WHERE T1.is_active = 1 AND T2.longitude = 121 AND T2.latitude = 31 AND SUBSTR(T2.timestamp, 1, 10) = '2016-05-06' ORDER BY T3.age DESC LIMIT 1 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
computer_student | How many advisors are in charge of advising all the students in 1st year? | advisors refers to p_id_dummy; students in 1st year refers to student = 1 and yearsInProgram = 'Year_1' | SELECT COUNT(T1.p_id_dummy) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_1' AND T2.student = 1 | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
talkingdata | What are the categories of the top 2 oldest events? | oldest event refers to MIN(timestamp); | SELECT T4.category FROM events_relevant AS T1 INNER JOIN app_events_relevant AS T2 ON T1.event_id = T2.event_id INNER JOIN app_labels AS T3 ON T3.app_id = T2.app_id INNER JOIN label_categories AS T4 ON T3.label_id = T4.label_id ORDER BY T1.timestamp LIMIT 2 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | How many female users use ZenFone 5 devices? | female refers to gender = 'F'; ZenFone 5 refers to device_model = 'ZenFone 5'; | SELECT COUNT(T1.gender) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T2.device_id = T1.device_id WHERE T1.gender = 'F' AND T2.device_model = 'ZenFone 5' | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | What is the most common device model among female users between the ages 27 to 28? | most common device model refers to MAX(COUNT(device_id)); female refers to gender = 'F'; between the ages 27 to 28 refers to group = 'F27-28'; | SELECT T2.device_model FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.`group` = 'F27-28' AND T1.gender = 'F' ORDER BY T2.device_id DESC LIMIT 1 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | Which category has the highest number of users? | highest number of users refers to MAX(COUNT(app_id)); | SELECT T.category FROM ( SELECT T2.category, COUNT(T1.app_id) AS num FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T2.label_id = T1.label_id GROUP BY T1.app_id, T2.category ) AS T ORDER BY T.num DESC LIMIT 1 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
computer_student | Among the faculty affiliated professor, how many professors teaches professional or master/undergraduate courses? | faculty affiliated professor refers to professor = 1 and hasPosition = 'Faculty_aff'; professional or master/undergraduate courses refers to courseLevel = 'Level_500' | SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id WHERE T1.hasPosition = 'Faculty_aff' AND T1.professor = 1 AND T3.courseLevel = 'Level_500' | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
talkingdata | What is the percentage of female OPPO users against the male OPPO users? | percentage = DIVIDE(MULTIPLY(CONCAT(COUNT(device_id WHERE phone_brand = 'OPPO' AND gender = 'F'), 100), COUNT(device_id)), '%') AS 'the percentage of female OPPO users'; DIVIDE(MULTIPLY(CONCAT(COUNT(device_id WHERE phone_brand = 'OPPO' AND gender = 'M'), 100), COUNT(device_id)), '%') AS 'the percentage of male OPPO use... | SELECT SUM(IIF(T2.gender = 'F', 1, 0)) * 100 / COUNT(T2.device_id) AS perFemale , SUM(IIF(T2.gender = 'M', 1, 0)) * 100 / COUNT(T2.device_id) AS perMale FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T1.phone_brand = 'OPPO' | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | What is the gender of the majority of Vivo phone users? | majority of Vivo phone users refers to MAX(COUNT(phone_brand = 'vivo')); | SELECT T.gender FROM ( SELECT T2.gender, COUNT(T2.gender) AS num FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T1.phone_brand = 'vivo' GROUP BY T2.gender ) AS T ORDER BY T.num DESC LIMIT 1 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | How many users belong to the MOBA category? | null | SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T2.label_id = T1.label_id WHERE T1.category = 'MOBA' | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | List the app users IDs and installed status for the event ID of 844. | app user IDs refers to app_id; is_installed = 1 means the app status is installed; is_installed = 0 means the app status is not installed; | SELECT app_id , IIF(is_installed = 1, 'YES', 'NO') AS status FROM app_events WHERE event_id = 844 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
computer_student | How many professors teaches no more than two high-level or harder undergraduate courses? | professors refers to taughtBy.p_id; high-level or harder undergraduate courses refers to courseLevel = 'Level_400' ; no more than two refers to count(taughtBy.course_id) < = 2 | SELECT COUNT(*) FROM ( SELECT COUNT(T2.p_id) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_400' GROUP BY T2.p_id HAVING COUNT(DISTINCT T1.course_id) <= 2 ) | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
talkingdata | How many users used Vivo Xplay3S model? | Vivo Xplay3S model refers to phone_brand = 'vivo' AND device_model = 'Xplay3S'; | SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE device_model = 'Xplay3S' AND phone_brand = 'vivo' | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | What were the locations of the events on 8th May, 2016? | location = longitude, latitude; on 8th May, 2016 refers to `timestamp` LIKE '2016-05-08%'; | SELECT longitude, latitude FROM `events` WHERE SUBSTR(`timestamp`, 1, 10) = '2016-05-08' | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | How many events were there on 30th April, 2016? | on 30th April, 2016 refers to `timestamp` LIKE '2016-04-30%'; | SELECT COUNT(event_id) FROM events WHERE SUBSTR(`timestamp`, 1, 10) = '2016-04-30' | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | What are the labels' IDs of online shopping and online malls categories? | null | SELECT label_id FROM label_categories WHERE category IN ('online shopping', 'online malls') | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
computer_student | How many professors teaches basic or medium undergraduate courses? | professors refers to taughtBy.p_id; basic or medium undergraduate courses refers to couresLevel = 'Level_300' | SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_300' | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
talkingdata | Provide the app users IDs and time for the event ID of 82. | app user IDs refers to app_id; time refers to timestamp; | SELECT T1.app_id, T2.timestamp FROM app_events AS T1 INNER JOIN events AS T2 ON T2.event_id = T1.event_id WHERE T2.event_id = 82 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | What is the ratio of male and female users in 27-28 age group? | ratio = DIVIDE(COUNT(device_id WHERE gender = 'M' AND `group` = 'M27-28'), COUNT(device_id WHERE gender = 'F' AND `group` = 'F27-28')); 27-28 age group refers to `group` = 'F27-28'; | SELECT SUM(IIF(gender = 'M' AND `group` = 'M27-28', 1, 0)) / SUM(IIF(gender = 'F' AND `group` = 'F27-28', 1, 0)) AS r FROM gender_age | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | Describe the phone brands and models of the users who participated in events on 5th May, 2016 at the coordinates of (112,44). | models refers to device_model; on 5th May, 2016 refers to timestamp LIKE '2016-05-05%'; coordinates of (112,44) refers to longitude = 112 AND latitude = 44; | SELECT DISTINCT T2.phone_brand, T2.device_model FROM events AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T2.device_id = T1.device_id WHERE T1.timestamp LIKE '2016-05-05%' AND T1.longitude = 112 AND T1.latitude = 44 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | How many events did the 88-years-old male users participate on 4th May,2016? | 88-years-old refers to age = 88; male refers to gender = 'M'; on 4th May, 2016 refers to timestamp LIKE '2016-05-04%'; | SELECT COUNT(T2.event_id) FROM gender_age AS T1 INNER JOIN events AS T2 ON T2.device_id = T1.device_id WHERE T1.gender = 'M' AND SUBSTR(`timestamp`, 1, 10) = '2016-05-04' AND T1.age = 88 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
computer_student | Who are the top 5 professors who teaches the highest number of professional or master/undergraduate courses? | professors refers to course.p_id; highest number of professional or master/undergraduate courses refers to max(count(course.course_id)) where courseLevel = 'Level_500' | SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500' GROUP BY T2.p_id ORDER BY COUNT(T2.p_id) DESC LIMIT 5 | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
talkingdata | Provide the phone brands and models of the users who were at the coordinates of (80,44). | models refers to device_model; coordinates of (80,44) refers to longitude = 80 AND latitude = 44; | SELECT DISTINCT T1.phone_brand, T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN events AS T2 ON T2.device_id = T1.device_id WHERE T2.longitude = 80 AND T2.latitude = 44 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | Describe the device user gender and age of the event ID of 15251. | null | SELECT T1.gender, T1.age FROM gender_age AS T1 INNER JOIN events AS T2 ON T2.device_id = T1.device_id WHERE T2.event_id = 15251 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | Describe the ages, genders and numbers of events participated by the users at coordinates of (-102,38). | coordinates of (-102,38) refers to longitude = -102, latitude = 38; | SELECT DISTINCT T1.age, T1.gender, COUNT(T2.event_id) FROM gender_age AS T1 INNER JOIN `events` AS T2 ON T2.device_id = T1.device_id WHERE T2.longitude = -102 AND T2.latitude = 38 GROUP BY T1.age, T1.gender, T2.longitude, T2.latitude | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | Among HTC Butterfly phone users, list any five devices' IDs used by females. | HTC Butterfly refers to phone_brand = 'HTC' AND device_model = 'Butterfly'; females refers to gender = 'F'; | SELECT T2.device_id FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T1.device_model = 'Butterfly' AND T2.gender = 'F' AND T1.phone_brand = 'HTC' LIMIT 5 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | What are the ages and genders of the LG L70 users? | LG L70 refers to phone_brand = 'LG' AND device_model = 'L70'; | SELECT T2.age, T2.gender FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T1.phone_brand = 'LG' AND T1.device_model = 'L70' | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | List the included categories in the event ID of 155. | null | SELECT DISTINCT T1.category FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T2.label_id = T1.label_id INNER JOIN app_events AS T3 ON T3.app_id = T2.app_id WHERE T3.event_id = 155 | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
talkingdata | How many app IDs were included under science fiction category? | null | SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T2.label_id = T1.label_id WHERE T1.category = 'science fiction' | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
mondial_geo | What's the number of infant mortality in Switzerland in a year? | Number can be calculated = Infant_Mortality * Population * Population_Growth | SELECT T2.Infant_Mortality * T1.Population * T2.Population_Growth FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Switzerland' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
talkingdata | Among the LG brand users, calculate the percentage of the Nexus 5 model user. What is the ratio of male and female users of it? | LG brand refers to phone_brand = 'LG'; percentage = DIVIDE(MULTIPLY(CONCAT(COUNT(device_id WHERE device_model = 'Nexus 5'), 100), COUNT(device_id)),'%'); ratio = DIVIDE(COUNT(device_id WHERE device_model = 'Nexus 5' AND gender = 'M'), COUNT(device_id WHERE device_model = 'Nexus 5' AND gender = 'F')); Nexus 5 model refe... | SELECT SUM(IIF(T1.device_model = 'Nexus 5', 1, 0)) * 100 / COUNT(T1.device_id) AS per , SUM(IIF(T1.device_model = 'Nexus 5' AND T2.gender = 'M', 1, 0)) / SUM(IIF(T1.device_model = 'Nexus 5' AND T2.gender = 'F', 1, 0)) AS r FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id W... | CREATE TABLE app_events
(
`is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
`is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
`event_id` INTEGER NOT NULL, --... |
mondial_geo | How many people are there in Fareham's mother country? | Mother country refers to home country | SELECT T1.Population FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Province = T2.Name WHERE T3.Name = 'Fareham' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
computer_student | Which professor taught the least amount of courses? | professor refers to taughtBy.p_id; least amount of courses refers to min(count(course_id)) | SELECT p_id FROM taughtBy GROUP BY p_id ORDER BY COUNT(course_id) ASC LIMIT 1 | CREATE TABLE course
(
course_id INTEGER constraint course_pk primary key,
courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0
);
CREATE TABLE advisedBy
(
p_id INTEGER, --
constraint advisedBy_pk primary key (p_id, p_id_d... |
mondial_geo | Give the full names of the countries that are located in more than one continent. | null | SELECT T3.Name FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country GROUP BY T3.Name HAVING COUNT(T3.Name) > 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
mondial_geo | How many percent of the total area of Russia is in Europe? | null | SELECT T2.Percentage FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country WHERE T3.Name = 'Russia' AND T1.Name = 'Europe' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.