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, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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_time > '12PM'
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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_time = '8PM'
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
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 AS T3 ON T1.business_id = T3.business_id WHERE T2.category_name = 'Food'
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
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, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 AND T2.Match_Date = '2008-04-18' GROUP BY T3.Over_Id HAVING COUNT(T1.Toss_Name = 'field') = 17
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 = 'Sunday')) as percentage;
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 Statics: Total count 100000 - Distinct count 2 - Null count 0 user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 user_id INTEGER references lists_users (user_id), -- ); CREATE TABLE movies ( director_name TEXT, -- movie_title TEXT, -- director_id TEXT, -- movie_image_url TEXT, -- movie_title_language TEXT, -- Example Values: `en` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 director_url TEXT, -- movie_popularity INTEGER, -- movie_url TEXT, -- movie_release_year INTEGER, -- movie_id INTEGER not null primary key, ); CREATE TABLE lists ( list_creation_timestamp_utc TEXT, -- list_third_image_url TEXT, -- list_cover_image_url TEXT, -- list_description TEXT, -- list_movie_number INTEGER, -- list_first_image_url TEXT, -- user_id INTEGER references lists_users (user_id), -- list_title TEXT, -- list_comments INTEGER, -- list_second_image_url TEXT, -- list_update_timestamp_utc TEXT, -- list_id INTEGER not null primary key, list_url TEXT, -- list_followers INTEGER, -- ); CREATE TABLE lists_users ( list_update_date_utc TEXT, -- user_subscriber INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0 user_eligible_for_trial TEXT, -- Example Values: `0`, `1` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0 user_has_payment_method TEXT, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0 foreign key (list_id) references lists(list_id), foreign key (user_id) references lists(user_id), user_avatar_image_url TEXT, -- user_cover_image_url TEXT, -- primary key (user_id, list_id), user_id INTEGER not null, -- user_trialist INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0 list_id INTEGER not null, -- list_creation_date_utc TEXT, -- ); CREATE TABLE ratings ( user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 movie_id INTEGER, -- rating_url TEXT, -- user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (rating_id) references ratings(rating_id), critic TEXT, -- user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 foreign key (movie_id) references movies(movie_id), foreign key (user_id) references lists_users(user_id), foreign key (user_id) references lists_users(user_id), rating_score INTEGER, -- Example Values: `3`, `2`, `4`, `5`, `1` | Value Statics: Total count 99731 - Distinct count 5 - Null count 269 critic_likes INTEGER, -- foreign key (user_id) references ratings_users(user_id), foreign key (user_id) references ratings_users(user_id), rating_id INTEGER, -- rating_timestamp_utc TEXT, -- user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 critic_comments INTEGER, -- user_id INTEGER, -- );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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, -- times_appeared INTEGER, -- ); CREATE TABLE MenuPage ( menu_id INTEGER, -- uuid TEXT, -- foreign key (menu_id) references Menu(id), id INTEGER primary key, full_width INTEGER, -- image_id REAL, -- page_number INTEGER, -- full_height INTEGER, -- ); CREATE TABLE Menu ( language TEXT, -- currency TEXT, -- venue TEXT, -- keywords TEXT, -- currency_symbol TEXT, -- physical_description TEXT, -- page_count INTEGER, -- location TEXT, -- dish_count INTEGER, -- name TEXT, -- occasion TEXT, -- id INTEGER primary key, notes TEXT, -- sponsor TEXT, -- place TEXT, -- call_number TEXT, -- location_type TEXT, -- status TEXT, -- Example Values: `complete` | Value Statics: Total count 17527 - Distinct count 1 - Null count 0 date DATE, -- event TEXT, -- ); CREATE TABLE MenuItem ( foreign key (dish_id) references Dish(id), updated_at TEXT, -- id INTEGER primary key, ypos REAL, -- xpos REAL, -- price REAL, -- high_price REAL, -- dish_id INTEGER, -- menu_page_id INTEGER, -- created_at TEXT, -- foreign key (menu_page_id) references MenuPage(id), foreign key (menu_page_id) references MenuPage(id), );
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) * 100 / ( SELECT COUNT(user_id) FROM Users ) > 65 )
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Null count 0 constraint Elite_pk primary key (user_id, year_id), user_id INTEGER constraint Elite_Users_user_id_fk references Users, -- ); CREATE TABLE Business_Hours ( closing_time TEXT, -- business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, -- day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0 opening_time TEXT, -- constraint Business_Hours_pk primary key (business_id, day_id), ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT, -- ); CREATE TABLE Business_Categories ( business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, -- category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, -- constraint Business_Categories_pk primary key (business_id, category_id), ); CREATE TABLE Tips ( likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0 user_id INTEGER constraint Tips_Users_user_id_fk references Users, -- tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0 business_id INTEGER constraint Tips_Business_business_id_fk references Business, -- constraint Tips_pk primary key (business_id, user_id), ); CREATE TABLE Reviews ( business_id INTEGER constraint Reviews_Business_business_id_fk references Business, -- review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 constraint Reviews_pk primary key (business_id, user_id), review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 user_id INTEGER constraint Reviews_Users_user_id_fk references Users, -- review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 ); CREATE TABLE Checkins ( label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0 label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0 label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 business_id INTEGER constraint Checkins_Business_business_id_fk references Business, -- constraint Checkins_pk primary key (business_id, day_id), label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0 label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0 ); CREATE TABLE Days ( day_id INTEGER constraint Days_pk primary key, day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0 ); CREATE TABLE Years ( actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 year_id INTEGER constraint Years_pk primary key, ); CREATE TABLE Business ( business_id INTEGER constraint Business_pk primary key, state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0 city TEXT, -- active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0 stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0 review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0 ); CREATE TABLE Business_Attributes ( business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, -- attribute_value TEXT, -- constraint Business_Attributes_pk primary key (attribute_id, business_id), attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, -- ); CREATE TABLE Users_Compliments ( user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, -- constraint Users_Compliments_pk primary key (compliment_id, user_id), number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0 compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0 ); CREATE TABLE Compliments ( compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 compliment_id INTEGER constraint Compliments_pk primary key, ); CREATE TABLE Users ( user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0 user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0 user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0 user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_id INTEGER constraint Users_pk primary key, user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0 );
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 Mckellar Ave` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 city TEXT, -- Example Values: `Memphis` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 last_name TEXT, -- Example Values: `Newell`, `Simons`, `McHaney`, `Hicks`, `Al-Alawi` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 phone TEXT, -- Example Values: `(901) 774-6569`, `(901) 384-0984`, `(901) 948-1043`, `(901) 362-6674`, `(901) 947-4433` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 zip_code INTEGER, -- Example Values: `38106`, `38135`, `38118`, `38109`, `38114` | Value Statics: Total count 11 - Distinct count 7 - Null count 0 state TEXT, -- Example Values: `TN` | Value Statics: Total count 11 - Distinct count 1 - Null count 0 first_name TEXT, -- Example Values: `Sue`, `Andrea`, `Roger`, `Zachery`, `Adel` | Value Statics: Total count 11 - Distinct count 11 - Null count 0 ); CREATE TABLE customer ( state TEXT, -- annual_revenue INTEGER, -- city TEXT, -- cust_id INTEGER primary key, cust_name TEXT, -- phone TEXT, -- zip REAL, -- address TEXT, -- cust_type TEXT, -- Example Values: `manufacturer`, `wholesaler`, `retailer` | Value Statics: Total count 100 - Distinct count 3 - Null count 0 ); CREATE TABLE shipment ( driver_id INTEGER, -- Example Values: `23`, `27`, `21`, `24`, `22` | Value Statics: Total count 960 - Distinct count 11 - Null count 0 foreign key (city_id) references city(city_id), cust_id INTEGER, -- ship_date TEXT, -- weight REAL, -- ship_id INTEGER primary key, foreign key (cust_id) references customer(cust_id), foreign key (truck_id) references truck(truck_id), truck_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 960 - Distinct count 12 - Null count 0 city_id INTEGER, -- foreign key (driver_id) references driver(driver_id), ); CREATE TABLE truck ( model_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 12 - Distinct count 6 - Null count 0 truck_id INTEGER primary key, make TEXT, -- Example Values: `Peterbilt`, `Mack`, `Kenworth` | Value Statics: Total count 12 - Distinct count 3 - Null count 0 );
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );