db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
menu
Please list the names of all the dishes on page 1 of menu ID12882.
page 1 refers to page_number = 1;
SELECT T3.name FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T1.menu_id = 12882 AND T1.page_number = 1
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
public_review_platform
How many businesses with the category named Stadiums & Arenas are rated highest?
rated highest refers to MAX(stars); category_name = 'Stadiums & Arenas';
SELECT COUNT(T1.business_id) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T2.category_name = 'Stadiums & Arenas' AND T3.stars = ( SELECT MAX(stars) FROM Business )
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
public_review_platform
Among the active businesses in Arizona, how many businesses work after 12PM?
active businesses in Arizona refer to business_id where state = 'Arizona' and active = 'true'; work after 12PM refer to opening_time > '12PM';
SELECT COUNT(DISTINCT T2.business_id) FROM Business_Hours AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T2.active = 'true' AND T2.state = 'AZ' AND T1.opening_...
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
How many venues are located at Centurion, South Africa?
venues are located at Centurion refers to city_name = 'Centurion'; South Africa refers to country_name = 'South Africa'
SELECT COUNT(T1.Venue_name) FROM Venue AS T1 INNER JOIN City AS T2 ON T1.City_Id = T2.City_Id INNER JOIN Country AS T3 ON T2.Country_Id = T3.Country_Id WHERE T3.country_name = 'South Africa' AND T2.city_name = 'Centurion'
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 ...
public_review_platform
List active business ids with opening times of 7AM and closing times of 8PM.
opening times of 7AM and closing times of 8PM refer to Business_Hours where opening_time = '7AM' and closing_time = '8PM'; active business refers to business_id where active = 'true';
SELECT DISTINCT T4.business_id FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business_Hours AS T3 ON T2.business_id = T3.business_id INNER JOIN Business AS T4 ON T3.business_id = T4.business_id WHERE T4.active = 'true' AND T3.opening_time = '7AM' AND T3.closing...
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
How many times did K Goel played as a player only?
K Goel refers to Player_Name = 'K Goel'; played as a player only refers to Role_Id = 3
SELECT COUNT(T1.Match_Id) FROM Player_Match AS T1 INNER JOIN Player AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Rolee AS T3 ON T1.Role_Id = T3.Role_Id WHERE T2.Player_Name = 'K Goel' AND T3.Role_Id = 3
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 ...
menu
For how many times had the dish "Chicken gumbo" appeared on a menu page?
Chicken gumbo is a name of dish;
SELECT SUM(CASE WHEN T1.name = 'Chicken gumbo' THEN 1 ELSE 0 END) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
public_review_platform
Which businesses with the category name Accessories have opening hours before 7AM?
opening hours before 7AM refer to opening_time < '7AM'; businesses refer to business_id;
SELECT T1.business_id FROM Business_Hours AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T3.category_name = 'Accessories' AND SUBSTR(T1.opening_time, -4, 2) * 1 < 7 AND T1.opening_time LIKE '%AM'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
Give the name of the team of T Kohli in the match ID 335989.
team of T Kohli refers to player_name = 'T Kohli';
SELECT T1.Team_Name FROM Team AS T1 INNER JOIN Player_Match AS T2 ON T1.Team_Id = T2.Team_Id INNER JOIN Player AS T3 ON T2.Player_Id = T3.Player_Id WHERE T2.match_id = 335989 AND T3.player_name = 'T 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 ...
menu
Calculate the total price of items for menu with ID 12882.
total price = SUM(price);
SELECT SUM(T2.price) FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id WHERE T1.menu_id = 12882
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
public_review_platform
How many businesses have the category named food? List those businesses and find the percentage of businesses with less than 2 stars.
businesses have the category named food refer to business_id where category_name = 'Food'; DIVIDE(COUNT(business_id where category_name = 'Food' and stars < 2), COUNT(business_id where category_name = 'Food')) as percentage;
SELECT T3.business_id, CAST((( SELECT COUNT(business_id) FROM Business WHERE stars < 2 ) - ( SELECT COUNT(business_id) FROM Business WHERE stars > 2 )) AS REAL) * 100 / ( SELECT COUNT(stars) FROM Business ) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business...
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
Among the matches played by Royal Challengers Bangalore, what is the match ID of the match with the highest winning margin?
Royal Challengers Bangalore refers to team_name = 'Royal Challengers Bangalore'; highest winning margin refers to MAX(win_margin)
SELECT T2.match_id FROM Team AS T1 INNER JOIN Match AS T2 ON T1.team_id = T2.match_winner WHERE T1.team_name = 'Royal Challengers Bangalore' AND T2.match_date LIKE '2012%' ORDER BY T2.win_margin 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 ...
menu
How much space does page 1 of the menu "Zentral Theater Terrace" cover?
how much space = MULTIPLY(full_height, full_width); Zentral Theater Terrace is a name of menu;
SELECT T2.full_height * T2.full_width FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T1.name = 'Zentral Theater Terrace' AND T2.page_number = 1
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
public_review_platform
What are the opening and closing time of business id 1 for day id 2?
false
SELECT opening_time, closing_time FROM Business_Hours WHERE business_id = 1 AND day_id = 2
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
Provide the losing team's name in the match ID 336039.
losing team's name refers to Team_Id NOT in "match_winner" column
SELECT Team_Name FROM Team WHERE Team_Id = ( SELECT CASE WHEN Team_1 = Match_Winner THEN Team_2 ELSE Team_1 END FROM Match WHERE match_id = 336039 )
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 ...
public_review_platform
Write down the number of running business with each review count in Cave Creek city.
number of running business refers to COUNT(business_id) where active = 'true'; each review count includes review_count = 'High', review_count = 'Medium', review_count = 'Low';
SELECT SUM(CASE WHEN review_count = 'High' THEN 1 ELSE 0 END) AS high , SUM(CASE WHEN review_count = 'Medium' THEN 1 ELSE 0 END) AS Medium , SUM(CASE WHEN review_count = 'Low' THEN 1 ELSE 0 END) AS low FROM Business WHERE city = 'Cave Creek' AND active = 'true'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
public_review_platform
Please provide the name of businesses with user id "16328".
name of business refers to category_name;
SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Tips AS T3 ON T2.business_id = T3.business_id WHERE T3.user_id = 16328
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
What is the name of the team that won the first ever match?
name of the team refers to Team_Name; won the first ever match refers to Match_Winner where max(Match_Date)
SELECT T1.Team_Name FROM team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Match_Winner WHERE T2.Season_Id = 1 ORDER BY T2.Match_Date 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 ...
menu
Among the menu pages on which the dish "Chicken gumbo" had appeared, what is the menu ID of the one with the biggest width?
Chicken gumbo is a name of dish; biggest width refers to MAX(full_width);
SELECT T1.id FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Chicken gumbo' ORDER BY T1.full_width DESC LIMIT 1
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
public_review_platform
Calculate the percentage of businesses with the category name food that are open from 7AM to 8PM in the businesses with the same time.
DIVIDE(COUNT(business_id where category_name = 'Food' and opening_time = '7AM' and closing_time = '8PM'), COUNT(business_id where opening_time = '7AM' and closing_time = '8PM')) as percentage;
SELECT CAST(SUM(CASE WHEN T3.category_name = 'Food' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.category_name) FROM Business_Categories AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T1.category_id = T3.category_id
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
shipping
How many shipments were ordered by S K L Enterprises Inc in 2017?
"S K L Enterprises Inc" is the cust_name; in 2017 refers to Cast(ship_date AS DATE) = 2017
SELECT COUNT(T2.ship_id) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.cust_name = 'S K L Enterprises Inc' AND STRFTIME('%Y', T2.ship_date) = '2017'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
What is the active and inactive ratio of the business with the review count of low.
DIVIDE(COUNT(business_id where review_count = 'Low' and active = 'true'), COUNT(business_id where review_count = 'Low' and active = 'false'));
SELECT CAST(SUM(CASE WHEN active = 'true' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN active = 'false' THEN 1 ELSE 0 END) AS radio FROM Business WHERE review_count = 'Low'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
Among the matches in 2013, what is the percentage of winning of the team "Mumbai Indians"?
in 2013 refers to Match_Date like '2013%'; winning of the team "Mumbai Indians" refers to Match_Winner = 7; percentage refers to DIVIDE(COUNT(Match_Winner = 7), COUNT(Match_Winner))
SELECT CAST(SUM(CASE WHEN T2.Match_Winner = 7 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Match_Winner) FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Match_Winner WHERE T2.Match_Date LIKE '2013%'
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 ...
menu
What is the highest price of the dish "Chicken gumbo" on a menu page?
highest price refers to MAX(price); Chicken gumbo is a name of dish;
SELECT T2.price FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.name = 'Chicken gumbo' ORDER BY T2.price DESC LIMIT 1
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
menu
What is the average number of dishes per menu page of menu ID12882?
average number of dishes per menu = DIVIDE(COUNT(dish_id), COUNT(page_count));
SELECT CAST(COUNT(dish_id) AS REAL) / COUNT(T3.page_count) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id WHERE T2.menu_id = 12882
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
public_review_platform
Write down the any five of ID and name of category that starts with alphabet "P".
category that starts with alphabet "P" refers to category_name like 'P%';
SELECT category_id, category_name FROM Categories WHERE category_name LIKE 'P%' LIMIT 5
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
What is the average winning margin of the matches held in Newlands?
average winning margin refers to avg(win_margin); held in Newlands refers to venue_name = 'Newlands'
SELECT AVG(T1.win_margin) FROM Match AS T1 INNER JOIN Venue AS T2 ON T1.venue_id = T2.venue_id WHERE T2.venue_name = 'Newlands'
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 ...
shipping
Among the shipments done by Sue Newell, how many of them are for S K L Enterprises Inc?
"S K L Enterprises Inc" is the cust_name
SELECT COUNT(*) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id INNER JOIN driver AS T3 ON T3.driver_id = T2.driver_id WHERE T1.cust_name = 'S K L Enterprises Inc' AND T3.first_name = 'Sue' AND T3.last_name = 'Newell'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
soccer_2016
What is the second team's name in the match with the lowest winning margin?
lowest winning margin refers to MIN(win_margin); team name refers to team_name; second team refers to team_2
SELECT T1.team_name FROM Team AS T1 INNER JOIN Match AS T2 ON T1.team_id = T2.team_2 ORDER BY T2.win_margin 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 ...
menu
List down the name of dishes that were positioned on the left upper corner.
positioned on the left upper corner refers to xpos < 0.25 AND ypos < 0.25;
SELECT T1.name FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T2.xpos < 0.25 AND T2.ypos < 0.25
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
public_review_platform
Calculate the yearly average user who started using Yelp from the year of 2005 to 2014.
avg(user_id) where user_yelping_since_year BETWEEN '2005' AND '2014';
SELECT AVG(user_id) FROM Users WHERE user_yelping_since_year >= 2005 AND user_yelping_since_year <= 2015
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
shipping
Please list the IDs of all the shipments made by a retailer customer.
"retailer" is the cust_type;  IDs of shipments refers to ship_id
SELECT T2.ship_id FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.cust_type = 'retailer'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
soccer_2016
How many players have the bowling skill greater than 2?
bowling skill greater than 2 refers to Bowling_skill > 2
SELECT COUNT(Player_Name) FROM Player WHERE Bowling_skill > 2
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 ...
shipping
What is the total number of pounds being transported for S K L Enterprises Inc?
"S K L Enterprises Inc" is the cust_name; total number of pounds refers to Sum(weight)
SELECT SUM(T2.weight) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.cust_name = 'S K L Enterprises Inc'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
List any five of user ID who became elite user in 2006.
year_id = '2006';
SELECT user_id FROM Elite WHERE year_id = 2006 LIMIT 5
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
What is the venue for the match ID 829768?
venue refers to Venue_Name
SELECT T1.Venue_Name FROM Venue AS T1 INNER JOIN Match AS T2 ON T1.venue_id = T2.venue_id WHERE T2.match_id = 829768
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 ...
shipping
What is the full name of the driver that has done the most shipments in 2017?
driver refers to driver_id; full name refers to first_name, last_name; in 2017 refers to Cast(ship_date AS DATE) = 2017; Most shipment refers to Max(Sum(weight))
SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE STRFTIME('%Y', T1.ship_date) = '2017' GROUP BY T2.first_name, T2.last_name ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
soccer_2016
How many players were born in the 80s and have bowling skill of 2?
born in the 80s refers to DOB like '198%'; have bowling skill of 2 refers to Bowling_skill = 2;
SELECT COUNT(Player_Name) FROM Player WHERE DOB LIKE '198%' AND Bowling_skill = 2
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 ...
soccer_2016
What is the difference between the number of matches where SC Ganguly played as a Captain and those matches where he played other roles?
SC Ganguly refers to Player_Name = 'SC Ganguly'; played as a Captain refers to Role_Id = 1; played other roles refers to Role_Id > 1; difference refers to SUBTRACT(COUNT(Role_Id = 1), COUNT(Role_Id > 1))
SELECT SUM(CASE WHEN T3.Role_Id = 1 THEN 1 ELSE 0 END) - SUM(CASE WHEN T3.Role_Id > 1 THEN 1 ELSE 0 END) FROM Player_Match AS T1 INNER JOIN Player AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Rolee AS T3 ON T1.Role_Id = T3.Role_Id WHERE T2.Player_Name = 'SC Ganguly'
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 ...
shipping
How many shipments were ordered by a customer in Florida?
customer in Florida refers to state = 'FL'
SELECT COUNT(T1.cust_id) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.state = 'FL'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
List down the business ID and attribute value of the attribute name of "payment_types_visa".
null
SELECT T2.business_id, T2.attribute_value FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name = 'payment_types_visa'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
How many victory matches were there in 2008?
in 2008 refers to Match_Date like '2008%'
SELECT COUNT(Match_Id) FROM Match WHERE Match_Date LIKE '2008%' AND Match_Winner IS NOT NULL
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 ...
shipping
How many shipments in 2017 were done by Sue Newell?
in 2017 refers to Cast(ship_date AS DATE) = 2017
SELECT COUNT(*) FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE STRFTIME('%Y', T1.ship_date) = '2017' AND T2.first_name = 'Sue' AND T2.last_name = 'Newell'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
List out the state of businesses which have opening time at 1AM.
state refers to city
SELECT DISTINCT T1.state FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T2.opening_time = '1AM'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
How many players were born in 1970?
born in 1970 refers to DOB like '1970%';
SELECT COUNT(Player_Name) FROM Player WHERE DOB LIKE '1970%'
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 ...
menu
Calculate the total dish count for menu with uuid of "510d47e4-2958-a3d9-e040-e00a18064a99" & "510d47e4-295a-a3d9-e040-e00a18064a99".
total dish count for uuid of '510d47e4-2958-a3d9-e040-e00a18064a99' = SUM(dish_count WHERE uuid = '510d47e4-2958-a3d9-e040-e00a18064a99'); total dish count for uuid of '510d47e4-295a-a3d9-e040-e00a18064a99 = SUM(dish_count WHERE uuid = '510d47e4-295a-a3d9-e040-e00a18064a99');
SELECT SUM(CASE WHEN T2.uuid = '510d47e4-2958-a3d9-e040-e00a18064a99' THEN T1.dish_count ELSE 0 END) - SUM(CASE WHEN T2.uuid = '510d47e4-295a-a3d9-e040-e00a18064a99' THEN T1.dish_count ELSE 0 END) FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
soccer_2016
What is the city name of country ID 3?
null
SELECT City_Name FROM City WHERE Country_ID = 3
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 ...
shipping
What is the maximum weight being transported to New York during a single shipment?
"New York" is the city_name; maximum weight refers to Max(weight)
SELECT MAX(T1.weight) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.city_name = 'New York'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
Mention the user ID and their year of joining Yelp who had great experience on business ID 143.
year of joining Yelp refers to user_yelping_since_year; great experience refers to Reviews where review_stars = 5;
SELECT T2.user_id, T2.user_yelping_since_year FROM Reviews AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.business_id = 143 AND T1.review_stars = 5
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
shipping
Among the customers having at least one shipment in 2017, how many of them have an annual revenue of over 30000000?
shipment in 2017 refers to Cast(ship_date AS DATE) = 2017; annual revenue of over 30000000 refers to annual_revenue > 30000000
SELECT COUNT(COUNTCUSID) FROM ( SELECT COUNT(T1.cust_id) AS COUNTCUSID FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE STRFTIME('%Y', T2.ship_date) = '2017' AND T1.annual_revenue > 30000000 GROUP BY T1.cust_id HAVING COUNT(T2.ship_id) >= 1 ) T3
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
Provide the list of user ID along with review star of which has the review length of medium with business ID of 35.
;
SELECT user_id, review_stars FROM Reviews WHERE business_id = 15 AND review_length = 'Medium'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
How old is SC Ganguly in 2008?
SC Ganguly refers to Player_Name = 'SC Ganguly'; old refers to SUBTRACT(2008, strftime('%Y',DOB))
SELECT 2008 - strftime('%Y', DOB) FROM Player WHERE Player_Name = 'SC Ganguly'
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 ...
shipping
Please list the destination cities of all the shipments ordered by S K L Enterprises Inc.
"S K L Enterprises Inc" is the cust_name; destination cities refers to city_name
SELECT DISTINCT T3.city_name FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id INNER JOIN city AS T3 ON T3.city_id = T2.city_id WHERE T1.cust_name = 'S K L Enterprises Inc'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
List the user ID, business ID with review length of the business which received the most likes in tips.
business which received the most likes refers to business_id where MAX(likes);
SELECT T1.user_id, T1.business_id, T2.review_length FROM Tips AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id ORDER BY T1.likes DESC LIMIT 1
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
How many matches are there in April, 2008?
in April, 2008 refers to Match_date like '2008-04%'
SELECT COUNT(Match_Id) FROM Match WHERE Match_date LIKE '2008-04%'
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 ...
public_review_platform
Describe ID and active status of the business under category of "Diagnostic Imaging".
ID refers to business_id; category of "Diagnostic Imaging" refers to category_name = 'Diagnostic Imaging';
SELECT T2.business_id, T3.active FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.category_name = 'Diagnostic Imaging'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
Provide the country ID of East London.
East London refers to City_Name = 'East London'
SELECT Country_id FROM City WHERE City_Name = 'East London'
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 ...
shipping
Among the shipments in 2017, how many of them have the destination in New Jersey?
in 2017 refers to Cast(ship_date AS DATE) = 2017; 'New Jersey' is the state
SELECT COUNT(*) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE STRFTIME('%Y', T1.ship_date) = '2017' AND T2.state = 'New Jersey'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
soccer_2016
How many players are Indians?
are Indians refers to Country_Name = 'India'
SELECT COUNT(T1.Player_Id) FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_ID WHERE T2.Country_Name = 'India'
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 ...
shipping
How much more pounds in total were transported to New York than to Chicago?
"New York" and "Chicago" are both city_name; more pounds in total refers to Subtract (Sum(weight where city_name = 'New York'), Sum(weight where city_name = 'Chicago'))
SELECT SUM(CASE WHEN T2.city_name = 'New York' THEN T1.weight ELSE 0 END) - SUM(CASE WHEN T2.city_name = 'Chicago' THEN T1.weight ELSE 0 END) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
Among the user ID with number in compliment of uber on profile, list any 5 user ID and the year when they join Yelp.
when join Yelp refers to user_yelping_since_year; compliment_type = 'profile'; number_of_compliments = 'Uber';
SELECT T3.user_id, T3.user_yelping_since_year FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T1.compliment_type = 'profile' AND T2.number_of_compliments = 'Uber' LIMIT 5
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
Calculate the run rate at the end of 17 overs of the match ID 335987 on 4/18/2008.
4/18/2008 refers to Match_Date = 4/18/2008; end of 17 overs refers to count(Toss_Name = 'field' ) = 17; run rate = divide(sum(Runs_Scored) when Toss_Name = 'bat', sum(Over_Id) when Toss_Name = 'field')
SELECT CAST(COUNT(CASE WHEN T1.Toss_Name = 'bat' THEN T3.Runs_Scored ELSE NULL END) AS REAL) / SUM(CASE WHEN T1.Toss_Name = 'field' THEN 1 ELSE 0 END) FROM Toss_Decision AS T1 INNER JOIN Match AS T2 ON T1.Toss_Id = T2.Toss_Decide INNER JOIN Batsman_Scored AS T3 ON T2.Match_Id = T3.Match_Id WHERE T2.Match_Id = 335987 AN...
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 ...
shipping
Among all the shipments to Florida, what is the percentage of the shipment to Jacksonville?
"Florida" is the state; "Jacksonville" is city_name;
SELECT CAST(SUM(CASE WHEN T2.city_name = 'Jacksonville' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.state = 'Florida'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
Calculate the percentage of business which opened on Sunday from 9AM to 9PM based on the number of business opened on Sunday.
Sunday refers to day_of_week = 'Sunday' where day_id = 1; opened from 9AM to 9PM refers to Business_Hours where opening_time = '9AM' and closing_time = '9PM'; DIVIDE(COUNT(opening_time = '9AM' and closing_time = '9PM' and day_of_week = 'Sunday'), COUNT(opening_time = NOT NULL and closing_time = NOT NULL and day_of_week...
SELECT CAST(SUM(CASE WHEN T2.opening_time = '9AM' AND T2.closing_time = '9PM' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.day_id) FROM Days AS T1 INNER JOIN Business_Hours AS T2 ON T1.day_id = T2.day_id WHERE T1.day_of_week = 'Sunday'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
What is the venue name of Bandladore?
Bandladore refers to City_Name = 'Bangalore'
SELECT T1.Venue_Name FROM Venue AS T1 INNER JOIN City AS T2 ON T1.City_ID = T2.City_ID WHERE T2.City_Name = 'Bangalore'
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 ...
menu
List the top five dishes, by descending order, in terms of highest price.
highest price refers to MAX(highest_price);
SELECT name FROM Dish ORDER BY highest_price DESC LIMIT 5
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
public_review_platform
Among the businesses with average rating, how many business has attribute of full_bar.
average rating refers to avg(stars); attribute of full_bar refers to attribute_value = 'full_bar'
SELECT COUNT(T1.business_id) FROM Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.attribute_value = 'full_bar'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
List the names of players who play by the left hand.
play by the left hand refers to Batting_hand =   'Left-hand bat'
SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Batting_Style AS T2 ON T1.Batting_hand = T2.Batting_Id WHERE T2.Batting_hand = 'Left-hand bat'
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 ...
shipping
How many shipments were delivered by the oldest truck model?
oldest truck model refers to Min(model_year)
SELECT COUNT(*) FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id GROUP BY T1.model_year ORDER BY T1.model_year ASC LIMIT 1
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
Within the user who joined Yelp in 2004, explore the user ID with average star of 5 and it's review length on the business.
user who joined Yelp in 2004 refers to user_id where user_yelping_since_year = 2014; user_average_stars = 5;
SELECT T2.user_id, T2.review_length FROM Users AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2004 AND T1.user_average_stars = 5
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
shipping
What is the average weight of the goods being transported on a single shipment ordered by S K L Enterprises Inc?
"S K L Enterprises Inc" is the cust_name; average = Divide (Sum(weight), Count(ship_id))
SELECT AVG(T2.weight) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.cust_name = 'S K L Enterprises Inc'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
Among the elite users of 10 consecutive year from 2005 to 2014, list down the user ID and their number of compliment on photos.
from 2005 to 2014 refers to year_id BETWEEN 2005 AND 2014; compliment_type = 'photos';
SELECT T2.user_id, T2.number_of_compliments FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id INNER JOIN Elite AS T3 ON T2.user_id = T3.user_id WHERE T3.year_id BETWEEN 2005 AND 2014 AND T1.compliment_type = 'photos'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
List the name of England players.
England players refers to Country_Name = 'England'
SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = 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 ...
shipping
Where was the destination city of shipment no.1701?
shipment no. 1701 refers to ship_id = 1701; destination city refers to city_name
SELECT T2.city_name FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.ship_id = '1701'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
movie_platform
What is the average rating for movie titled 'When Will I Be Loved'?
average rating = DIVIDE((SUM(rating_score where movie_title = 'When Will I Be Loved')), COUNT(rating_score));
SELECT AVG(T2.rating_score) FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T1.movie_title = 'When Will I Be Loved'
CREATE TABLE ratings_users ( user_cover_image_url TEXT, -- user_avatar_image_url TEXT, -- rating_date_utc TEXT, -- user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S...
shipping
State the headquarter of the truck which completed shipment no.1045.
shipment no. 1045 refers to ship_id = 1045; headquarter refers to if make = 'Peterbit', then 'Texax(TX)', if make = 'Mack', then 'North Carolina (NC)'; if make = 'Kenworth', then 'Washington (WA)'
SELECT T1.make FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = 1045
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
Write down the ID and opening day of a week for the business which are running in Black Canyon City.
running refers to active = 'true'; opening day of a week means days of the week when business is open;
SELECT T2.business_id, T3.day_of_week FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.city = 'Black Canyon City' AND T1.active = 'true'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
What are the names of players that have run scored less than 3?
scored less than 3 refers to Runs_Scored < 3; name of player refers to Player_name;
SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Batsman_Scored AS T3 ON T2.Match_ID = T3.Match_ID WHERE T3.Runs_Scored < 3 GROUP BY T1.Player_Name
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 ...
shipping
Who was the customer of shipment no.1275? Give the customer's name.
shipment no. 1275 refers to ship_id = 1275; customer name refers to cust_name
SELECT T1.cust_name FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T2.ship_id = '1275'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
Calculate the difference between running business in Glendale City and Mesa City.
running business refers to business where active = 'true';
SELECT SUM(CASE WHEN city = 'Glendale' THEN 1 ELSE 0 END) - SUM(CASE WHEN city = 'Mesa' THEN 1 ELSE 0 END) AS diff FROM Business WHERE active = 'true'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
What is the id of the team with the highest number of matches won?
id of the team refers to Team_Id; highest number of matches won refers to max(count(Match_Winner))
SELECT Match_Id FROM `Match` ORDER BY Match_Winner 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 ...
public_review_platform
Among the businesses which have short length of review, which one located in Phoenix?
short length of review refers to review_length = 'Short'; in Phoenix refers to city = 'Phoenix'
SELECT DISTINCT T1.business_id FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Phoenix' AND T2.review_length = 'Short'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
List the names of players who played as a keeper.
played as a keeper refers to Role_Desc = 'Keeper'; name of player refers to Player_Name;
SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Rolee AS T3 ON T2.Role_Id = T3.Role_Id WHERE T3.Role_Desc = 'Keeper' GROUP BY T1.Player_Name
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 ...
shipping
Tell the name of the driver who received the shipment on 2017/11/5.
shipment on 2017/11/5 refers to ship_date = '2017-11/05'; name refers to first_name, last_name
SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_date = '2017-11-05'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
For users with average ratings of 3, what kind of tip length they mostly left?
average ratings of 3 refer to user_average_stars = 3; kind of tip length they mostly left refers to tip_length where MAX(COUNT(user_id));
SELECT T2.tip_length FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T1.user_average_stars = 3 GROUP BY T2.tip_length ORDER BY COUNT(T2.tip_length) DESC LIMIT 1
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
What are the names of players who participated in season year 2008?
season year 2008 refers to Season_Year = 2008
SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Match AS T2 ON T1.Player_Id = T2.Man_of_the_Match INNER JOIN Player_Match AS T3 ON T3.Player_Id = T1.Player_Id INNER JOIN Season AS T4 ON T2.Season_Id = T4.Season_Id WHERE T4.Season_Year = 2008 GROUP BY T1.Player_Name
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 ...
menu
Calculate the image area of the page menu for the dish named "Baked Stuffed Mullet & Sauce Pomard". Please include the page number and image ID.
image area = MULTIPLY(full_height, full_width);
SELECT T1.full_height * T1.full_width, T1.page_number, T1.image_id FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Baked Stuffed Mullet & Sauce Pomard'
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
public_review_platform
Which business ID received the review of 4 star and above by 65% of user? Describe their active status and city.
review of 4 star and above refers to stars > 4; DIVIDE(SUM(stars > 4), COUNT(business_id)) = 0.65;
SELECT DISTINCT T2.business_id, T2.city FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.review_stars >= 4 AND ( SELECT CAST(( SELECT COUNT(DISTINCT T1.user_id) FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.review_stars >= 4 ) AS REAL) *...
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
What is the role of SC Ganguly?
SC Ganguly refers to Player_Name = 'SC Ganguly'; role refers to Role_Desc
SELECT T3.Role_Desc FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Rolee AS T3 ON T2.Role_Id = T3.Role_Id WHERE T1.Player_Name = 'SC Ganguly' GROUP BY T3.Role_Desc
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 ...
shipping
For the shipment received by Leszek Kieltyka on 2017/9/25, what was its weight?
on 2017/9/25 refers to ship_date = '2017-09-25'
SELECT T1.weight FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T2.first_name = 'Leszek' AND T2.last_name = 'Kieltyka' AND T1.ship_date = '2017-09-25'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
How many likes did short comment left by users who joined in 2010 get?
short comment refers to tip_length = 'Short'; users who joined in 2010 refer to user_id where user_yelping_since_year = 2010;
SELECT SUM(T2.likes) FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2010
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
soccer_2016
How many players played as a captain in season year 2008?
played as a captain refers to Role_Desc = 'Captain'; in season year 2008 refers Match_Date like '2008%'
SELECT COUNT(T1.Player_Id) FROM Player_Match AS T1 INNER JOIN Match AS T2 ON T1.Match_Id = T2.Match_Id INNER JOIN Rolee AS T3 ON T1.Role_Id = T3.Role_Id WHERE T3.Role_Desc = 'Captain' AND T2.Match_Date LIKE '2008%'
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 ...
shipping
Give the name of the driver of shipment no.1021.
shipment no. 1021 refers to ship_id = 1021; name refers to first_name, last_name
SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = '1021'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
For businesses with long length reviews, which state are they located?
businesses with long length tips refer to business_id where tip_length = 'Long';
SELECT DISTINCT T1.state FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T2.tip_length = 'Long'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
shipping
Provide the ship date of the first shipment to customers in South Carolina.
"South Carolina" refers to state = 'SC'; first shipment refers to Min(ship_date)
SELECT MIN(T1.ship_date) FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T2.state = 'SC'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
soccer_2016
How many players have won at least 5 man of the match awards?
won at least 5 man of the match awards refers to COUNT(Match_Id) > = 5
SELECT COUNT(Match_Id) FROM `Match` GROUP BY Man_of_the_Match HAVING COUNT(Match_Id) >= 5
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 ...
shipping
Provide the weight of the shipment to U-haul Center Of N Syracuse on 2016/9/21.
"U-haul Center Of N Syracuse" is the cust_name; on 2016/9/21 refers to ship_date = '2016/09/21'
SELECT T1.weight FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T2.cust_name = 'U-haul Center Of N Syracuse' AND T1.ship_date = '2016-09-21'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
public_review_platform
List down the closing day of businesses located at SC State.
closing day refers to SUBTRACT(days.day_id, business_Hours.day_id)
SELECT T3.day_id - T2.day_id FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.state = 'SC'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
shipping
Show the population of the city which was the destination of shipment no.1398.
shipment no. 1398 refers to ship_id = 1398
SELECT T2.population FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.ship_id = '1398'
CREATE TABLE city ( population INTEGER, -- state TEXT, -- city_name TEXT, -- city_id INTEGER primary key, area REAL, -- ); CREATE TABLE driver ( driver_id INTEGER primary key, address TEXT, -- Example Values: `268 Richmond Ave`, `3574 Oak Limb Cv`, `1839 S Orleans St`, `3649 Park Lake Dr`, `749 E Mckell...
soccer_2016
What type did match ID 336000 win?
type of match won refers to Win_Type
SELECT T2.Win_Type FROM Match AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id WHERE T1.Match_Id = 336000
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 ...