db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
codebase_comments
What is the average processed time of the solution paths inside the "https://github.com/zphingphong/DiscardCustomerApp.git"?
average processed time = avg(Solution.ProcessedTime);
SELECT CAST(SUM(T2.ProcessedTime) AS REAL) / COUNT(T2.RepoId) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Url = 'https://github.com/zphingphong/DiscardCustomerApp.git'
CREATE TABLE Method ( ApiCalls TEXT, -- NameTokenized TEXT, -- Name TEXT, -- SolutionId INTEGER, -- CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 SampledAt INTEGER, -- Id INTEGER not null primary key autoincrement, Lang TEXT, -- FullComment TEXT, -- Summary TEXT, -- ); CREATE TABLE Repo ( Stars INTEGER, -- Forks INTEGER, -- Watchers INTEGER, -- Id INTEGER not null primary key autoincrement, ProcessedTime INTEGER, -- Url TEXT, -- ); CREATE TABLE Solution ( WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 Id INTEGER not null primary key autoincrement, RepoId INTEGER, -- ProcessedTime INTEGER, -- Path TEXT, -- ); CREATE TABLE MethodParameter ( Name TEXT, -- MethodId TEXT, -- Id INTEGER not null primary key autoincrement, Type TEXT, -- );
address
Show the zip code of the county represented by Buchanan Vernon.
null
SELECT T2.zip_code FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.first_name = 'Buchanan' AND T1.last_name = 'Vernon'
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area_code ( primary key (zip_code, area_code), zip_code INTEGER, -- area_code INTEGER, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE congress ( House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0 District INTEGER, -- land_area REAL, -- party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0 abbreviation TEXT, -- state TEXT, -- cognress_rep_id TEXT primary key, CID TEXT, -- foreign key (abbreviation) references state(abbreviation), first_name TEXT, -- last_name TEXT, -- ); CREATE TABLE avoid ( primary key (zip_code, bad_alias), bad_alias TEXT, -- foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE zip_data ( population_2010 INTEGER, -- "1st_quarter_payroll" INTEGER, -- residential_mailboxes INTEGER, -- american_indian_population INTEGER, -- spouses INTEGER, -- over_65 INTEGER, -- employees INTEGER, -- white_population INTEGER, -- multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 businesses INTEGER, -- black_population INTEGER, -- avg_house_value INTEGER, -- children INTEGER, -- foreign key (state) references state(abbreviation), single_family_delivery_units INTEGER, -- time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608 parents_and_widowed INTEGER, -- state_fips INTEGER, -- monthly_benefits_all INTEGER, -- male_population INTEGER, -- type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0 population_2020 INTEGER, -- other_population INTEGER, -- avg_income_per_household INTEGER, -- daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 female_median_age REAL, -- annual_payroll INTEGER, -- female_population INTEGER, -- persons_per_household REAL, -- division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838 city TEXT, -- total_delivery_receptacles INTEGER, -- organization TEXT, -- state TEXT, -- monthly_benefits_retired_workers INTEGER, -- foreign key (CBSA) references CBSA(CBSA), asian_population INTEGER, -- hispanic_population INTEGER, -- male_median_age REAL, -- region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838 county_fips INTEGER, -- median_age REAL, -- retired_workers INTEGER, -- total_beneficiaries INTEGER, -- latitude REAL, -- households INTEGER, -- hawaiian_population INTEGER, -- monthly_benefits_widowed INTEGER, -- water_area REAL, -- business_mailboxes INTEGER, -- longitude REAL, -- multi_family_delivery_units INTEGER, -- CBSA INTEGER, -- zip_code INTEGER primary key, elevation INTEGER, -- land_area REAL, -- disabled_workers INTEGER, -- ); CREATE TABLE alias ( foreign key (zip_code) references zip_data(zip_code), alias TEXT, -- zip_code INTEGER primary key, ); CREATE TABLE zip_congress ( district TEXT, -- foreign key (district) references congress(cognress_rep_id), primary key (zip_code, district), foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE CBSA ( CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0 CBSA INTEGER primary key, CBSA_name TEXT, -- );
codebase_comments
Among the repositories whose number of stars received are between 6,000 to 9,000, which repository has the highest number of solution paths and many of those solution paths needs to be compiled if user wants to implement it?
Stars between 6,000 to 9,000; highest number of solution paths refers to max(count(Path)); needs to be compiled if user wants to implement it refers to WasCompiled = 0;
SELECT T2.RepoId, COUNT(T2.RepoId) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Stars BETWEEN 6000 AND 9000 AND T2.WasCompiled = 0 GROUP BY T2.RepoId ORDER BY COUNT(T2.RepoId) DESC LIMIT 1
CREATE TABLE Method ( ApiCalls TEXT, -- NameTokenized TEXT, -- Name TEXT, -- SolutionId INTEGER, -- CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 SampledAt INTEGER, -- Id INTEGER not null primary key autoincrement, Lang TEXT, -- FullComment TEXT, -- Summary TEXT, -- ); CREATE TABLE Repo ( Stars INTEGER, -- Forks INTEGER, -- Watchers INTEGER, -- Id INTEGER not null primary key autoincrement, ProcessedTime INTEGER, -- Url TEXT, -- ); CREATE TABLE Solution ( WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 Id INTEGER not null primary key autoincrement, RepoId INTEGER, -- ProcessedTime INTEGER, -- Path TEXT, -- ); CREATE TABLE MethodParameter ( Name TEXT, -- MethodId TEXT, -- Id INTEGER not null primary key autoincrement, Type TEXT, -- );
address
For the county where DeSantis Ron is from, what is the average female median age?
average female median age refers to Divide (Sum(female_median_age), Count(county))
SELECT SUM(T4.female_median_age) / COUNT(T1.county) FROM country AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id INNER JOIN zip_data AS T4 ON T1.zip_code = T4.zip_code WHERE T3.first_name = 'DeSantis' AND T3.last_name = 'Ron'
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area_code ( primary key (zip_code, area_code), zip_code INTEGER, -- area_code INTEGER, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE congress ( House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0 District INTEGER, -- land_area REAL, -- party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0 abbreviation TEXT, -- state TEXT, -- cognress_rep_id TEXT primary key, CID TEXT, -- foreign key (abbreviation) references state(abbreviation), first_name TEXT, -- last_name TEXT, -- ); CREATE TABLE avoid ( primary key (zip_code, bad_alias), bad_alias TEXT, -- foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE zip_data ( population_2010 INTEGER, -- "1st_quarter_payroll" INTEGER, -- residential_mailboxes INTEGER, -- american_indian_population INTEGER, -- spouses INTEGER, -- over_65 INTEGER, -- employees INTEGER, -- white_population INTEGER, -- multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 businesses INTEGER, -- black_population INTEGER, -- avg_house_value INTEGER, -- children INTEGER, -- foreign key (state) references state(abbreviation), single_family_delivery_units INTEGER, -- time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608 parents_and_widowed INTEGER, -- state_fips INTEGER, -- monthly_benefits_all INTEGER, -- male_population INTEGER, -- type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0 population_2020 INTEGER, -- other_population INTEGER, -- avg_income_per_household INTEGER, -- daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 female_median_age REAL, -- annual_payroll INTEGER, -- female_population INTEGER, -- persons_per_household REAL, -- division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838 city TEXT, -- total_delivery_receptacles INTEGER, -- organization TEXT, -- state TEXT, -- monthly_benefits_retired_workers INTEGER, -- foreign key (CBSA) references CBSA(CBSA), asian_population INTEGER, -- hispanic_population INTEGER, -- male_median_age REAL, -- region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838 county_fips INTEGER, -- median_age REAL, -- retired_workers INTEGER, -- total_beneficiaries INTEGER, -- latitude REAL, -- households INTEGER, -- hawaiian_population INTEGER, -- monthly_benefits_widowed INTEGER, -- water_area REAL, -- business_mailboxes INTEGER, -- longitude REAL, -- multi_family_delivery_units INTEGER, -- CBSA INTEGER, -- zip_code INTEGER primary key, elevation INTEGER, -- land_area REAL, -- disabled_workers INTEGER, -- ); CREATE TABLE alias ( foreign key (zip_code) references zip_data(zip_code), alias TEXT, -- zip_code INTEGER primary key, ); CREATE TABLE zip_congress ( district TEXT, -- foreign key (district) references congress(cognress_rep_id), primary key (zip_code, district), foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE CBSA ( CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0 CBSA INTEGER primary key, CBSA_name TEXT, -- );
codebase_comments
What is the linearized sequenced of API calls of the method whose solution path is "mauriciodeamorim_tdd.encontro2\Tdd.Encontro2.sln"?
linearized sequenced of API calls refers to ApiCalls;
SELECT T2.ApiCalls FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.Path = 'mauriciodeamorim_tdd.encontro2Tdd.Encontro2.sln'
CREATE TABLE Method ( ApiCalls TEXT, -- NameTokenized TEXT, -- Name TEXT, -- SolutionId INTEGER, -- CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 SampledAt INTEGER, -- Id INTEGER not null primary key autoincrement, Lang TEXT, -- FullComment TEXT, -- Summary TEXT, -- ); CREATE TABLE Repo ( Stars INTEGER, -- Forks INTEGER, -- Watchers INTEGER, -- Id INTEGER not null primary key autoincrement, ProcessedTime INTEGER, -- Url TEXT, -- ); CREATE TABLE Solution ( WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 Id INTEGER not null primary key autoincrement, RepoId INTEGER, -- ProcessedTime INTEGER, -- Path TEXT, -- ); CREATE TABLE MethodParameter ( Name TEXT, -- MethodId TEXT, -- Id INTEGER not null primary key autoincrement, Type TEXT, -- );
address
How many counties are there in Virginia State?
"Virginia" is the state
SELECT COUNT(T2.county) FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Virginia'
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area_code ( primary key (zip_code, area_code), zip_code INTEGER, -- area_code INTEGER, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE congress ( House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0 District INTEGER, -- land_area REAL, -- party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0 abbreviation TEXT, -- state TEXT, -- cognress_rep_id TEXT primary key, CID TEXT, -- foreign key (abbreviation) references state(abbreviation), first_name TEXT, -- last_name TEXT, -- ); CREATE TABLE avoid ( primary key (zip_code, bad_alias), bad_alias TEXT, -- foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE zip_data ( population_2010 INTEGER, -- "1st_quarter_payroll" INTEGER, -- residential_mailboxes INTEGER, -- american_indian_population INTEGER, -- spouses INTEGER, -- over_65 INTEGER, -- employees INTEGER, -- white_population INTEGER, -- multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 businesses INTEGER, -- black_population INTEGER, -- avg_house_value INTEGER, -- children INTEGER, -- foreign key (state) references state(abbreviation), single_family_delivery_units INTEGER, -- time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608 parents_and_widowed INTEGER, -- state_fips INTEGER, -- monthly_benefits_all INTEGER, -- male_population INTEGER, -- type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0 population_2020 INTEGER, -- other_population INTEGER, -- avg_income_per_household INTEGER, -- daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 female_median_age REAL, -- annual_payroll INTEGER, -- female_population INTEGER, -- persons_per_household REAL, -- division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838 city TEXT, -- total_delivery_receptacles INTEGER, -- organization TEXT, -- state TEXT, -- monthly_benefits_retired_workers INTEGER, -- foreign key (CBSA) references CBSA(CBSA), asian_population INTEGER, -- hispanic_population INTEGER, -- male_median_age REAL, -- region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838 county_fips INTEGER, -- median_age REAL, -- retired_workers INTEGER, -- total_beneficiaries INTEGER, -- latitude REAL, -- households INTEGER, -- hawaiian_population INTEGER, -- monthly_benefits_widowed INTEGER, -- water_area REAL, -- business_mailboxes INTEGER, -- longitude REAL, -- multi_family_delivery_units INTEGER, -- CBSA INTEGER, -- zip_code INTEGER primary key, elevation INTEGER, -- land_area REAL, -- disabled_workers INTEGER, -- ); CREATE TABLE alias ( foreign key (zip_code) references zip_data(zip_code), alias TEXT, -- zip_code INTEGER primary key, ); CREATE TABLE zip_congress ( district TEXT, -- foreign key (district) references congress(cognress_rep_id), primary key (zip_code, district), foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE CBSA ( CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0 CBSA INTEGER primary key, CBSA_name TEXT, -- );
codebase_comments
How many solution paths are there inside the 2nd most popular repository?
more watchers mean that this repository is more popular; most popular repository refers to max(Watchers);
SELECT COUNT(DISTINCT T2.Path) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Watchers = ( SELECT Watchers FROM Repo ORDER BY Watchers DESC LIMIT 1, 1 )
CREATE TABLE Method ( ApiCalls TEXT, -- NameTokenized TEXT, -- Name TEXT, -- SolutionId INTEGER, -- CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 SampledAt INTEGER, -- Id INTEGER not null primary key autoincrement, Lang TEXT, -- FullComment TEXT, -- Summary TEXT, -- ); CREATE TABLE Repo ( Stars INTEGER, -- Forks INTEGER, -- Watchers INTEGER, -- Id INTEGER not null primary key autoincrement, ProcessedTime INTEGER, -- Url TEXT, -- ); CREATE TABLE Solution ( WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 Id INTEGER not null primary key autoincrement, RepoId INTEGER, -- ProcessedTime INTEGER, -- Path TEXT, -- ); CREATE TABLE MethodParameter ( Name TEXT, -- MethodId TEXT, -- Id INTEGER not null primary key autoincrement, Type TEXT, -- );
address
Calculate the average male median age of all the residential areas in Windham county.
average male median age refers to Divide (Sum(male_median_age), Count(county)); 'WINDHAM' is the county
SELECT SUM(T2.male_median_age) / COUNT(T2.median_age) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.county = 'WINDHAM'
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area_code ( primary key (zip_code, area_code), zip_code INTEGER, -- area_code INTEGER, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE congress ( House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0 District INTEGER, -- land_area REAL, -- party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0 abbreviation TEXT, -- state TEXT, -- cognress_rep_id TEXT primary key, CID TEXT, -- foreign key (abbreviation) references state(abbreviation), first_name TEXT, -- last_name TEXT, -- ); CREATE TABLE avoid ( primary key (zip_code, bad_alias), bad_alias TEXT, -- foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE zip_data ( population_2010 INTEGER, -- "1st_quarter_payroll" INTEGER, -- residential_mailboxes INTEGER, -- american_indian_population INTEGER, -- spouses INTEGER, -- over_65 INTEGER, -- employees INTEGER, -- white_population INTEGER, -- multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 businesses INTEGER, -- black_population INTEGER, -- avg_house_value INTEGER, -- children INTEGER, -- foreign key (state) references state(abbreviation), single_family_delivery_units INTEGER, -- time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608 parents_and_widowed INTEGER, -- state_fips INTEGER, -- monthly_benefits_all INTEGER, -- male_population INTEGER, -- type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0 population_2020 INTEGER, -- other_population INTEGER, -- avg_income_per_household INTEGER, -- daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 female_median_age REAL, -- annual_payroll INTEGER, -- female_population INTEGER, -- persons_per_household REAL, -- division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838 city TEXT, -- total_delivery_receptacles INTEGER, -- organization TEXT, -- state TEXT, -- monthly_benefits_retired_workers INTEGER, -- foreign key (CBSA) references CBSA(CBSA), asian_population INTEGER, -- hispanic_population INTEGER, -- male_median_age REAL, -- region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838 county_fips INTEGER, -- median_age REAL, -- retired_workers INTEGER, -- total_beneficiaries INTEGER, -- latitude REAL, -- households INTEGER, -- hawaiian_population INTEGER, -- monthly_benefits_widowed INTEGER, -- water_area REAL, -- business_mailboxes INTEGER, -- longitude REAL, -- multi_family_delivery_units INTEGER, -- CBSA INTEGER, -- zip_code INTEGER primary key, elevation INTEGER, -- land_area REAL, -- disabled_workers INTEGER, -- ); CREATE TABLE alias ( foreign key (zip_code) references zip_data(zip_code), alias TEXT, -- zip_code INTEGER primary key, ); CREATE TABLE zip_congress ( district TEXT, -- foreign key (district) references congress(cognress_rep_id), primary key (zip_code, district), foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE CBSA ( CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0 CBSA INTEGER primary key, CBSA_name TEXT, -- );
codebase_comments
How much is the processed time of the method whose tokenized name is "about box1 dispose"? Indicate the language of the method.
language refers to Lang;
SELECT DISTINCT T1.ProcessedTime, T2.Lang FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.NameTokenized = 'about box1 dispose'
CREATE TABLE Method ( ApiCalls TEXT, -- NameTokenized TEXT, -- Name TEXT, -- SolutionId INTEGER, -- CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 SampledAt INTEGER, -- Id INTEGER not null primary key autoincrement, Lang TEXT, -- FullComment TEXT, -- Summary TEXT, -- ); CREATE TABLE Repo ( Stars INTEGER, -- Forks INTEGER, -- Watchers INTEGER, -- Id INTEGER not null primary key autoincrement, ProcessedTime INTEGER, -- Url TEXT, -- ); CREATE TABLE Solution ( WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 Id INTEGER not null primary key autoincrement, RepoId INTEGER, -- ProcessedTime INTEGER, -- Path TEXT, -- ); CREATE TABLE MethodParameter ( Name TEXT, -- MethodId TEXT, -- Id INTEGER not null primary key autoincrement, Type TEXT, -- );
codebase_comments
What is the full comment on the method whose solution path is "bmatzelle_nini\Source\Nini.sln" with a tokenized name of "alias text add alias"?
null
SELECT T2.FullComment FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.Path = 'bmatzelle_niniSourceNini.sln' AND T2.NameTokenized = 'alias text add alias'
CREATE TABLE Method ( ApiCalls TEXT, -- NameTokenized TEXT, -- Name TEXT, -- SolutionId INTEGER, -- CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 SampledAt INTEGER, -- Id INTEGER not null primary key autoincrement, Lang TEXT, -- FullComment TEXT, -- Summary TEXT, -- ); CREATE TABLE Repo ( Stars INTEGER, -- Forks INTEGER, -- Watchers INTEGER, -- Id INTEGER not null primary key autoincrement, ProcessedTime INTEGER, -- Url TEXT, -- ); CREATE TABLE Solution ( WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 Id INTEGER not null primary key autoincrement, RepoId INTEGER, -- ProcessedTime INTEGER, -- Path TEXT, -- ); CREATE TABLE MethodParameter ( Name TEXT, -- MethodId TEXT, -- Id INTEGER not null primary key autoincrement, Type TEXT, -- );
olympics
State the event name of Basketball.
basketball refers to sport_name = 'Basketball';
SELECT T2.event_name FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T1.sport_name = 'Basketball'
CREATE TABLE event ( event_name TEXT default NULL, -- sport_id INTEGER default NULL, -- foreign key (sport_id) references sport(id), id INTEGER not null primary key, ); CREATE TABLE sport ( id INTEGER not null primary key, sport_name TEXT default NULL, -- ); CREATE TABLE city ( city_name TEXT default NULL, -- id INTEGER not null primary key, ); CREATE TABLE games_city ( city_id INTEGER default NULL, -- foreign key (games_id) references games(id), games_id INTEGER default NULL, -- foreign key (city_id) references city(id), ); CREATE TABLE competitor_event ( foreign key (event_id) references event(id), foreign key (competitor_id) references games_competitor(id), foreign key (competitor_id) references games_competitor(id), foreign key (medal_id) references medal(id), medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 event_id INTEGER default NULL, -- competitor_id INTEGER default NULL, -- ); CREATE TABLE person ( weight INTEGER default NULL, -- height INTEGER default NULL, -- id INTEGER not null primary key, full_name TEXT default NULL, -- gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE noc_region ( region_name TEXT default NULL, -- id INTEGER not null primary key, noc TEXT default NULL, -- ); CREATE TABLE medal ( id INTEGER not null primary key, medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE person_region ( foreign key (region_id) references noc_region(id), region_id INTEGER default NULL, -- foreign key (person_id) references person(id), person_id INTEGER default NULL, -- ); CREATE TABLE games ( season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0 id INTEGER not null primary key, games_name TEXT default NULL, -- games_year INTEGER default NULL, -- ); CREATE TABLE games_competitor ( id INTEGER not null primary key, foreign key (games_id) references games(id), games_id INTEGER default NULL, -- age INTEGER default NULL, -- foreign key (person_id) references person(id), person_id INTEGER default NULL, -- );
codebase_comments
How many solution paths that needs to be compiled if user wants to implement it in "https://github.com/jeffdik/tachy.git"?
needs to be compiled if user wants to implement refers to WasCompiled = 0; https://github.com/jeffdik/tachy.git is url of repository
SELECT COUNT(T2.Path) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Url = 'https://github.com/jeffdik/tachy.git' AND T2.WasCompiled = 0
CREATE TABLE Method ( ApiCalls TEXT, -- NameTokenized TEXT, -- Name TEXT, -- SolutionId INTEGER, -- CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 SampledAt INTEGER, -- Id INTEGER not null primary key autoincrement, Lang TEXT, -- FullComment TEXT, -- Summary TEXT, -- ); CREATE TABLE Repo ( Stars INTEGER, -- Forks INTEGER, -- Watchers INTEGER, -- Id INTEGER not null primary key autoincrement, ProcessedTime INTEGER, -- Url TEXT, -- ); CREATE TABLE Solution ( WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 Id INTEGER not null primary key autoincrement, RepoId INTEGER, -- ProcessedTime INTEGER, -- Path TEXT, -- ); CREATE TABLE MethodParameter ( Name TEXT, -- MethodId TEXT, -- Id INTEGER not null primary key autoincrement, Type TEXT, -- );
address
Name the bad alias of Geneva, AL.
"Geneva" is the city; 'AL' is the state
SELECT T1.bad_alias FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Geneva' AND T2.state = 'AL'
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area_code ( primary key (zip_code, area_code), zip_code INTEGER, -- area_code INTEGER, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE congress ( House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0 District INTEGER, -- land_area REAL, -- party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0 abbreviation TEXT, -- state TEXT, -- cognress_rep_id TEXT primary key, CID TEXT, -- foreign key (abbreviation) references state(abbreviation), first_name TEXT, -- last_name TEXT, -- ); CREATE TABLE avoid ( primary key (zip_code, bad_alias), bad_alias TEXT, -- foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE zip_data ( population_2010 INTEGER, -- "1st_quarter_payroll" INTEGER, -- residential_mailboxes INTEGER, -- american_indian_population INTEGER, -- spouses INTEGER, -- over_65 INTEGER, -- employees INTEGER, -- white_population INTEGER, -- multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 businesses INTEGER, -- black_population INTEGER, -- avg_house_value INTEGER, -- children INTEGER, -- foreign key (state) references state(abbreviation), single_family_delivery_units INTEGER, -- time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608 parents_and_widowed INTEGER, -- state_fips INTEGER, -- monthly_benefits_all INTEGER, -- male_population INTEGER, -- type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0 population_2020 INTEGER, -- other_population INTEGER, -- avg_income_per_household INTEGER, -- daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 female_median_age REAL, -- annual_payroll INTEGER, -- female_population INTEGER, -- persons_per_household REAL, -- division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838 city TEXT, -- total_delivery_receptacles INTEGER, -- organization TEXT, -- state TEXT, -- monthly_benefits_retired_workers INTEGER, -- foreign key (CBSA) references CBSA(CBSA), asian_population INTEGER, -- hispanic_population INTEGER, -- male_median_age REAL, -- region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838 county_fips INTEGER, -- median_age REAL, -- retired_workers INTEGER, -- total_beneficiaries INTEGER, -- latitude REAL, -- households INTEGER, -- hawaiian_population INTEGER, -- monthly_benefits_widowed INTEGER, -- water_area REAL, -- business_mailboxes INTEGER, -- longitude REAL, -- multi_family_delivery_units INTEGER, -- CBSA INTEGER, -- zip_code INTEGER primary key, elevation INTEGER, -- land_area REAL, -- disabled_workers INTEGER, -- ); CREATE TABLE alias ( foreign key (zip_code) references zip_data(zip_code), alias TEXT, -- zip_code INTEGER primary key, ); CREATE TABLE zip_congress ( district TEXT, -- foreign key (district) references congress(cognress_rep_id), primary key (zip_code, district), foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE CBSA ( CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0 CBSA INTEGER primary key, CBSA_name TEXT, -- );
movies_4
List all the keywords with "christmas" in them.
keywords with "christmas" in them refers to keyword_name LIKE '%christmas%'
SELECT keyword_name FROM keyword WHERE keyword_name LIKE '%christmas%'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primary key, ); CREATE TABLE movie_genres ( foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- genre_id INTEGER default NULL, -- foreign key (genre_id) references genre(genre_id), ); CREATE TABLE movie ( budget INTEGER default NULL, -- popularity REAL default NULL, -- movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 runtime INTEGER default NULL, -- tagline TEXT default NULL, -- revenue INTEGER default NULL, -- overview TEXT default NULL, -- vote_count INTEGER default NULL, -- vote_average REAL default NULL, -- release_date DATE default NULL, -- homepage TEXT default NULL, -- title TEXT default NULL, -- movie_id INTEGER not null primary key, ); CREATE TABLE movie_languages ( foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 movie_id INTEGER default NULL, -- foreign key (language_id) references language(language_id), foreign key (movie_id) references movie(movie_id), language_id INTEGER default NULL, -- ); CREATE TABLE movie_crew ( job TEXT default NULL, -- person_id INTEGER default NULL, -- department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 foreign key (person_id) references person(person_id), movie_id INTEGER default NULL, -- foreign key (department_id) references department(department_id), foreign key (movie_id) references movie(movie_id), ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- ); CREATE TABLE person ( person_id INTEGER not null primary key, person_name TEXT default NULL, -- ); CREATE TABLE movie_keywords ( movie_id INTEGER default NULL references movie, -- keyword_id INTEGER default NULL references keyword, -- ); CREATE TABLE language ( language_name TEXT default NULL, -- language_id INTEGER not null primary key, language_code TEXT default NULL, -- ); CREATE TABLE genre ( genre_id INTEGER not null primary key, genre_name TEXT default NULL, -- ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 department_id INTEGER not null primary key, ); CREATE TABLE movie_cast ( foreign key (gender_id) references gender(gender_id), cast_order INTEGER default NULL, -- gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 movie_id INTEGER default NULL, -- character_name TEXT default NULL, -- foreign key (movie_id) references movie(movie_id), person_id INTEGER default NULL, -- foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- country_name TEXT default NULL, -- ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- company_id INTEGER default NULL references production_company, -- ); CREATE TABLE production_country ( movie_id INTEGER default NULL, -- country_id INTEGER default NULL, -- foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), ); CREATE TABLE language_role ( role_id INTEGER not null primary key, language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 );
movies_4
How many adventure movies are there that were released in 2000?
adventure movies refers to genre_name = 'Adventure'; released in 2000 refers to release_date LIKE '2000%'
SELECT COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Adventure' AND CAST(STRFTIME('%Y', T1.release_date) AS INT) = 2000
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primary key, ); CREATE TABLE movie_genres ( foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- genre_id INTEGER default NULL, -- foreign key (genre_id) references genre(genre_id), ); CREATE TABLE movie ( budget INTEGER default NULL, -- popularity REAL default NULL, -- movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 runtime INTEGER default NULL, -- tagline TEXT default NULL, -- revenue INTEGER default NULL, -- overview TEXT default NULL, -- vote_count INTEGER default NULL, -- vote_average REAL default NULL, -- release_date DATE default NULL, -- homepage TEXT default NULL, -- title TEXT default NULL, -- movie_id INTEGER not null primary key, ); CREATE TABLE movie_languages ( foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 movie_id INTEGER default NULL, -- foreign key (language_id) references language(language_id), foreign key (movie_id) references movie(movie_id), language_id INTEGER default NULL, -- ); CREATE TABLE movie_crew ( job TEXT default NULL, -- person_id INTEGER default NULL, -- department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 foreign key (person_id) references person(person_id), movie_id INTEGER default NULL, -- foreign key (department_id) references department(department_id), foreign key (movie_id) references movie(movie_id), ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- ); CREATE TABLE person ( person_id INTEGER not null primary key, person_name TEXT default NULL, -- ); CREATE TABLE movie_keywords ( movie_id INTEGER default NULL references movie, -- keyword_id INTEGER default NULL references keyword, -- ); CREATE TABLE language ( language_name TEXT default NULL, -- language_id INTEGER not null primary key, language_code TEXT default NULL, -- ); CREATE TABLE genre ( genre_id INTEGER not null primary key, genre_name TEXT default NULL, -- ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 department_id INTEGER not null primary key, ); CREATE TABLE movie_cast ( foreign key (gender_id) references gender(gender_id), cast_order INTEGER default NULL, -- gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 movie_id INTEGER default NULL, -- character_name TEXT default NULL, -- foreign key (movie_id) references movie(movie_id), person_id INTEGER default NULL, -- foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- country_name TEXT default NULL, -- ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- company_id INTEGER default NULL references production_company, -- ); CREATE TABLE production_country ( movie_id INTEGER default NULL, -- country_id INTEGER default NULL, -- foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), ); CREATE TABLE language_role ( role_id INTEGER not null primary key, language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 );
address
Tell the name of the county which is represented by Hartzler Vicky.
name of county refers to county
SELECT T1.county FROM country AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T3.first_name = 'Hartzler' AND T3.last_name = 'Vicky' GROUP BY T1.county
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area_code ( primary key (zip_code, area_code), zip_code INTEGER, -- area_code INTEGER, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE congress ( House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0 District INTEGER, -- land_area REAL, -- party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0 abbreviation TEXT, -- state TEXT, -- cognress_rep_id TEXT primary key, CID TEXT, -- foreign key (abbreviation) references state(abbreviation), first_name TEXT, -- last_name TEXT, -- ); CREATE TABLE avoid ( primary key (zip_code, bad_alias), bad_alias TEXT, -- foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE zip_data ( population_2010 INTEGER, -- "1st_quarter_payroll" INTEGER, -- residential_mailboxes INTEGER, -- american_indian_population INTEGER, -- spouses INTEGER, -- over_65 INTEGER, -- employees INTEGER, -- white_population INTEGER, -- multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 businesses INTEGER, -- black_population INTEGER, -- avg_house_value INTEGER, -- children INTEGER, -- foreign key (state) references state(abbreviation), single_family_delivery_units INTEGER, -- time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608 parents_and_widowed INTEGER, -- state_fips INTEGER, -- monthly_benefits_all INTEGER, -- male_population INTEGER, -- type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0 population_2020 INTEGER, -- other_population INTEGER, -- avg_income_per_household INTEGER, -- daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 female_median_age REAL, -- annual_payroll INTEGER, -- female_population INTEGER, -- persons_per_household REAL, -- division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838 city TEXT, -- total_delivery_receptacles INTEGER, -- organization TEXT, -- state TEXT, -- monthly_benefits_retired_workers INTEGER, -- foreign key (CBSA) references CBSA(CBSA), asian_population INTEGER, -- hispanic_population INTEGER, -- male_median_age REAL, -- region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838 county_fips INTEGER, -- median_age REAL, -- retired_workers INTEGER, -- total_beneficiaries INTEGER, -- latitude REAL, -- households INTEGER, -- hawaiian_population INTEGER, -- monthly_benefits_widowed INTEGER, -- water_area REAL, -- business_mailboxes INTEGER, -- longitude REAL, -- multi_family_delivery_units INTEGER, -- CBSA INTEGER, -- zip_code INTEGER primary key, elevation INTEGER, -- land_area REAL, -- disabled_workers INTEGER, -- ); CREATE TABLE alias ( foreign key (zip_code) references zip_data(zip_code), alias TEXT, -- zip_code INTEGER primary key, ); CREATE TABLE zip_congress ( district TEXT, -- foreign key (district) references congress(cognress_rep_id), primary key (zip_code, district), foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE CBSA ( CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0 CBSA INTEGER primary key, CBSA_name TEXT, -- );
movies_4
What is the role of Mark Hammel?
role refers to job
SELECT T2.job FROM person AS T1 INNER JOIN movie_crew AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Mark Hammel'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primary key, ); CREATE TABLE movie_genres ( foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- genre_id INTEGER default NULL, -- foreign key (genre_id) references genre(genre_id), ); CREATE TABLE movie ( budget INTEGER default NULL, -- popularity REAL default NULL, -- movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 runtime INTEGER default NULL, -- tagline TEXT default NULL, -- revenue INTEGER default NULL, -- overview TEXT default NULL, -- vote_count INTEGER default NULL, -- vote_average REAL default NULL, -- release_date DATE default NULL, -- homepage TEXT default NULL, -- title TEXT default NULL, -- movie_id INTEGER not null primary key, ); CREATE TABLE movie_languages ( foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 movie_id INTEGER default NULL, -- foreign key (language_id) references language(language_id), foreign key (movie_id) references movie(movie_id), language_id INTEGER default NULL, -- ); CREATE TABLE movie_crew ( job TEXT default NULL, -- person_id INTEGER default NULL, -- department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 foreign key (person_id) references person(person_id), movie_id INTEGER default NULL, -- foreign key (department_id) references department(department_id), foreign key (movie_id) references movie(movie_id), ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- ); CREATE TABLE person ( person_id INTEGER not null primary key, person_name TEXT default NULL, -- ); CREATE TABLE movie_keywords ( movie_id INTEGER default NULL references movie, -- keyword_id INTEGER default NULL references keyword, -- ); CREATE TABLE language ( language_name TEXT default NULL, -- language_id INTEGER not null primary key, language_code TEXT default NULL, -- ); CREATE TABLE genre ( genre_id INTEGER not null primary key, genre_name TEXT default NULL, -- ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 department_id INTEGER not null primary key, ); CREATE TABLE movie_cast ( foreign key (gender_id) references gender(gender_id), cast_order INTEGER default NULL, -- gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 movie_id INTEGER default NULL, -- character_name TEXT default NULL, -- foreign key (movie_id) references movie(movie_id), person_id INTEGER default NULL, -- foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- country_name TEXT default NULL, -- ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- company_id INTEGER default NULL references production_company, -- ); CREATE TABLE production_country ( movie_id INTEGER default NULL, -- country_id INTEGER default NULL, -- foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), ); CREATE TABLE language_role ( role_id INTEGER not null primary key, language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 );
address
Which city and state has the bad alias of Lawrenceville?
"Lawrenceville" is the bad_alias
SELECT T2.city, T2.state FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.bad_alias = 'Lawrenceville' GROUP BY T2.city, T2.state
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area_code ( primary key (zip_code, area_code), zip_code INTEGER, -- area_code INTEGER, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE congress ( House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0 District INTEGER, -- land_area REAL, -- party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0 abbreviation TEXT, -- state TEXT, -- cognress_rep_id TEXT primary key, CID TEXT, -- foreign key (abbreviation) references state(abbreviation), first_name TEXT, -- last_name TEXT, -- ); CREATE TABLE avoid ( primary key (zip_code, bad_alias), bad_alias TEXT, -- foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE zip_data ( population_2010 INTEGER, -- "1st_quarter_payroll" INTEGER, -- residential_mailboxes INTEGER, -- american_indian_population INTEGER, -- spouses INTEGER, -- over_65 INTEGER, -- employees INTEGER, -- white_population INTEGER, -- multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 businesses INTEGER, -- black_population INTEGER, -- avg_house_value INTEGER, -- children INTEGER, -- foreign key (state) references state(abbreviation), single_family_delivery_units INTEGER, -- time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608 parents_and_widowed INTEGER, -- state_fips INTEGER, -- monthly_benefits_all INTEGER, -- male_population INTEGER, -- type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0 population_2020 INTEGER, -- other_population INTEGER, -- avg_income_per_household INTEGER, -- daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 female_median_age REAL, -- annual_payroll INTEGER, -- female_population INTEGER, -- persons_per_household REAL, -- division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838 city TEXT, -- total_delivery_receptacles INTEGER, -- organization TEXT, -- state TEXT, -- monthly_benefits_retired_workers INTEGER, -- foreign key (CBSA) references CBSA(CBSA), asian_population INTEGER, -- hispanic_population INTEGER, -- male_median_age REAL, -- region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838 county_fips INTEGER, -- median_age REAL, -- retired_workers INTEGER, -- total_beneficiaries INTEGER, -- latitude REAL, -- households INTEGER, -- hawaiian_population INTEGER, -- monthly_benefits_widowed INTEGER, -- water_area REAL, -- business_mailboxes INTEGER, -- longitude REAL, -- multi_family_delivery_units INTEGER, -- CBSA INTEGER, -- zip_code INTEGER primary key, elevation INTEGER, -- land_area REAL, -- disabled_workers INTEGER, -- ); CREATE TABLE alias ( foreign key (zip_code) references zip_data(zip_code), alias TEXT, -- zip_code INTEGER primary key, ); CREATE TABLE zip_congress ( district TEXT, -- foreign key (district) references congress(cognress_rep_id), primary key (zip_code, district), foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE CBSA ( CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0 CBSA INTEGER primary key, CBSA_name TEXT, -- );
movies_4
What is the most common first name?
most common first name refers to max(count(person_name))
SELECT person_name FROM person GROUP BY person_name ORDER BY COUNT(person_name) DESC LIMIT 1
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primary key, ); CREATE TABLE movie_genres ( foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- genre_id INTEGER default NULL, -- foreign key (genre_id) references genre(genre_id), ); CREATE TABLE movie ( budget INTEGER default NULL, -- popularity REAL default NULL, -- movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 runtime INTEGER default NULL, -- tagline TEXT default NULL, -- revenue INTEGER default NULL, -- overview TEXT default NULL, -- vote_count INTEGER default NULL, -- vote_average REAL default NULL, -- release_date DATE default NULL, -- homepage TEXT default NULL, -- title TEXT default NULL, -- movie_id INTEGER not null primary key, ); CREATE TABLE movie_languages ( foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 movie_id INTEGER default NULL, -- foreign key (language_id) references language(language_id), foreign key (movie_id) references movie(movie_id), language_id INTEGER default NULL, -- ); CREATE TABLE movie_crew ( job TEXT default NULL, -- person_id INTEGER default NULL, -- department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 foreign key (person_id) references person(person_id), movie_id INTEGER default NULL, -- foreign key (department_id) references department(department_id), foreign key (movie_id) references movie(movie_id), ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- ); CREATE TABLE person ( person_id INTEGER not null primary key, person_name TEXT default NULL, -- ); CREATE TABLE movie_keywords ( movie_id INTEGER default NULL references movie, -- keyword_id INTEGER default NULL references keyword, -- ); CREATE TABLE language ( language_name TEXT default NULL, -- language_id INTEGER not null primary key, language_code TEXT default NULL, -- ); CREATE TABLE genre ( genre_id INTEGER not null primary key, genre_name TEXT default NULL, -- ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 department_id INTEGER not null primary key, ); CREATE TABLE movie_cast ( foreign key (gender_id) references gender(gender_id), cast_order INTEGER default NULL, -- gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 movie_id INTEGER default NULL, -- character_name TEXT default NULL, -- foreign key (movie_id) references movie(movie_id), person_id INTEGER default NULL, -- foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- country_name TEXT default NULL, -- ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- company_id INTEGER default NULL references production_company, -- ); CREATE TABLE production_country ( movie_id INTEGER default NULL, -- country_id INTEGER default NULL, -- foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), ); CREATE TABLE language_role ( role_id INTEGER not null primary key, language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 );
movies_4
How many production companies made more than 150 movies?
more than 150 movies refers to COUNT(company_name) > 150
SELECT COUNT(*) FROM ( SELECT T1.company_name AS CNAME FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id HAVING COUNT(T1.company_name) > 150 )
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primary key, ); CREATE TABLE movie_genres ( foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- genre_id INTEGER default NULL, -- foreign key (genre_id) references genre(genre_id), ); CREATE TABLE movie ( budget INTEGER default NULL, -- popularity REAL default NULL, -- movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 runtime INTEGER default NULL, -- tagline TEXT default NULL, -- revenue INTEGER default NULL, -- overview TEXT default NULL, -- vote_count INTEGER default NULL, -- vote_average REAL default NULL, -- release_date DATE default NULL, -- homepage TEXT default NULL, -- title TEXT default NULL, -- movie_id INTEGER not null primary key, ); CREATE TABLE movie_languages ( foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 movie_id INTEGER default NULL, -- foreign key (language_id) references language(language_id), foreign key (movie_id) references movie(movie_id), language_id INTEGER default NULL, -- ); CREATE TABLE movie_crew ( job TEXT default NULL, -- person_id INTEGER default NULL, -- department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 foreign key (person_id) references person(person_id), movie_id INTEGER default NULL, -- foreign key (department_id) references department(department_id), foreign key (movie_id) references movie(movie_id), ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- ); CREATE TABLE person ( person_id INTEGER not null primary key, person_name TEXT default NULL, -- ); CREATE TABLE movie_keywords ( movie_id INTEGER default NULL references movie, -- keyword_id INTEGER default NULL references keyword, -- ); CREATE TABLE language ( language_name TEXT default NULL, -- language_id INTEGER not null primary key, language_code TEXT default NULL, -- ); CREATE TABLE genre ( genre_id INTEGER not null primary key, genre_name TEXT default NULL, -- ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 department_id INTEGER not null primary key, ); CREATE TABLE movie_cast ( foreign key (gender_id) references gender(gender_id), cast_order INTEGER default NULL, -- gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 movie_id INTEGER default NULL, -- character_name TEXT default NULL, -- foreign key (movie_id) references movie(movie_id), person_id INTEGER default NULL, -- foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- country_name TEXT default NULL, -- ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- company_id INTEGER default NULL references production_company, -- ); CREATE TABLE production_country ( movie_id INTEGER default NULL, -- country_id INTEGER default NULL, -- foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), ); CREATE TABLE language_role ( role_id INTEGER not null primary key, language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 );
address
What is the area code of Bishopville, SC?
"Bishopville" is the city; 'SC' is the state
SELECT T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Bishopville' AND T2.state = 'SC'
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area_code ( primary key (zip_code, area_code), zip_code INTEGER, -- area_code INTEGER, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE congress ( House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0 District INTEGER, -- land_area REAL, -- party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0 abbreviation TEXT, -- state TEXT, -- cognress_rep_id TEXT primary key, CID TEXT, -- foreign key (abbreviation) references state(abbreviation), first_name TEXT, -- last_name TEXT, -- ); CREATE TABLE avoid ( primary key (zip_code, bad_alias), bad_alias TEXT, -- foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE zip_data ( population_2010 INTEGER, -- "1st_quarter_payroll" INTEGER, -- residential_mailboxes INTEGER, -- american_indian_population INTEGER, -- spouses INTEGER, -- over_65 INTEGER, -- employees INTEGER, -- white_population INTEGER, -- multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 businesses INTEGER, -- black_population INTEGER, -- avg_house_value INTEGER, -- children INTEGER, -- foreign key (state) references state(abbreviation), single_family_delivery_units INTEGER, -- time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608 parents_and_widowed INTEGER, -- state_fips INTEGER, -- monthly_benefits_all INTEGER, -- male_population INTEGER, -- type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0 population_2020 INTEGER, -- other_population INTEGER, -- avg_income_per_household INTEGER, -- daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0 female_median_age REAL, -- annual_payroll INTEGER, -- female_population INTEGER, -- persons_per_household REAL, -- division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838 city TEXT, -- total_delivery_receptacles INTEGER, -- organization TEXT, -- state TEXT, -- monthly_benefits_retired_workers INTEGER, -- foreign key (CBSA) references CBSA(CBSA), asian_population INTEGER, -- hispanic_population INTEGER, -- male_median_age REAL, -- region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838 county_fips INTEGER, -- median_age REAL, -- retired_workers INTEGER, -- total_beneficiaries INTEGER, -- latitude REAL, -- households INTEGER, -- hawaiian_population INTEGER, -- monthly_benefits_widowed INTEGER, -- water_area REAL, -- business_mailboxes INTEGER, -- longitude REAL, -- multi_family_delivery_units INTEGER, -- CBSA INTEGER, -- zip_code INTEGER primary key, elevation INTEGER, -- land_area REAL, -- disabled_workers INTEGER, -- ); CREATE TABLE alias ( foreign key (zip_code) references zip_data(zip_code), alias TEXT, -- zip_code INTEGER primary key, ); CREATE TABLE zip_congress ( district TEXT, -- foreign key (district) references congress(cognress_rep_id), primary key (zip_code, district), foreign key (zip_code) references zip_data(zip_code), zip_code INTEGER, -- ); CREATE TABLE CBSA ( CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0 CBSA INTEGER primary key, CBSA_name TEXT, -- );
movies_4
Name the horror movies with positive ratings greater than 7.
Name the horror movies refers to title where genre_name = 'horror'; positive ratings greater than 7 refers to vote_average > 7
SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Horror' AND T1.vote_average > 7
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primary key, ); CREATE TABLE movie_genres ( foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- genre_id INTEGER default NULL, -- foreign key (genre_id) references genre(genre_id), ); CREATE TABLE movie ( budget INTEGER default NULL, -- popularity REAL default NULL, -- movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 runtime INTEGER default NULL, -- tagline TEXT default NULL, -- revenue INTEGER default NULL, -- overview TEXT default NULL, -- vote_count INTEGER default NULL, -- vote_average REAL default NULL, -- release_date DATE default NULL, -- homepage TEXT default NULL, -- title TEXT default NULL, -- movie_id INTEGER not null primary key, ); CREATE TABLE movie_languages ( foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 movie_id INTEGER default NULL, -- foreign key (language_id) references language(language_id), foreign key (movie_id) references movie(movie_id), language_id INTEGER default NULL, -- ); CREATE TABLE movie_crew ( job TEXT default NULL, -- person_id INTEGER default NULL, -- department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 foreign key (person_id) references person(person_id), movie_id INTEGER default NULL, -- foreign key (department_id) references department(department_id), foreign key (movie_id) references movie(movie_id), ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- ); CREATE TABLE person ( person_id INTEGER not null primary key, person_name TEXT default NULL, -- ); CREATE TABLE movie_keywords ( movie_id INTEGER default NULL references movie, -- keyword_id INTEGER default NULL references keyword, -- ); CREATE TABLE language ( language_name TEXT default NULL, -- language_id INTEGER not null primary key, language_code TEXT default NULL, -- ); CREATE TABLE genre ( genre_id INTEGER not null primary key, genre_name TEXT default NULL, -- ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 department_id INTEGER not null primary key, ); CREATE TABLE movie_cast ( foreign key (gender_id) references gender(gender_id), cast_order INTEGER default NULL, -- gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 movie_id INTEGER default NULL, -- character_name TEXT default NULL, -- foreign key (movie_id) references movie(movie_id), person_id INTEGER default NULL, -- foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- country_name TEXT default NULL, -- ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- company_id INTEGER default NULL references production_company, -- ); CREATE TABLE production_country ( movie_id INTEGER default NULL, -- country_id INTEGER default NULL, -- foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), ); CREATE TABLE language_role ( role_id INTEGER not null primary key, language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 );
retail_world
What is the average salary for employees from ID 1 to 9?
ID 1 to 9 refers to EmployeeID BETWEEN 1 AND 9; Average salary = AVG(Salary)
SELECT AVG(Salary) FROM Employees WHERE EmployeeID BETWEEN 1 AND 9
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
retail_world
Among the USA employess, how many of them has PhD title of courtesy?
"USA" is the Country; PhD title of courtesy refers to TitleOfCourtesy = 'Dr.'
SELECT COUNT(Country) FROM Employees WHERE TitleOfCourtesy = 'Dr.' AND Country = 'USA'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
Provide the customers' names who ordered the Fantasmas.
"Fantasmas" is the title of the book; customer names refers to first_name, last_name
SELECT T4.first_name, T4.last_name FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.title = 'Fantasmas'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
genes
For the genes that are located in the plasma membrane, please list their number of chromosomes.
null
SELECT T1.Chromosome FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID WHERE T2.Localization = 'plasma membrane'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
What proportion of orders are taken by the Sales Representative?
DIVIDE(COUNT(OrderID where Title = 'Sales Representative'), COUNT(OrderID)) as percentage;
SELECT CAST(COUNT(CASE WHEN T1.Title = 'Sales Representative' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
How many customers are from Australia?
"Australia" is the country_name;
SELECT COUNT(*) FROM customer_address AS T1 INNER JOIN address AS T2 ON T2.address_id = T1.address_id INNER JOIN country AS T3 ON T3.country_id = T2.country_id WHERE T3.country_name = 'Australia'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
genes
Among the pairs of genes that are not from the class of motorproteins, how many of them are negatively correlated?
If Expression_Corr < 0, it means the negatively correlated
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 AND T1.Class = 'Motorproteins'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
Provide the name of the contact person who made the orders that shipped to Switzerland.
shipped to Switzerland refers to ShipCountry = 'Switzerland'; contact person refers to Customers;
SELECT T1.ContactName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.ShipCountry = 'Switzerland' GROUP BY T1.ContactName
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
retail_world
What are the names of Robert King's territories?
Robert King is a full name of an employee where LastName = 'King' AND FirstName = 'Robert'; names of territories refer to TerritoryDescription;
SELECT T3.TerritoryDescription FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T1.LastName = 'King' AND T1.FirstName = 'Robert'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
How many orders were delivered in December 2019?
delivered refers to status_value = 'Delivered'; in December 2019 refers to status_date LIKE '2019-12%'
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Delivered' AND STRFTIME('%Y', T2.status_date) = '2019'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
genes
Among the pairs of genes that are both located in the nucleus, what is the highest expression correlation score?
null
SELECT T2.Expression_Corr FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 INNER JOIN Genes AS T3 ON T3.GeneID = T2.GeneID2 WHERE T1.Localization = 'nucleus' AND T3.Localization = 'nucleus' ORDER BY T2.Expression_Corr DESC LIMIT 1
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
What are the products by the company "Bigfoot Breweries"?
Bigfoot Breweries is the name of the company; products refer to ProductName;
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Bigfoot Breweries'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
genes
What are the functions of the pair of genes that have the lowest expression correlation score?a
null
SELECT T1.Function FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 ORDER BY T2.Expression_Corr ASC LIMIT 1
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
List all the products that were shipped to Starenweg 5.
products shipped to Starenweg 5 refer to ProductName where ShipAddress = 'Starenweg 5';
SELECT T3.ProductName FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T1.ShipAddress = 'Starenweg 5' GROUP BY T3.ProductName
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
List all the authors named "George".
author named 'George' refers to author_name = 'George%'
SELECT author_name FROM author WHERE author_name LIKE 'George%'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
retail_world
How many orders did "Laughing Bacchus Wine Cellars" make?
"Laughing Bacchus Wine Cellars" is the name of the company; orders refer to OrderID;
SELECT COUNT(T2.OrderID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.CompanyName = 'Laughing Bacchus Wine Cellars'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
genes
Please list the motif of the genes that are located in the cytoplasm and have 7 chromosomes.
null
SELECT T2.GeneID1, T2.GeneID2 FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization = 'cytoplasm' AND T1.Chromosome = 7
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
What are the prices on cheese products?
prices on cheese refer to UnitPrice WHERE Description = 'Cheeses';
SELECT T2.UnitPrice FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.Description = 'Cheeses'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
shooting
What is the proportion of white males and females in the police force?
white refers to race = 'W'; male refers to gender = 'M'; female refers to gender = 'F'; proportion of white males = divide(count(officers where race = 'W' and gender = 'M'), count(officers)) * 100%; proportion of white females = divide(count(officers where race = 'W' and gender = 'F'), count(officers)) * 100%
SELECT CAST(SUM(gender = 'M') AS REAL) / SUM(gender = 'F') FROM officers WHERE race = 'W'
CREATE TABLE officers ( full_name TEXT not null, -- foreign key (case_number) references incidents (case_number), case_number TEXT not null, -- last_name TEXT not null, -- first_name TEXT null, -- race TEXT null, -- Example Values: `L`, `W`, `B`, `A` | Value Statics: Total count 366 - Distinct count 4 - Null count 4 gender TEXT not null, -- Example Values: `M`, `F` | Value Statics: Total count 370 - Distinct count 2 - Null count 0 ); CREATE TABLE incidents ( date DATE not null, -- case_number TEXT not null primary key, subjects TEXT not null, -- subject_weapon TEXT not null, -- subject_statuses TEXT not null, -- Example Values: `Deceased`, `Shoot and Miss`, `Injured`, `Other`, `Deceased Injured` | Value Statics: Total count 219 - Distinct count 7 - Null count 0 subject_count INTEGER not null, -- Example Values: `1`, `2`, `0`, `3` | Value Statics: Total count 219 - Distinct count 4 - Null count 0 officers TEXT not null, -- location TEXT not null, -- ); CREATE TABLE subjects ( case_number TEXT not null, -- last_name TEXT not null, -- foreign key (case_number) references incidents (case_number), full_name TEXT not null, -- gender TEXT not null, -- Example Values: `M`, `F` | Value Statics: Total count 223 - Distinct count 2 - Null count 0 first_name TEXT null, -- race TEXT not null, -- Example Values: `L`, `B`, `W`, `A` | Value Statics: Total count 223 - Distinct count 4 - Null count 0 ); CREATE TABLE cases ( case_number TEXT not null primary key, grand_jury_disposition TEXT, -- );
retail_world
Make a list of all the territories in the Southern region.
territories in the Southern region refer to TerritoryDescription WHERE RegionDescription = 'Southern';
SELECT DISTINCT T1.TerritoryDescription FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Southern'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
How many orders were returned in the year 2020?
returned refers to status_value = 'Returned'; in the year 2020 refers to status_date LIKE '%2020%'
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Returned' AND STRFTIME('%Y', T2.status_date) = '2020'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
retail_world
How many orders were shipped by "Speedy Express"?
"Speedy Express" is the name of the shipping company; orders refer to OrderID;
SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Speedy Express'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
genes
If a pair of genes is positively correlated, what is the possibility of it being composed of two genes both with over 10 chromosomes?
Positively correlated means Expression_Corr > 0; Possibility = count(the pairs of genes with both chromosomes over 20) / count(pairs of genes that are positively correlated)
SELECT CAST(SUM(IIF(T1.Chromosome > 10 AND T3.Chromosome > 10, 1, 0)) AS REAL) * 100 / COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 INNER JOIN Genes AS T3 ON T3.GeneID = T2.GeneID2 WHERE T2.Expression_Corr > 0
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
What is the largest quantity of "Manjimup Dried Apples" for an order?
the largest quantity of "Manjimup Dried Apples" refers to MAX(Quantity) where ProductName = 'Manjimup Dried Apples';
SELECT T2.Quantity FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T2.ProductID = T1.ProductID WHERE T1.ProductName = 'Manjimup Dried Apples' ORDER BY T2.Quantity DESC LIMIT 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
How many percent of orders in 2020 used international shipping?
international shipping refers to method_name = 'International'; orders in 2020 refers to order_date = '2020%'; percentage = Divide (Sum(method_name = 'International'), Count(order_id)) * 100
SELECT CAST(SUM(CASE WHEN T2.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM cust_order AS T1 INNER JOIN shipping_method AS T2 ON T1.shipping_method_id = T2.method_id WHERE STRFTIME('%Y', T1.order_date) = '2020'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
genes
For the pairs of genes with one having 8 chromosomes and the other having 6 chromosomes, what is the highest expression correlation score?
null
SELECT T2.Expression_Corr FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Chromosome = 6 OR T1.Chromosome = 8 ORDER BY T2.Expression_Corr DESC LIMIT 1
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
List the first names of the employees who take the orders that ship to the city of "Reims".
ship to the city of "Reims" refers to ShipCity = Reims';
SELECT DISTINCT T1.FirstName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.ShipCity = 'Reims'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
genes
How many pairs of positively correlated genes are both non-essential?
If Expression_Corr > 0, it means the expression correlation is positive
SELECT COUNT(T2.GeneID2) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr > 0 AND T1.Essential = 'Non-Essential'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
What is the homepage link for the company that supplies the product "Thringer Rostbratwurst"?
ProductName = 'Thringer Rostbratwurst';
SELECT T2.HomePage FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Thringer Rostbratwurst'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
What is the average price for the order line?
average price refers to AVG(price)
SELECT AVG(price) FROM order_line
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
genes
Lists all genes by identifier number located in the cytoplasm and whose function is metabolism.
null
SELECT DISTINCT GeneID FROM Genes WHERE Localization = 'cytoplasm' AND Function = 'METABOLISM'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
Which region does Hoffman Estates belong to?
Hoffman Estates refer to TerritoryDescription;
SELECT T2.RegionDescription FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T1.TerritoryDescription = 'Hoffman Estates'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
What is the most common domain for the email address among all the customers?
most common domain for the email refers to Max(Count(SUBSTR(email, CHARINDEX('@', email) + 1, length(email) - charindex('@', email))))
SELECT SUBSTR(email, INSTR(email, '@') + 1, LENGTH(email) - INSTR(email, '@')) AS ym FROM customer GROUP BY SUBSTR(email, INSTR(email, '@') + 1, LENGTH(email) - INSTR(email, '@')) ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
genes
For the non-essential genes whose functions are transcription, how many of them are not located in the cytoplasm?
null
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization != 'cytoplasm' AND T1.Function = 'TRANSCRIPTION' AND T1.Essential = 'NON-Essential'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
How many of the orders are shipped to France?
shipped to France refers to ShipCountry = 'France';
SELECT COUNT(ShipCountry) FROM Orders WHERE ShipCountry = 'France'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
Which year has the most customer orders?
year with the most customer orders refers to Max(count(order_id))
SELECT strftime('%Y', order_date) FROM cust_order GROUP BY strftime('%Y', order_date) ORDER BY COUNT(strftime('%Y', order_date)) DESC LIMIT 1
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
genes
For the pairs of genes both from the class ATPases, what is the average expression correlation score?
null
SELECT AVG(T2.Expression_Corr) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Class = 'ATPases'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
Which product is the most expensive?
most expensive product refers to ProductName where MAX(UnitPrice);
SELECT ProductName FROM Products WHERE UnitPrice = ( SELECT MAX(UnitPrice) FROM Products )
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
genes
What kind of expression correlation occurs in physical type interacting gene pairs and what percentage of these are negatively correlated?
If the Expression_Corr value is negative then it's negatively correlated. Percentage of Negative Correlation = count(negative Expression_Corr physical type) / count(Expression_Corr physical type) * 100%
SELECT Expression_Corr FROM Interactions WHERE Type = 'Physical' UNION ALL SELECT CAST(SUM(Expression_Corr < 0) AS REAL) * 100 / COUNT(*) FROM Interactions WHERE Type = 'Physical'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
What is the largest total price for an order?
the largest total price for an order can be calculated as MAX(MULTIPLY(UnitPrice, Quantity, SUBTRACT(1-Discount)));
SELECT SUM(UnitPrice) FROM `Order Details` GROUP BY OrderID ORDER BY SUM(UnitPrice) DESC LIMIT 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
shooting
Which near-death incident did a policeman by the name of Ruben Fredirick look into? What is the victim in this incident's race and gender?
near-death refers to subject_statuses = 'Deceased Injured'; incident refers to case_number; Ruben Fredirick refers to full_name = 'Ruben Fredirick'
SELECT T1.case_number, T3.race, T3.gender FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number INNER JOIN subjects AS T3 ON T1.case_number = T3.case_number WHERE T2.first_name = 'Fredirick' AND T2.last_name = 'Ruben'
CREATE TABLE officers ( full_name TEXT not null, -- foreign key (case_number) references incidents (case_number), case_number TEXT not null, -- last_name TEXT not null, -- first_name TEXT null, -- race TEXT null, -- Example Values: `L`, `W`, `B`, `A` | Value Statics: Total count 366 - Distinct count 4 - Null count 4 gender TEXT not null, -- Example Values: `M`, `F` | Value Statics: Total count 370 - Distinct count 2 - Null count 0 ); CREATE TABLE incidents ( date DATE not null, -- case_number TEXT not null primary key, subjects TEXT not null, -- subject_weapon TEXT not null, -- subject_statuses TEXT not null, -- Example Values: `Deceased`, `Shoot and Miss`, `Injured`, `Other`, `Deceased Injured` | Value Statics: Total count 219 - Distinct count 7 - Null count 0 subject_count INTEGER not null, -- Example Values: `1`, `2`, `0`, `3` | Value Statics: Total count 219 - Distinct count 4 - Null count 0 officers TEXT not null, -- location TEXT not null, -- ); CREATE TABLE subjects ( case_number TEXT not null, -- last_name TEXT not null, -- foreign key (case_number) references incidents (case_number), full_name TEXT not null, -- gender TEXT not null, -- Example Values: `M`, `F` | Value Statics: Total count 223 - Distinct count 2 - Null count 0 first_name TEXT null, -- race TEXT not null, -- Example Values: `L`, `B`, `W`, `A` | Value Statics: Total count 223 - Distinct count 4 - Null count 0 ); CREATE TABLE cases ( case_number TEXT not null primary key, grand_jury_disposition TEXT, -- );
retail_world
How many territories are there?
null
SELECT COUNT(TerritoryID) FROM Territories
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
List all of the books that were published in 1995.
published in 1995 refers to publication_date LIKE '1995%'; ; list of book refers to title
SELECT title FROM book WHERE STRFTIME('%Y', publication_date) = '1995'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
retail_world
From which country is the company "Drachenblut Delikatessen" from?
Drachenblut Delikatessen is the company name;
SELECT Country FROM Customers WHERE CompanyName = 'Drachenblut Delikatessen'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
Which language is the rarest among all the books?
language written in refers to language_name; rarest refers to Min(Count(book_id))
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id GROUP BY T2.language_name ORDER BY COUNT(T2.language_name) ASC LIMIT 1
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
genes
What type of interactions occurs in genes whose function is cellular transport and transport medicine and are classified as non-essential?
null
SELECT T2.Type FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Function = 'TRANSCRIPTION' AND T1.Essential = 'Non-Essential'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
Who is the one representing the company "Heli Swaren GmbH & Co. KG"?
Heli Swaren GmbH & Co. KG is the name of the company; who is representing refers to ContactName;
SELECT ContactName FROM Suppliers WHERE CompanyName = 'Heli Swaren GmbH & Co. KG'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
Which publisher published Barry Eisler's book?
"Barry Eisler" is the author_name; publisher refers to publisher_name
SELECT T4.publisher_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'Barry Eisler'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
retail_world
Please name any two products that have the highest satisfaction levels among users of Heli Swaren GmbH & Co. KG.
High reorder level generally means high user satisfaction; the highest satisfaction levels refer to MAX(ReorderLevel); two products refer to ProductName LIMIT 2; CompanyName = 'Heli Swaren GmbH & Co. KG';
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Heli Swaren GmbH & Co. KG' ORDER BY T1.ReorderLevel DESC LIMIT 2
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
How many addresses are from the Philippines?
"Philippines" is the country_name
SELECT COUNT(T2.country_id) FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Philippines'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
genes
How many different genes do we have if we add those located in the plasma and in the nucleus?
null
SELECT COUNT(GeneID) FROM Classification WHERE Localization IN ('plasma', 'nucleus')
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
Please name any three products that have been discontinued in the meat or poultry category.
three products that have been discontinued refer to ProductName LIMIT 3 where Discontinued = 1; CategoryName = 'Meat/Poultry';
SELECT T2.ProductName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.Discontinued = 1 AND T1.CategoryName = 'Meat/Poultry' LIMIT 3
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
How many publishers have the word "book" in their name?
publisher have the word 'book' refers to publisher_name LIKE '%book%'
SELECT COUNT(*) FROM publisher WHERE publisher_name LIKE '%book%'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
genes
What percentage of genes located in the cytoskeleton are of unknown class? And of these, how many are not conditional phenotypes?
Percentage = count(genes located in the cytoskeleton unknown class) / count(genes located in the cytoskeleton) * 100%
SELECT SUM(Localization = 'cytoskeleton' AND Phenotype = 'Conditional phenotypes') , CAST(SUM(Localization = 'cytoskeleton') AS REAL) * 100 / COUNT(GeneID) FROM Genes;
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
Who is the person to contact to get Camembert Pierrot?
Camembert Pierrot is the name of the product; person to contact refers to ContactName;
SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Camembert Pierrot'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
List all the order dates for the customer named "Adrian Kunzelmann".
null
SELECT T3.order_date FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Adrian' AND T4.last_name = 'Kunzelmann'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
genes
Taking all the essential genes of the transcription factors class located in the nucleus as a reference, how many of them carry out a genetic-type interaction with another gene? List them.
null
SELECT T2.GeneID1 FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization = 'nucleus' AND T1.Class = 'Transcription factors' AND T1.Essential = 'Essential' AND T2.Expression_Corr != 0
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
How much per unit of Konbu does Mayumi's charge?
Mayumi's is the name of the company; how much per unit of Konbu refers to UnitPrice where ProductName = 'Konbu';
SELECT T1.UnitPrice FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName LIKE 'Mayumi%' AND T1.ProductName = 'Konbu'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
What are the books published by "Harper Collins"?
"Harper Collins" is the publisher_name; books refers to title
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Harper Collins'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
shooting
How many more black female victims than white female victims were discovered?
black refers to race = 'B'; female refers to gender = 'F'; white refers to race = 'W'; result = subtract(count(victims where race = 'B'), count(victims where race = 'W')) where gender = 'F'
SELECT SUM(race = 'B') - SUM(race = 'W') FROM subjects WHERE gender = 'F'
CREATE TABLE officers ( full_name TEXT not null, -- foreign key (case_number) references incidents (case_number), case_number TEXT not null, -- last_name TEXT not null, -- first_name TEXT null, -- race TEXT null, -- Example Values: `L`, `W`, `B`, `A` | Value Statics: Total count 366 - Distinct count 4 - Null count 4 gender TEXT not null, -- Example Values: `M`, `F` | Value Statics: Total count 370 - Distinct count 2 - Null count 0 ); CREATE TABLE incidents ( date DATE not null, -- case_number TEXT not null primary key, subjects TEXT not null, -- subject_weapon TEXT not null, -- subject_statuses TEXT not null, -- Example Values: `Deceased`, `Shoot and Miss`, `Injured`, `Other`, `Deceased Injured` | Value Statics: Total count 219 - Distinct count 7 - Null count 0 subject_count INTEGER not null, -- Example Values: `1`, `2`, `0`, `3` | Value Statics: Total count 219 - Distinct count 4 - Null count 0 officers TEXT not null, -- location TEXT not null, -- ); CREATE TABLE subjects ( case_number TEXT not null, -- last_name TEXT not null, -- foreign key (case_number) references incidents (case_number), full_name TEXT not null, -- gender TEXT not null, -- Example Values: `M`, `F` | Value Statics: Total count 223 - Distinct count 2 - Null count 0 first_name TEXT null, -- race TEXT not null, -- Example Values: `L`, `B`, `W`, `A` | Value Statics: Total count 223 - Distinct count 4 - Null count 0 ); CREATE TABLE cases ( case_number TEXT not null primary key, grand_jury_disposition TEXT, -- );
retail_world
What are the products that are supplied by Aux joyeux ecclsiastiques?
Aux joyeux ecclsiastiques is the name of supply company; products refer to ProductName;
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Aux joyeux ecclsiastiques'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
Sum the total price of the orders for The Prophet book.
"The Prophet" is the title of the book: total price refers to Sum(price)
SELECT SUM(T1.price) FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id WHERE T2.title = 'The Prophet'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
retail_world
Which company supplies Gula Malacca?
Gula Malacca is the name of the product; company refers to CompanyName;
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Gula Malacca'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
What is the book with the most orders?
books refers to title; the most orders refers to Max(Count(order_id))
SELECT T2.title FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id GROUP BY T2.title ORDER BY COUNT(T1.book_id) DESC LIMIT 1
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
genes
Of the genes whose phenotype and motif are nucleic acid metabolism defects, PS00107, what percentage perform positive interaction with another gene?
Percentage of no interaction = [count(nucleic acid metabolism, PS00107, no interaction) / count(nucleic acid metabolism, PS00107) * 100%
SELECT CAST(SUM(IIF(T2.Expression_Corr > 0, 1, 0)) AS REAL) * 100 / COUNT(T2.GeneID1) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Phenotype = 'Nucleic acid metabolism defects' AND T1.Motif = 'PS00107'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
What is the description of the category that tofu belongs to?
tofu is the name of the product;
SELECT T1.Description FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.ProductName = 'tofu'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
genes
List all genes whose interaction is with genes located in the nucleus in which it is positively correlated.
If the Expression_Corr value is positive then it's positively correlated
SELECT T1.GeneID FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr > 0 AND T1.Localization = 'nucleus'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
What are the products that belong to the beverage category?
products belong to beverage category refer to ProductName where CategoryName = 'beverage';
SELECT T2.ProductName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.CategoryName = 'Beverages'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
Who is the author who wrote the most books?
author refers to author_name; who wrote the most book refers to Max(Count(author_id))
SELECT T1.author_name FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_name ORDER BY COUNT(T2.author_id) DESC LIMIT 1
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
app_store
How many apps were last updated in January of 2018? Please write one translated review with positive sentiment for each app, if there's any.
updated in January of 2018 refers to Last Updated BETWEEN 'January 1, 2018' and 'January 31, 2018';
SELECT DISTINCT Translated_Review FROM user_reviews WHERE App IN ( SELECT App FROM playstore WHERE `Last Updated` BETWEEN 'January 1, 2018' AND 'January 31, 2018' ) AND Sentiment = 'Positive'
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- Type TEXT, -- Example Values: `Free`, `Paid`, `NaN` | Value Statics: Total count 10840 - Distinct count 3 - Null count 0 Reviews INTEGER, -- Genres TEXT, -- ); CREATE TABLE user_reviews ( Sentiment TEXT, -- Example Values: `Positive`, `nan`, `Neutral`, `Negative` | Value Statics: Total count 64286 - Distinct count 4 - Null count 0 App TEXT references "playstore" (App), -- Translated_Review TEXT, -- Sentiment_Subjectivity TEXT, -- Sentiment_Polarity TEXT, -- );
retail_world
Please list any three order numbers that have been shipped using Speedy Express.
Speedy Express is the name of the shipping company; three order numbers refer to OrderID LIMIT 3;
SELECT T1.OrderID FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Speedy Express' LIMIT 3
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
genes
Of all the nonessential genes that are not of the motorprotein class and whose phenotype is cell cycle defects, how many do not have a physical type of interaction?
null
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Type != 'Physical' AND T1.Phenotype = 'Cell cycle defects' AND T1.Class != 'Motorproteins' AND T1.Essential = 'Non-Essential'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression_Corr REAL not null, -- Type TEXT not null, -- Example Values: `Genetic-Physical`, `Genetic`, `Physical` | Value Statics: Total count 910 - Distinct count 3 - Null count 0 ); CREATE TABLE Genes ( Motif TEXT not null, -- Class TEXT not null, -- Complex TEXT null, -- Phenotype TEXT not null, -- Example Values: `?`, `Mating and sporulation defects`, `Cell cycle defects`, `Cell morphology and organelle mutants`, `Conditional phenotypes` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 foreign key (GeneID) references Classification (GeneID) on update cascade on delete cascade, Chromosome INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 4346 - Distinct count 17 - Null count 0 GeneID TEXT not null, -- Function TEXT not null, -- Example Values: `CELLULAR ORGANIZATION (proteins are localized to the corresponding organelle)`, `PROTEIN SYNTHESIS`, `CELL RESCUE, DEFENSE, CELL DEATH AND AGEING`, `CELLULAR TRANSPORT AND TRANSPORTMECHANISMS`, `PROTEIN DESTINATION` | Value Statics: Total count 4346 - Distinct count 13 - Null count 0 Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 4346 - Distinct count 15 - Null count 0 Essential TEXT not null, -- Example Values: `Essential`, `Non-Essential`, `?`, `Ambiguous-Essential` | Value Statics: Total count 4346 - Distinct count 4 - Null count 0 ); CREATE TABLE Classification ( GeneID TEXT not null primary key, Localization TEXT not null, -- Example Values: `cytoplasm`, `cytoskeleton`, `nucleus`, `plasma membrane`, `mitochondria` | Value Statics: Total count 862 - Distinct count 15 - Null count 0 );
retail_world
What is the shipping company for order number 10558?
order number 10558 refers to OrderID = 10558;
SELECT T2.CompanyName FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.OrderID = 10558
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
How many of the customer addresses are inactive?
addresses are inactive refers to address_status = 'Inactive'
SELECT COUNT(*) FROM customer_address AS T1 INNER JOIN address_status AS T2 ON T1.status_id = T2.status_id WHERE T2.address_status = 'Inactive'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
retail_world
What is the shipping cost for order number 10692 from the company Alfreds Futterkiste?
Alfreds Futterkiste is the name of the company; order number 10692 refers to OrderID = 10692;
SELECT T2.Freight FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.OrderID = 10692 AND T1.CompanyName = 'Alfreds Futterkiste'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );
books
How many books were published in Japanese?
published in Japanese refers to language_name = 'Japanese'
SELECT COUNT(T2.book_id) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id WHERE T1.language_name = 'Japanese'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
app_store
How many users holds neutral attitude towards the HTC Weather app? Indicate the app's rating on the Google Play Store.
user holds neutral attitude refers to Sentiment = 'Neutral';
SELECT COUNT(T1.Rating), T1.Rating FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'HTC Weather' AND T2.Sentiment = 'Neutral'
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- Type TEXT, -- Example Values: `Free`, `Paid`, `NaN` | Value Statics: Total count 10840 - Distinct count 3 - Null count 0 Reviews INTEGER, -- Genres TEXT, -- ); CREATE TABLE user_reviews ( Sentiment TEXT, -- Example Values: `Positive`, `nan`, `Neutral`, `Negative` | Value Statics: Total count 64286 - Distinct count 4 - Null count 0 App TEXT references "playstore" (App), -- Translated_Review TEXT, -- Sentiment_Subjectivity TEXT, -- Sentiment_Polarity TEXT, -- );
retail_world
What is the family name of the employee who shipped the order 10521 to CACTU?
order 10521 refers to OrderID = 10521; CustomerID = 'CACTU'; family name refers to LastName;
SELECT T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10521 AND T2.CustomerID = 'CACTU'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), SupplierID INTEGER, -- ProductID INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY (CategoryID) REFERENCES Categories (CategoryID), ); CREATE TABLE Customers ( ContactName TEXT, -- Country TEXT, -- Address TEXT, -- City TEXT, -- CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, PostalCode TEXT, -- CustomerName TEXT, -- ); CREATE TABLE EmployeeTerritories ( TerritoryID INT, -- EmployeeID INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE OrderDetails ( Quantity INTEGER, -- FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), OrderID INTEGER, -- FOREIGN KEY (ProductID) REFERENCES Products (ProductID), OrderDetailID INTEGER PRIMARY KEY AUTOINCREMENT, ProductID INTEGER, -- ); CREATE TABLE Shippers ( ShipperID INTEGER PRIMARY KEY AUTOINCREMENT, ShipperName TEXT, -- Example Values: `Speedy Express`, `United Package`, `Federal Shipping` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Phone TEXT, -- Example Values: `(503) 555-9831`, `(503) 555-3199`, `(503) 555-9931` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE Territory ( TerritoryDescription TEXT, -- RegionID INTEGER, -- TerritoryID INTEGER PRIMARY KEY AUTOINCREMENT, ); CREATE TABLE EmployeeDetails ( EmployeeID INT PRIMARY KEY, Title TEXT, -- Salary INT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), ); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, -- Example Values: `Beverages`, `Condiments`, `Confections`, `Dairy Products`, `Grains/Cereals` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 Description TEXT, -- Example Values: `Soft drinks, coffees, teas, beers, and ales`, `Sweet and savory sauces, relishes, spreads, and seasonings`, `Desserts, candies, and sweet breads`, `Cheeses`, `Breads, crackers, pasta, and cereal` | Value Statics: Total count 8 - Distinct count 8 - Null count 0 ); CREATE TABLE Employees ( Photo TEXT, -- Example Values: `EmpID1.pic`, `EmpID2.pic`, `EmpID3.pic`, `EmpID4.pic`, `EmpID5.pic` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 Notes TEXT, -- Example Values: `Education includes a BA in psychology from Colorado State University. She also completed (The Art of the Cold Call). Nancy is a member of 'Toastmasters International'.`, `Andrew received his BTS commercial and a Ph.D. in international marketing from the University of Dallas. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager and was then named vice president of sales. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.`, `Janet has a BS degree in chemistry from Boston College). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate and was promoted to sales representative.`, `Margaret holds a BA in English literature from Concordia College and an MA from the American Institute of Culinary Arts. She was temporarily assigned to the London office before returning to her permanent post in Seattle.`, `Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree. Upon joining the company as a sales representative, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London, where he was promoted to sales manager. Mr. Buchanan has completed the courses 'Successful Telemarketing' and 'International Sales Management'. He is fluent in French.` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 BirthDate DATE, -- Example Values: `1968-12-08`, `1952-02-19`, `1963-08-30`, `1958-09-19`, `1955-03-04` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT, FirstName TEXT, -- Example Values: `Nancy`, `Andrew`, `Janet`, `Margaret`, `Steven` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 LastName TEXT, -- Example Values: `Davolio`, `Fuller`, `Leverling`, `Peacock`, `Buchanan` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 ); CREATE TABLE Suppliers ( PostalCode TEXT, -- Address TEXT, -- SupplierID INTEGER PRIMARY KEY AUTOINCREMENT, City TEXT, -- Country TEXT, -- Example Values: `UK`, `USA`, `Japan`, `Spain`, `Australia` | Value Statics: Total count 29 - Distinct count 16 - Null count 0 Discontinued INTEGER DEFAULT 0, -- Example Values: `0` | Value Statics: Total count 29 - Distinct count 1 - Null count 0 ContactName TEXT, -- Phone TEXT, -- SupplierName TEXT, -- ); CREATE TABLE EmployeesExtra ( Salary INTEGER, -- Title TEXT, -- FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID), EmployeeID INTEGER PRIMARY KEY, ); CREATE TABLE discontinued_products ( Discontinued INTEGER, -- ProductID INTEGER PRIMARY KEY, ); CREATE TABLE Orders ( OrderID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerID INTEGER, -- FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID), FOREIGN KEY (ShipperID) REFERENCES Shippers (ShipperID), FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID), ShipperID INTEGER, -- Example Values: `3`, `1`, `2` | Value Statics: Total count 196 - Distinct count 3 - Null count 0 OrderDate DATETIME, -- EmployeeID INTEGER, -- Example Values: `5`, `6`, `4`, `3`, `9` | Value Statics: Total count 196 - Distinct count 9 - Null count 0 ); CREATE TABLE Territories ( TerritoryDescription TEXT, -- RegionDescription TEXT, -- ); CREATE TABLE ShippingInfo ( ShipCountry TEXT, -- ShippedDate DATETIME, -- FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), OrderID INTEGER PRIMARY KEY, );