instruction
stringlengths
212
6.3k
output
stringlengths
6
2.03k
### Instruction: CREATE TABLE table_56062 ( "State" text, "Votes" real, "Votes since 1856" real, "Democratic votes" real, "D votes since 1856" real, "% of D votes" text, "D % since 1856" text, "Republican votes" real, "% of R votes" text, "R % since 1856" text, "Other votes" ...
SELECT COUNT("Democratic votes") FROM table_56062 WHERE "Other votes" < '18' AND "% of R votes" = '52.63%' AND "Votes since 1856" < '38'
### Instruction: CREATE TABLE table_76023 ( "Country" text, "Total Freshwater Withdrawal (km 3 /yr)" real, "Per Capita Withdrawal (m 3 /p/yr)" real, "Domestic Use (m 3 /p/yr)(in %)" text, "Industrial Use (m 3 /p/yr)(in %)" text, "Agricultural Use (m 3 /p/yr)(in %)" text ) -- Using valid SQLite...
SELECT MAX("Per Capita Withdrawal (m 3 /p/yr)") FROM table_76023 WHERE "Agricultural Use (m 3 /p/yr)(in %)" = '1363(92%)' AND "Total Freshwater Withdrawal (km 3 /yr)" < '42.7'
### Instruction: CREATE TABLE competition_record ( Competition_ID int, Farm_ID int, Rank int ) CREATE TABLE city ( City_ID int, Official_Name text, Status text, Area_km_2 real, Population real, Census_Ranking text ) CREATE TABLE farm_competition ( Competition_ID int, Year i...
SELECT Year, COUNT(Year) FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID ORDER BY Year DESC
### Instruction: CREATE TABLE Faculty_Participates_in ( FacID INTEGER, actid INTEGER ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Participates_in ( ...
SELECT Sex, COUNT(*) FROM Faculty GROUP BY Sex ORDER BY COUNT(*)
### Instruction: CREATE TABLE genre ( g_name varchar2(20), rating varchar2(10), most_popular_in varchar2(50) ) CREATE TABLE artist ( artist_name varchar2(50), country varchar2(20), gender varchar2(20), preferred_genre varchar2(50) ) CREATE TABLE files ( f_id number(10), artist_name...
SELECT languages, AVG(rating) FROM song GROUP BY languages
### Instruction: CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Faculty_Participates_in ( FacID INTEGER, actid INTEGER ) CREATE TABLE Participates_in ( ...
SELECT Building, COUNT(*) FROM Faculty GROUP BY Building ORDER BY Building DESC
### Instruction: CREATE TABLE enrollments ( campus number, year number, totalenrollment_ay number, fte_ay number ) CREATE TABLE csu_fees ( campus number, year number, campusfee number ) CREATE TABLE campuses ( id number, campus text, location text, county text, year num...
SELECT T1.campus, SUM(T2.degrees) FROM campuses AS T1 JOIN degrees AS T2 ON T1.id = T2.campus WHERE T1.county = "Orange" AND T2.year >= 2000 GROUP BY T1.campus
### Instruction: CREATE TABLE Video_Games ( GameID INTEGER, GName VARCHAR(40), GType VARCHAR(40) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Pl...
SELECT LName, COUNT(LName) FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.OnScholarship = 'Y' GROUP BY LName
### Instruction: CREATE TABLE player ( Player_ID int, Sponsor_name text, Player_name text, Gender text, Residence text, Occupation text, Votes int, Rank text ) CREATE TABLE player_coach ( Player_ID int, Coach_ID int, Starting_year int ) CREATE TABLE club ( Club_ID int, ...
SELECT Occupation, COUNT(Occupation) FROM player GROUP BY Occupation ORDER BY Occupation
### Instruction: CREATE TABLE match ( round number, location text, country text, date text, fastest_qualifying text, winning_pilot text, winning_aircraft text ) CREATE TABLE pilot ( pilot_id number, name text, age number ) CREATE TABLE aircraft ( aircraft_id number, air...
SELECT name FROM pilot ORDER BY age DESC
### Instruction: CREATE TABLE documents_with_expenses ( document_id number, budget_type_code text, document_details text ) CREATE TABLE statements ( statement_id number, statement_details text ) CREATE TABLE accounts ( account_id number, statement_id number, account_details text ) CRE...
SELECT document_type_code, document_type_name, document_type_description FROM ref_document_types
### Instruction: CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, ...
SELECT Rank, COUNT(*) FROM Faculty GROUP BY Rank ORDER BY COUNT(*)
### Instruction: CREATE TABLE competition_record ( competition_id number, farm_id number, rank number ) CREATE TABLE farm_competition ( competition_id number, year number, theme text, host_city_id number, hosts text ) CREATE TABLE farm ( farm_id number, year number, total_h...
SELECT T1.official_name FROM city AS T1 JOIN farm_competition AS T2 ON T1.city_id = T2.host_city_id GROUP BY T2.host_city_id HAVING COUNT(*) > 1
### Instruction: CREATE TABLE Participates_in ( stuid INTEGER, actid INTEGER ) CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ) CREATE TABLE Faculty_Participates_...
SELECT Rank, COUNT(*) FROM Faculty GROUP BY Sex, Rank ORDER BY Rank
### Instruction: CREATE TABLE table_48130 ( "Country" text, "UN budget" text, "International Trade (Millions of USD) 2011" real, "GDP (nominal) (Millions of USD) 2011" real, "GDP (PPP) (Millions of USD) 2011" real, "Population" real ) -- Using valid SQLite, answer the following questions for t...
SELECT SUM("International Trade (Millions of USD) 2011") FROM table_48130 WHERE "GDP (PPP) (Millions of USD) 2011" < '471,890' AND "UN budget" = '0.238%' AND "GDP (nominal) (Millions of USD) 2011" < '845,680'
### Instruction: CREATE TABLE accounts ( account_id number, statement_id number, account_details text ) CREATE TABLE ref_budget_codes ( budget_type_code text, budget_type_description text ) CREATE TABLE projects ( project_id number, project_details text ) CREATE TABLE documents_with_expen...
SELECT budget_type_description FROM ref_budget_codes WHERE budget_type_code = "ORG"
### Instruction: CREATE TABLE match_result ( Rank int, Club_ID int, Gold int, Big_Silver int, Small_Silver int, Bronze int, Points int ) CREATE TABLE coach ( Coach_ID int, Coach_name text, Gender text, Club_ID int, Rank int ) CREATE TABLE club ( Club_ID int, Clu...
SELECT Residence, COUNT(Residence) FROM player WHERE Occupation <> "Researcher" GROUP BY Residence
### Instruction: CREATE TABLE screen_mode ( Graphics_mode real, Char_cells text, Pixels text, Hardware_colours real, used_kb real, map text, Type text ) CREATE TABLE phone ( Company_name text, Hardware_Model_name text, Accreditation_type text, Accreditation_level text, D...
SELECT T2.Company_name, COUNT(T2.Company_name) FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = "Graphics" GROUP BY T2.Company_name
### Instruction: CREATE TABLE table_dev_53 ( "id" int, "anemia" bool, "gender" string, "hemoglobin_a1c_hba1c" float, "dyslipidemia" bool, "hct" int, "hematocrit_hct" float, "persistent_macroalbuminuria" bool, "urine_albumin" int, "high_density_lipoprotein_cholesterol_hdl_c" int, ...
SELECT * FROM table_dev_53 WHERE anemia = 1 OR (hemoglobin_a1c_hba1c < 11 AND gender = 'female') OR (hemoglobin_a1c_hba1c < 12 AND gender = 'male') OR coagulopathy = 1
### Instruction: CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State ...
SELECT Name, COUNT(Name) FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Monterey" AND T2.Price < 50 GROUP BY Name ORDER BY COUNT(Name) DESC
### Instruction: CREATE TABLE city ( City_ID int, Official_Name text, Status text, Area_km_2 real, Population real, Census_Ranking text ) CREATE TABLE competition_record ( Competition_ID int, Farm_ID int, Rank int ) CREATE TABLE farm_competition ( Competition_ID int, Year i...
SELECT Year, COUNT(Year) FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID ORDER BY Year
### Instruction: CREATE TABLE table_26413 ( "Rank" real, "WS Points" real, "Name" text, "Country" text, "08-09 I/O best" real, "08-09 GP/JGP best" real, "08-09 GP/JGP 2nd" real, "08-09 OI best" real, "08-09 OI 2nd" real, "07-08 I/O best" real, "07-08 GP/JGP best" real, "0...
SELECT MIN("08-09 GP/JGP 2nd") FROM table_26413 WHERE "WS Points" = '3197'
### Instruction: CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Ti...
SELECT meter_200, SUM(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 DESC
### Instruction: CREATE TABLE table_11432 ( "Average population (x 1000)" real, "Live births" real, "Deaths" text, "Natural change" real, "Crude birth rate (per 1000)" real, "Crude death rate (per 1000)" real, "Natural change (per 1000)" real ) -- Using valid SQLite, answer the following q...
SELECT SUM("Crude birth rate (per 1000)") FROM table_11432 WHERE "Crude death rate (per 1000)" < '6.2' AND "Average population (x 1000)" > '2,770' AND "Natural change (per 1000)" = '17.2'
### Instruction: CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Dorm ( dormid...
SELECT city_code, COUNT(*) FROM Student WHERE Sex = 'M' GROUP BY city_code ORDER BY COUNT(*) DESC
### Instruction: CREATE TABLE Participates_in ( stuid INTEGER, actid INTEGER ) CREATE TABLE Faculty_Participates_in ( FacID INTEGER, actid INTEGER ) CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, ...
SELECT Rank, COUNT(Rank) FROM Faculty GROUP BY Rank ORDER BY COUNT(Rank) DESC
### Instruction: CREATE TABLE song ( song_name varchar2(50), artist_name varchar2(50), country varchar2(20), f_id number(10), genre_is varchar2(20), rating number(10), languages varchar2(20), releasedate Date, resolution number(10) ) CREATE TABLE genre ( g_name varchar2(20), ...
SELECT languages, AVG(rating) FROM song GROUP BY languages
### Instruction: CREATE TABLE table_74041 ( "Model" text, "Launch" text, "Model Number" text, "Code name" text, "Fab ( nm )" real, "Bus interface" text, "Memory ( MiB )" text, "Core ( MHz )" text, "Memory ( MHz )" text, "Config core 1" text, "Pixel ( GP /s)" text, "Textur...
SELECT COUNT("Texture ( GT /s)") FROM table_74041 WHERE "TDP (Watts) GPU only" = '18'
### Instruction: CREATE TABLE Institution ( Institution_id text, Institution text, Location text, Founded real, Type text, Enrollment int, Team text, Primary_Conference text, building_id text ) CREATE TABLE building ( building_id text, Name text, Street_address text, ...
SELECT Name, Height_feet FROM building AS T1 JOIN Institution AS T2 ON T1.building_id = T2.building_id WHERE T2.Founded > 1880 ORDER BY Name DESC
### Instruction: CREATE TABLE table_11573 ( "Crew" real, "Open 1st VIII" text, "Open 2nd VIII" text, "Open 3rd VIII" text, "Year 11 1st VIII" text, "Year 11 2nd VIII" text, "Year 11 3rd VIII" text, "Year 10 1st Quad" text, "Year 10 2nd Quad" text, "Year 10 3rd Quad" text, "Ye...
SELECT "Year 10 6th Quad" FROM table_11573 WHERE "Open 2nd VIII" = 'acgs' AND "Year 11 2nd VIII" = 'nc'
### Instruction: CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Ye...
SELECT Nationality, SUM(meter_100) FROM swimmer GROUP BY Nationality ORDER BY SUM(meter_100) DESC
### Instruction: CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, ...
SELECT Nationality, AVG(meter_100) FROM swimmer GROUP BY Nationality ORDER BY AVG(meter_100) DESC
### Instruction: CREATE TABLE table_28576 ( "Country" text, "Area (km\u00b2) 2010" real, "Population 2011" real, "GDP (PPP) ( Intl. $ ) 2011" text, "GDP (PPP) per capita ( Intl. $ ) 2011" text, "Income inequality 1992-2010 (latest available)" text, "HDI 2012" text, "FSI 2012" text, "...
SELECT "FSI 2012" FROM table_28576 WHERE "CPI 2012" = '42.7'
### Instruction: CREATE TABLE table_27284 ( "Model" text, "Power" text, "Torque" text, "Gearbox" text, "Weight" text, "Seating" text, "Brakes" text, "Wheels" text, "Tyres" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What kind of b...
SELECT "Brakes" FROM table_27284 WHERE "Wheels" = '16x8.0JJ (front) 16x8.0JJ (rear)' AND "Tyres" = '225/50R16 92V(front) 225/50R16 92V(rear)' AND "Model" = 'Type RB 4AT'
### Instruction: CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, ...
SELECT meter_200, AVG(ID) FROM swimmer GROUP BY meter_200 ORDER BY AVG(ID)
### Instruction: CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) CREATE TABLE stadium ( ID int, name text, Capacity int, Ci...
SELECT Nationality, AVG(meter_100) FROM swimmer GROUP BY Nationality ORDER BY AVG(meter_100)
### Instruction: CREATE TABLE protein ( common_name text, protein_name text, divergence_from_human_lineage real, accession_number text, sequence_length real, sequence_identity_to_human_protein text, Institution_id text ) CREATE TABLE Institution ( Institution_id text, Institution te...
SELECT Name, Height_feet FROM building AS T1 JOIN Institution AS T2 ON T1.building_id = T2.building_id WHERE T2.Founded > 1880 ORDER BY Height_feet
### Instruction: CREATE TABLE table_27255 ( "Rank" real, "WS Points" real, "Name" text, "Country" text, "09-10 I/O best" real, "09-10 GP/JGP best" real, "09-10 GP/JGP 2nd" real, "09-10 OI best" real, "09-10 OI 2nd" real, "08-09 I/O best" real, "08-09 GP/JGP best" real, "0...
SELECT "08-09 GP/JGP 2nd" FROM table_27255 WHERE "WS Points" = '947'
### Instruction: CREATE TABLE table_test_7 ( "id" int, "bleeding" int, "left_ventricular_ejection_fraction_lvef" int, "intra_aortic_balloon_pump_iabp" bool, "systolic_blood_pressure_sbp" int, "dialysis" bool, "intravenous_pressors" bool, "non_infarct_related_vessel" bool, "heart_dise...
SELECT * FROM table_test_7 WHERE body_weight < 60
### Instruction: CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEG...
SELECT city_code, COUNT(*) FROM Student GROUP BY city_code ORDER BY COUNT(*)
### Instruction: CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, ...
SELECT meter_200, SUM(ID) FROM swimmer GROUP BY meter_200 ORDER BY meter_200
### Instruction: CREATE TABLE claims ( claim_id number, policy_id number, date_claim_made time, date_claim_settled time, amount_claimed number, amount_settled number ) CREATE TABLE customers ( customer_id number, customer_details text ) CREATE TABLE customer_policies ( policy_id nu...
SELECT SUM(amount_settled) FROM settlements
### Instruction: CREATE TABLE table_61208 ( "7:00 am" text, "7:30 am" text, "8:00 am" text, "9:00 am" text, "10:00 am" text, "11:00 am" text, "noon" text, "12:30 pm" text, "1:00 pm" text, "1:30 pm" text, "2:00 pm" text, "3:00 pm" text, "3:30 pm" text, "5:00 pm" te...
SELECT "12:30 pm" FROM table_61208 WHERE "1:30 pm" = 'local programs' AND "3:30 pm" = 'power rangers lost galaxy'
### Instruction: CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABL...
SELECT city_code, AVG(Age) FROM Student WHERE Sex = 'M' GROUP BY city_code ORDER BY city_code DESC
### Instruction: CREATE TABLE accounts ( account_id number, statement_id number, account_details text ) CREATE TABLE statements ( statement_id number, statement_details text ) CREATE TABLE ref_budget_codes ( budget_type_code text, budget_type_description text ) CREATE TABLE projects ( ...
SELECT document_id FROM documents_with_expenses WHERE budget_type_code = 'SF'
### Instruction: CREATE TABLE table_dev_39 ( "id" int, "gender" string, "random_serum_glucose" int, "glycated_hemoglobin" bool, "heart_disease" bool, "stroke" bool, "diabetes_mellitus" bool, "hgba1c" float, "diabetic" string, "fasting_blood_glucose_fbg" float, "fasting_plasma...
SELECT * FROM table_dev_39 WHERE kidney_disease = 1 OR (serum_creatinine > 1.5 AND gender = 'male') OR (serum_creatinine > 1.3 AND gender = 'female')
### Instruction: CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Adviso...
SELECT city_code, COUNT(*) FROM Student WHERE Sex = 'M' GROUP BY city_code ORDER BY city_code DESC
### Instruction: CREATE TABLE table_test_7 ( "id" int, "bleeding" int, "left_ventricular_ejection_fraction_lvef" int, "intra_aortic_balloon_pump_iabp" bool, "systolic_blood_pressure_sbp" int, "dialysis" bool, "intravenous_pressors" bool, "non_infarct_related_vessel" bool, "heart_dise...
SELECT * FROM table_test_7 WHERE heart_disease = 1
### Instruction: CREATE TABLE ref_document_types ( document_type_code text, document_type_name text, document_type_description text ) CREATE TABLE documents_with_expenses ( document_id number, budget_type_code text, document_details text ) CREATE TABLE projects ( project_id number, pro...
SELECT document_type_description FROM ref_document_types WHERE document_type_name = "Film"
### Instruction: CREATE TABLE club ( Club_ID int, name text, Region text, Start_year text ) CREATE TABLE club_rank ( Rank real, Club_ID int, Gold real, Silver real, Bronze real, Total real ) CREATE TABLE competition_result ( Competition_ID int, Club_ID_1 int, Club_I...
SELECT T1.name, COUNT(T1.name) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID GROUP BY T1.name
### Instruction: CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Adviso...
SELECT Sex, COUNT(*) FROM Student WHERE Age > (SELECT AVG(Age) FROM Student) GROUP BY Sex ORDER BY COUNT(*) DESC
### Instruction: CREATE TABLE products ( product_id number, color_code text, product_category_code text, product_name text, typical_buying_price text, typical_selling_price text, product_description text, other_product_details text ) CREATE TABLE ref_colors ( color_code text, co...
SELECT DISTINCT characteristic_name FROM characteristics
### Instruction: CREATE TABLE player_coach ( Player_ID int, Coach_ID int, Starting_year int ) CREATE TABLE match_result ( Rank int, Club_ID int, Gold int, Big_Silver int, Small_Silver int, Bronze int, Points int ) CREATE TABLE player ( Player_ID int, Sponsor_name text, ...
SELECT Occupation, COUNT(*) FROM player GROUP BY Occupation ORDER BY COUNT(*) DESC
### Instruction: CREATE TABLE table_23096 ( "Districts of Bihar" text, "Total Population 2001" real, "Male Population 2001" real, "Female Population 2001" real, "Growth Rate 1981-91" text, "Growth Rate 1991-01" text, "Sex Ratio \u2021 1991" real, "Sex Ratio \u2021 2001" real, "Popula...
SELECT "Growth Rate 1991-01" FROM table_23096 WHERE "Sex Ratio \u2021 2001" = '937'
### Instruction: CREATE TABLE statements ( statement_id number, statement_details text ) CREATE TABLE documents ( document_id number, document_type_code text, project_id number, document_date time, document_name text, document_description text, other_details text ) CREATE TABLE doc...
SELECT document_name, document_id FROM documents WHERE document_type_code = "BK"
### Instruction: CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Lives_in ( stui...
SELECT gender, SUM(student_capacity) FROM Dorm GROUP BY gender ORDER BY SUM(student_capacity) DESC
### Instruction: CREATE TABLE table_26350 ( "equation:" text, "k_{\\mathrm{H,pc}} = \\frac{p}{c_\\mathrm{aq}}" text, "k_{\\mathrm{H,cp}} = \\frac{c_\\mathrm{aq}}{p}" text, "k_{\\mathrm{H,px}} = \\frac{p}{x}" text, "k_{\\mathrm{H,cc}} = \\frac{c_{\\mathrm{aq}}}{c_{\\mathrm{gas}}}" text ) -- Using v...
SELECT COUNT("k_{\\mathrm{H,cc}} = \\frac{c_{\\mathrm{aq}}}{c_{\\mathrm{gas}}}") FROM table_26350 WHERE "k_{\\mathrm{H,px}} = \\frac{p}{x}" = '14.97 × 10'
### Instruction: CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Lives_in ( stuid INTEGER...
SELECT city_code, AVG(Age) FROM Student WHERE Sex = 'M' GROUP BY city_code ORDER BY city_code DESC
### Instruction: CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Has_Allergy ( StuID INTEGER, Allergy VARCHAR(20) ) CREATE TABLE Allergy_Type ( Aller...
SELECT T1.Allergy, COUNT(T1.Allergy) FROM Allergy_Type AS T1 JOIN Has_Allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = "Lisa" GROUP BY T1.Allergy ORDER BY T1.Allergy
### Instruction: CREATE TABLE ref_document_types ( document_type_code text, document_type_name text, document_type_description text ) CREATE TABLE documents_with_expenses ( document_id number, budget_type_code text, document_details text ) CREATE TABLE statements ( statement_id number, ...
SELECT project_id FROM documents GROUP BY project_id HAVING COUNT(*) >= 2
### Instruction: CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 t...
SELECT Nationality, AVG(meter_100) FROM swimmer GROUP BY Nationality ORDER BY AVG(meter_100)
### Instruction: CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, ...
SELECT meter_200, SUM(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY SUM(meter_100)
### Instruction: CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Dorm_amen...
SELECT Sex, COUNT(*) FROM Student WHERE Age > (SELECT AVG(Age) FROM Student) GROUP BY Sex ORDER BY Sex
### Instruction: CREATE TABLE genre ( g_name varchar2(20), rating varchar2(10), most_popular_in varchar2(50) ) CREATE TABLE song ( song_name varchar2(50), artist_name varchar2(50), country varchar2(20), f_id number(10), genre_is varchar2(20), rating number(10), languages varchar...
SELECT formats, COUNT(*) FROM files GROUP BY formats
### Instruction: CREATE TABLE table_41092 ( "Tournament" text, "1987" text, "1988" text, "1989" text, "1990" text, "1991" text, "1992" text, "1993" text, "1994" text, "1995" text, "1996" text, "1997" text, "1998" text, "1999" text, "2000" text, "2001" text...
SELECT "1997" FROM table_41092 WHERE "2003" = '0 / 4'
### Instruction: CREATE TABLE club ( Club_ID int, Club_name text, Region text, Start_year int ) CREATE TABLE player_coach ( Player_ID int, Coach_ID int, Starting_year int ) CREATE TABLE coach ( Coach_ID int, Coach_name text, Gender text, Club_ID int, Rank int ) CREATE ...
SELECT Gender, COUNT(Gender) FROM player GROUP BY Gender ORDER BY Gender
### Instruction: CREATE TABLE farm_competition ( Competition_ID int, Year int, Theme text, Host_city_ID int, Hosts text ) CREATE TABLE competition_record ( Competition_ID int, Farm_ID int, Rank int ) CREATE TABLE city ( City_ID int, Official_Name text, Status text, Area...
SELECT Official_Name, COUNT(Official_Name) FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY Official_Name
### Instruction: CREATE TABLE instruments ( songid number, bandmateid number, instrument text ) CREATE TABLE albums ( aid number, title text, year number, label text, type text ) CREATE TABLE tracklists ( albumid number, position number, songid number ) CREATE TABLE perfor...
SELECT type FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid JOIN band AS T3 ON T1.bandmate = T3.id WHERE T3.firstname = "Solveig" AND T2.title = "A Bar In Amsterdam"
### Instruction: CREATE TABLE projects ( project_id number, project_details text ) CREATE TABLE ref_budget_codes ( budget_type_code text, budget_type_description text ) CREATE TABLE statements ( statement_id number, statement_details text ) CREATE TABLE documents_with_expenses ( document_...
SELECT COUNT(*) FROM documents WHERE NOT document_id IN (SELECT document_id FROM documents_with_expenses)
### Instruction: CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Dorm_am...
SELECT city_code, AVG(Age) FROM Student WHERE Sex = 'M' GROUP BY city_code ORDER BY city_code
### Instruction: CREATE TABLE city ( City_ID int, Official_Name text, Status text, Area_km_2 real, Population real, Census_Ranking text ) CREATE TABLE farm_competition ( Competition_ID int, Year int, Theme text, Host_city_ID int, Hosts text ) CREATE TABLE farm ( Farm_ID...
SELECT Official_Name, COUNT(Official_Name) FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY Official_Name
### Instruction: CREATE TABLE table_73710 ( "Model" text, "Launch" text, "Model Number" text, "Code name" text, "Fab ( nm )" text, "Bus interface" text, "Memory ( MiB )" text, "Core clock ( MHz )" text, "Memory clock ( MHz )" text, "Config core 1" text, "Pixel ( GP /s)" text,...
SELECT "Code name" FROM table_73710 WHERE "Model" = 'Radeon HD 6650M'
### Instruction: CREATE TABLE table_dev_38 ( "id" int, "gender" string, "serum_potassium" float, "systolic_blood_pressure_sbp" int, "creatinine_clearance_cl" float, "estimated_glomerular_filtration_rate_egfr" int, "diastolic_blood_pressure_dbp" int, "ace_inhibitors" bool, "serum_crea...
SELECT * FROM table_dev_38 WHERE (serum_potassium > 5.5 AND ace_inhibitors = 0) OR (serum_potassium > 5.9 AND ace_inhibitors = 1)
### Instruction: CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex...
SELECT city_code, AVG(Age) FROM Student GROUP BY city_code ORDER BY AVG(Age) DESC
### Instruction: CREATE TABLE table_203_195 ( id number, "pump type and source" text, "typical use" text, "35 \u00b0c\n(e.g. heated screed floor)" number, "45 \u00b0c\n(e.g. heated screed floor)" number, "55 \u00b0c\n(e.g. heated timber floor)" number, "65 \u00b0c\n(e.g. radiator or dhw)" nu...
SELECT COUNT("pump type and source") FROM table_203_195 WHERE NOT "75 \u00b0c\n(e.g. radiator and dhw)" IS NULL
### Instruction: CREATE TABLE table_13802 ( "Model number" text, "sSpec number" text, "Cores" text, "Frequency" text, "Turbo" text, "L2 cache" text, "L3 cache" text, "GPU model" text, "GPU frequency" text, "Socket" text, "I/O bus" text, "Release date" text, "Part numb...
SELECT "Release price ( USD )" FROM table_13802 WHERE "Release date" = 'april 2012' AND "Part number(s)" = 'cm8063701211900bx80637i73770s'
### Instruction: CREATE TABLE Participates_in ( stuid INTEGER, actid INTEGER ) CREATE TABLE Activity ( actid INTEGER, activity_name varchar(25) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor ...
SELECT Rank, COUNT(*) FROM Faculty GROUP BY Rank ORDER BY Rank
### Instruction: CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INTEGER, Price INTEGER, Score INTEGER, Cases INTEGER, Drink TEXT ) CREATE TABLE appe...
SELECT Name, COUNT(Name) FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Monterey" AND T2.Price < 50 GROUP BY Name ORDER BY COUNT(Name) DESC
### Instruction: CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VA...
SELECT city_code, COUNT(*) FROM Student GROUP BY city_code ORDER BY COUNT(*) DESC
### Instruction: CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Majo...
SELECT gender, SUM(student_capacity) FROM Dorm GROUP BY gender ORDER BY gender DESC
### Instruction: CREATE TABLE match_result ( Rank int, Club_ID int, Gold int, Big_Silver int, Small_Silver int, Bronze int, Points int ) CREATE TABLE player ( Player_ID int, Sponsor_name text, Player_name text, Gender text, Residence text, Occupation text, Votes ...
SELECT Occupation, COUNT(Occupation) FROM player GROUP BY Occupation ORDER BY Occupation DESC
### Instruction: CREATE TABLE table_38961 ( "Poll" text, "Wk 1" text, "Wk 2" text, "Wk 3" text, "Wk 4" text, "Wk 5" text, "Wk 6" text, "Wk 7" text, "Wk 8" real, "Wk 9" real, "Wk 10" real, "Wk 11" real, "Wk 13" real, "Wk 14" real ) -- Using valid SQLite, answer t...
SELECT MAX("Wk 9") FROM table_38961 WHERE "Wk 6" = '7' AND "Wk 10" > '2' AND "Wk 7" = '5' AND "Wk 11" < '2'
### Instruction: CREATE TABLE table_41088 ( "Tournament" text, "1987" text, "1988" text, "1989" text, "1990" text, "1991" text, "1992" text, "1993" text, "1994" text, "1995" text, "1996" text, "1997" text, "1998" text, "1999" text, "2000" text, "2001" text...
SELECT "1994" FROM table_41088 WHERE "2002" = 'atp masters series'
### Instruction: CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VA...
SELECT gender, SUM(student_capacity) FROM Dorm GROUP BY gender ORDER BY gender
### Instruction: CREATE TABLE coach ( Coach_ID int, Coach_name text, Gender text, Club_ID int, Rank int ) CREATE TABLE player ( Player_ID int, Sponsor_name text, Player_name text, Gender text, Residence text, Occupation text, Votes int, Rank text ) CREATE TABLE play...
SELECT Occupation, COUNT(*) FROM player GROUP BY Occupation ORDER BY Occupation
### Instruction: CREATE TABLE table_37643 ( "Location (State, City)" text, "USN 2013" real, "BW 2013" real, "Forbes 2011" real, "Ec 2013" real, "FT 2011" real, "AE 2011" real, "CNN 2011" real, "BI 2013" real, "ARWU 2012" real ) -- Using valid SQLite, answer the following questi...
SELECT SUM("USN 2013") FROM table_37643 WHERE "BW 2013" < '1000' AND "Forbes 2011" > '17' AND "CNN 2011" < '13'
### Instruction: CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEG...
SELECT Sex, COUNT(*) FROM Student WHERE Age > (SELECT AVG(Age) FROM Student) GROUP BY Sex ORDER BY Sex DESC
### Instruction: CREATE TABLE table_9463 ( "Rank" real, "Airport" text, "Location" text, "IATA" text, "1985\u201386" real, "1990\u201391" real, "1995\u201396" real, "2000\u201301" real, "2005\u201306" real, "2007\u201308" real, "2009\u201310" real, "2010-11" real ) -- U...
SELECT MAX("Rank") FROM table_9463 WHERE "1995\u201396" > '662' AND "Location" = 'adelaide, south australia'
### Instruction: CREATE TABLE table_43505 ( "Tournament" text, "1978" text, "1979" text, "1980" text, "1982" text, "1983" text, "1984" text, "1985" text, "1986" text, "1987" text, "1988" text, "1989" text, "1990" text, "1991" text, "1992" text, "Career SR"...
SELECT "1982" FROM table_43505 WHERE "1978" = 'a' AND "1985" = '4r' AND "1991" = '1r'
### Instruction: CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CR...
SELECT Nationality, SUM(meter_100) FROM swimmer GROUP BY Nationality ORDER BY SUM(meter_100)
### Instruction: CREATE TABLE customers_cards ( card_id number, customer_id number, card_type_code text, card_number text, date_valid_from time, date_valid_to time, other_card_details text ) CREATE TABLE financial_transactions ( transaction_id number, previous_transaction_id number,...
SELECT COUNT(DISTINCT transaction_type) FROM financial_transactions
### Instruction: CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INTEGER, Price INTEGER, Score INTE...
SELECT Name, COUNT(Name) FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Monterey" AND T2.Price < 50 GROUP BY Name ORDER BY Name DESC
### Instruction: CREATE TABLE campuses ( id number, campus text, location text, county text, year number ) CREATE TABLE enrollments ( campus number, year number, totalenrollment_ay number, fte_ay number ) CREATE TABLE faculty ( campus number, year number, faculty number...
SELECT SUM(t1.graduate) FROM discipline_enrollments AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t1.year = 2004 AND t2.campus = "San Francisco State University"
### Instruction: CREATE TABLE Faculty_Participates_in ( FacID INTEGER, actid INTEGER ) CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ) CREATE TABLE Activity ( ...
SELECT Rank, COUNT(Rank) FROM Faculty GROUP BY Rank ORDER BY Rank
### Instruction: CREATE TABLE furniture_manufacte ( Furniture_ID VARCHAR, manufacturer_id VARCHAR ) CREATE TABLE manufacturer ( name VARCHAR, manufacturer_id VARCHAR ) CREATE TABLE furniture ( Furniture_ID VARCHAR, num_of_component INTEGER ) -- Using valid SQLite, answer the following questi...
SELECT t3.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID JOIN manufacturer AS t3 ON t2.manufacturer_id = t3.manufacturer_id WHERE t1.num_of_component < 6 INTERSECT SELECT t3.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID JOIN ...
### Instruction: CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABL...
SELECT city_code, AVG(Age) FROM Student GROUP BY city_code ORDER BY AVG(Age)
### Instruction: CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ) CREATE TABLE Activity ( actid INTEGER, activity_name varchar(25) ) CREATE TABLE Student ( St...
SELECT Rank, COUNT(*) FROM Faculty GROUP BY Rank ORDER BY Rank DESC
### Instruction: CREATE TABLE table_16627 ( "Crew" real, "Open 1st VIII" text, "Open 2nd VIII" text, "Open 3rd VIII" text, "U16 1st VIII" text, "U16 2nd VIII" text, "U16 3rd VIII" text, "U15 1st IV" text, "U15 2nd IV" text, "U15 3rd IV" text, "U15 4th IV" text, "U15 5th I...
SELECT COUNT("Crew") FROM table_16627 WHERE "U15 3rd IV" = 'BGS' AND "U15 1st IV" = 'ACGS' AND "Open 1st VIII" = 'ACGS'
### Instruction: CREATE TABLE table_42586 ( "Average population (x 1,000)" text, "Live births" text, "Deaths" text, "Natural change" text, "Migration" text, "Crude birth rate (per 1,000)" real, "Crude death rate (per 1,000)" real, "Natural change (per 1,000)" real, "Migration (per 1,...
SELECT AVG("Crude death rate (per 1,000)") FROM table_42586 WHERE "Migration (per 1,000)" > '-5.06' AND "Natural change (per 1,000)" > '7.06'
### Instruction: CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Dorm_amen...
SELECT city_code, AVG(Age) FROM Student GROUP BY city_code ORDER BY city_code DESC