instruction
stringlengths
212
6.3k
output
stringlengths
6
2.03k
### Instruction: CREATE TABLE table_name_1 ( gross_debt_in_ INTEGER, debt_held_by_public__$billions_ VARCHAR, end_of_fiscal_year VARCHAR, as__percentage_of_gdp_low_high VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For End of Fiscal Years past 1980 ...
SELECT AVG(gross_debt_in_) AS $billions_undeflated_treas FROM table_name_1 WHERE end_of_fiscal_year > 1980 AND as__percentage_of_gdp_low_high = "83.4-84.4" AND debt_held_by_public__$billions_ < 7 OFFSET 552
### Instruction: CREATE TABLE table_test_9 ( "id" int, "ejection_fraction_ef" int, "anemia" bool, "child_pugh_class" string, "systolic_blood_pressure_sbp" int, "leukopenia" int, "heart_disease" bool, "stroke" bool, "av_block" bool, "renal_disease" bool, "hepatic_disease" bool...
SELECT * FROM table_test_9 WHERE systolic_blood_pressure_sbp < 80
### Instruction: CREATE TABLE competition_result ( Competition_ID int, Club_ID_1 int, Club_ID_2 int, Score text ) CREATE TABLE player ( Player_ID int, name text, Position text, Club_ID int, Apps real, Tries real, Goals text, Points real ) CREATE TABLE club ( Club_ID...
SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type ORDER BY COUNT(*)
### Instruction: 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 appellations ( No INTEGER, Appelation TEXT, County TEXT, Sta...
SELECT Winery, COUNT(Winery) FROM wine WHERE Price > 100 GROUP BY Grape, Winery ORDER BY COUNT(Winery) DESC
### Instruction: CREATE TABLE screen_mode ( graphics_mode number, char_cells text, pixels text, hardware_colours number, used_kb number, map text, type text ) CREATE TABLE chip_model ( model_name text, launch_year number, ram_mib number, rom_mib number, slots text, w...
SELECT MAX(T1.ram_mib), MIN(T1.ram_mib) FROM chip_model AS T1 JOIN phone AS T2 ON T1.model_name = T2.chip_model WHERE T2.company_name = "Nokia Corporation"
### Instruction: CREATE TABLE player ( Player_ID int, name text, Position text, Club_ID int, Apps real, Tries real, Goals text, Points real ) CREATE TABLE competition_result ( Competition_ID int, Club_ID_1 int, Club_ID_2 int, Score text ) CREATE TABLE competition ( ...
SELECT Position, COUNT(*) FROM player WHERE Points < 30 GROUP BY Position ORDER BY Position DESC
### Instruction: CREATE TABLE table_train_10 ( "id" int, "severe_sepsis" bool, "consent" bool, "raising_legs_or_head" bool, "intention_to_arterial_catheter" bool, "allergy_to_adhesive" bool, "intention_to_central_venous_catheter" bool, "septic_shock" bool, "age" float, "NOUSE" fl...
SELECT * FROM table_train_10 WHERE age >= 18 AND (severe_sepsis = 1 OR septic_shock = 1) AND intention_to_arterial_catheter = 1 AND (intention_to_central_venous_catheter = 0 OR intention_to_central_venous_catheter = 1)
### Instruction: CREATE TABLE club ( Club_ID int, name text, Region text, Start_year text ) CREATE TABLE player ( Player_ID int, name text, Position text, Club_ID int, Apps real, Tries real, Goals text, Points real ) CREATE TABLE competition_result ( Competition_ID ...
SELECT Competition_type, COUNT(Competition_type) FROM competition GROUP BY Competition_type ORDER BY COUNT(Competition_type)
### Instruction: CREATE TABLE club ( Club_ID int, name text, Region text, Start_year text ) CREATE TABLE player ( Player_ID int, name text, Position text, Club_ID int, Apps real, Tries real, Goals text, Points real ) CREATE TABLE competition_result ( Competition_ID ...
SELECT Country, COUNT(Country) FROM competition GROUP BY Competition_type, Country ORDER BY Country DESC
### Instruction: CREATE TABLE club ( club_id number, club_name text, region text, start_year number ) CREATE TABLE coach ( coach_id number, coach_name text, gender text, club_id number, rank number ) CREATE TABLE player ( player_id number, sponsor_name text, player_name...
SELECT residence FROM player WHERE gender = "M" INTERSECT SELECT residence FROM player WHERE gender = "F"
### Instruction: CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number 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), ...
SELECT Sex, MAX(Age) FROM Student GROUP BY Sex ORDER BY Sex DESC
### Instruction: CREATE TABLE table_202_294 ( id number, "year" number, "entrant" text, "chassis" text, "engine" text, "tyres" text, "drivers" text, "1" number, "2" number, "3" number, "4" number, "5" number, "6" number, "7" number, "8" number, "9" number,...
SELECT "year" FROM table_202_294 WHERE "chassis" = 'benetton b198'
### 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 Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Lives_in ( stui...
SELECT city_code, COUNT(*) FROM Student GROUP BY city_code ORDER BY COUNT(*) DESC
### Instruction: CREATE TABLE table_train_100 ( "id" int, "systolic_blood_pressure_sbp" int, "stroke" bool, "body_weight" float, "diastolic_blood_pressure_dbp" int, "rosen_modified_hachinski_ischemic_score" int, "body_mass_index_bmi" float, "age" float, "NOUSE" float ) -- Using val...
SELECT * FROM table_train_100 WHERE (systolic_blood_pressure_sbp < 90 OR systolic_blood_pressure_sbp > 160) OR (diastolic_blood_pressure_dbp > 100 OR diastolic_blood_pressure_dbp < 60)
### Instruction: CREATE TABLE dorm ( dormid number, dorm_name text, student_capacity number, gender text ) CREATE TABLE has_amenity ( dormid number, amenid number ) CREATE TABLE lives_in ( stuid number, dormid number, room_number number ) CREATE TABLE dorm_amenity ( amenid num...
SELECT AVG(T1.age), T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name
### 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, AVG(ID) FROM swimmer GROUP BY Nationality ORDER BY AVG(ID)
### Instruction: CREATE TABLE dorm ( dormid number, dorm_name text, student_capacity number, gender text ) CREATE TABLE has_amenity ( dormid number, amenid number ) CREATE TABLE dorm_amenity ( amenid number, amenity_name text ) CREATE TABLE lives_in ( stuid number, dormid numb...
SELECT COUNT(*), T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.age > 20 GROUP BY T3.dorm_name
### 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
### Instruction: CREATE TABLE competition ( Competition_ID int, Year real, Competition_type text, Country text ) CREATE TABLE competition_result ( Competition_ID int, Club_ID_1 int, Club_ID_2 int, Score text ) CREATE TABLE club_rank ( Rank real, Club_ID int, Gold real, ...
SELECT Country, COUNT(Country) FROM competition GROUP BY Competition_type, Country ORDER BY COUNT(Country)
### Instruction: CREATE TABLE restaurant ( id int, name varchar, food_type varchar, city_name varchar, rating "decimal ) CREATE TABLE geographic ( city_name varchar, county varchar, region varchar ) CREATE TABLE location ( restaurant_id int, house_number int, street_name va...
SELECT location.house_number, restaurant.name FROM location, restaurant WHERE location.city_name = 'san francisco' AND restaurant.food_type = 'french' AND restaurant.id = location.restaurant_id AND restaurant.rating = (SELECT MAX(RESTAURANTalias1.rating) FROM location AS LOCATIONalias1, restaurant AS RESTAURANTalias1 W...
### Instruction: CREATE TABLE sampledata15 ( sample_pk number, state text, year text, month text, day text, site text, commod text, source_id text, variety text, origin text, country text, disttype text, commtype text, claim text, quantity number, growst t...
SELECT country FROM sampledata15 WHERE sample_pk = 6480 AND origin = 2
### Instruction: CREATE TABLE table_52137 ( "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 Quad" text, "U15 2nd Quad" text, "U15 3rd Quad" text, "U15 4th Quad" text, "U...
SELECT "U15 1st Quad" FROM table_52137 WHERE "Open 3rd VIII" = 'bbc' AND "U16 3rd VIII" = 'bbc'
### Instruction: CREATE TABLE table_18867 ( "District" text, "2010 Population (000)" real, "2008 GDP (USD bn) a" text, "2008 GDP per capita (USD) a" real, "Agri culture b" text, "Mining b" text, "Manufac turing b" text, "Services & cons truction b" text, "Exports (USD mn) 2011" real,...
SELECT "Income poverty f" FROM table_18867 WHERE "Exports (USD mn) 2011" = '2470'
### Instruction: CREATE TABLE genre ( g_name text, rating text, most_popular_in text ) CREATE TABLE artist ( artist_name text, country text, gender text, preferred_genre text ) CREATE TABLE files ( f_id number, artist_name text, file_size text, duration text, formats te...
SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.resolution > 900 GROUP BY T2.artist_name HAVING COUNT(*) >= 1
### Instruction: CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), AllergyType VARCHAR(20) ) 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 (...
SELECT AllergyType, COUNT(AllergyType) 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 AllergyType ORDER BY AllergyType DESC
### Instruction: CREATE TABLE table_203_117 ( id number, "region/country" text, "1882-\n1918" number, "1919-\n1948" number, "1948-\n1951" number, "1952-\n1960" number, "1961-\n1971" number, "1972-\n1979" number, "1980-\n1989" number, "1990-\n2001" number, "2002-\n2010" number...
SELECT "1972-\n1979" FROM table_203_117 WHERE "region/country" = 'cuba'
### Instruction: CREATE TABLE sampledata15 ( sample_pk number, state text, year text, month text, day text, site text, commod text, source_id text, variety text, origin text, country text, disttype text, commtype text, claim text, quantity number, growst t...
SELECT commod FROM resultsdata15 WHERE mean = "A" GROUP BY commod ORDER BY COUNT(*) DESC LIMIT 1
### Instruction: CREATE TABLE competition ( Competition_ID int, Year real, Competition_type text, Country text ) CREATE TABLE player ( Player_ID int, name text, Position text, Club_ID int, Apps real, Tries real, Goals text, Points real ) CREATE TABLE club ( Club_ID ...
SELECT Position, COUNT(Position) FROM player GROUP BY Position HAVING AVG(Points) >= 20
### 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_300, meter_100 FROM swimmer ORDER BY meter_300
### Instruction: CREATE TABLE city ( City_ID int, Official_Name text, Status text, Area_km_2 real, Population real, Census_Ranking text ) CREATE TABLE farm ( Farm_ID int, Year int, Total_Horses real, Working_Horses real, Total_Cattle real, Oxen real, Bulls real, ...
SELECT Status, AVG(Population) FROM city GROUP BY Status ORDER BY AVG(Population) DESC
### Instruction: CREATE TABLE songs ( songid number, title text ) CREATE TABLE albums ( aid number, title text, year number, label text, type text ) CREATE TABLE band ( id number, firstname text, lastname text ) CREATE TABLE instruments ( songid number, bandmateid numb...
SELECT T2.firstname, T2.lastname FROM performance AS T1 JOIN band AS T2 ON T1.bandmate = T2.id JOIN songs AS T3 ON T3.songid = T1.songid WHERE T3.title = "Badlands"
### Instruction: CREATE TABLE enrollments ( campus number, year number, totalenrollment_ay number, fte_ay number ) CREATE TABLE campuses ( id number, campus text, location text, county text, year number ) CREATE TABLE discipline_enrollments ( campus number, discipline numbe...
SELECT faculty FROM faculty 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 club ( Club_ID int, Club_name text, Region text, Start_year int ) 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 ...
SELECT Occupation, COUNT(*) FROM player GROUP BY Occupation
### Instruction: CREATE TABLE table_48271 ( "Government" text, "Federal excise tax ( CAD\u00a2 / L )" real, "Total excise tax (CAD\u00a2/L)" real, "Minimum tax incl. sales taxes (CAD\u00a2/L)" real, "Min. tax (CAD\u00a2/US gal)" real ) -- Using valid SQLite, answer the following questions for the ...
SELECT AVG("Federal excise tax ( CAD\u00a2 / L )") FROM table_48271 WHERE "Total excise tax (CAD\u00a2/L)" > '33.2' AND "Government" = 'vancouver, bc' AND "Minimum tax incl. sales taxes (CAD\u00a2/L)" < '41.01'
### Instruction: CREATE TABLE school ( School_ID int, School text, Location text, Enrollment real, Founded real, Denomination text, Boys_or_Girls text, Day_or_Boarding text, Year_Entered_Competition real, School_Colors text ) CREATE TABLE player ( Player_ID int, Player t...
SELECT Denomination, COUNT(*) FROM school GROUP BY Denomination ORDER BY Denomination DESC
### Instruction: 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_ID_2 int, Score text ) CREATE TABLE player ( Player_ID int, name text, Posit...
SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC
### Instruction: CREATE TABLE table_80373 ( "2002/ 03" text, "2004/ 05" text, "2006/ 07" text, "2007/ 08" text, "2008/ 09" text, "2009/ 10" text, "2010/ 11" text, "2011/ 12" text, "2012/ 13" text ) -- Using valid SQLite, answer the following questions for the tables provided above....
SELECT "2006/ 07" FROM table_80373 WHERE "2011/ 12" = 'lq' AND "2010/ 11" = 'lq' AND "2002/ 03" = 'lq'
### Instruction: CREATE TABLE ref_transaction_types ( transaction_type_code text, transaction_type_description text ) CREATE TABLE investors ( investor_id number, investor_details text ) CREATE TABLE sales ( sales_transaction_id number, sales_details text ) CREATE TABLE purchases ( purcha...
SELECT transaction_type_code, AVG(amount_of_transaction) FROM transactions GROUP BY transaction_type_code
### 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_300, meter_100 FROM swimmer ORDER BY meter_100
### 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 Nationality, AVG(ID) FROM swimmer GROUP BY Nationality ORDER BY AVG(ID) DESC
### Instruction: CREATE TABLE Activity ( actid INTEGER, activity_name varchar(25) ) 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(*) FROM Faculty GROUP BY Rank
### Instruction: CREATE TABLE table_22858 ( "Model" text, "Year" text, "Code name" text, "Fab ( nm )" real, "Bus interface" text, "Transistor count (Millions)" real, "Memory max ( MiB )" text, "Core ( MHz )" real, "Memory ( MHz )" text, "Type" text, "Bus Width ( Bit )" real, ...
SELECT "DirectX" FROM table_22858 WHERE "Code name" = 'RV770 PRO' AND "Core ( MHz )" > '650.0'
### Instruction: CREATE TABLE Activity ( actid INTEGER, activity_name varchar(25) ) CREATE TABLE Faculty_Participates_in ( FacID INTEGER, actid INTEGER ) CREATE TABLE Participates_in ( stuid INTEGER, actid INTEGER ) CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VA...
SELECT Rank, COUNT(Rank) FROM Faculty GROUP BY Rank
### Instruction: CREATE TABLE documents_with_expenses ( document_id number, budget_type_code text, document_details text ) CREATE TABLE documents ( document_id number, document_type_code text, project_id number, document_date time, document_name text, document_description text, ...
SELECT statement_id, statement_details FROM statements
### Instruction: CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) 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 t...
SELECT Nationality, AVG(ID) FROM swimmer GROUP BY Nationality ORDER BY Nationality
### Instruction: 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_ID_2 int, Score text ) CREATE TABLE club ( Club_ID int, name text, Region te...
SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type ORDER BY Competition_type
### Instruction: CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CR...
SELECT meter_700, meter_100 FROM swimmer ORDER BY meter_700 DESC
### 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 Nationality, SUM(meter_100) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC
### 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 Nationality, SUM(ID) FROM swimmer GROUP BY Nationality ORDER BY SUM(ID) DESC
### Instruction: CREATE TABLE player ( player_id number, name text, position text, club_id number, apps number, tries number, goals text, points number ) CREATE TABLE club ( club_id number, name text, region text, start_year text ) CREATE TABLE competition ( competi...
SELECT AVG(T2.points) FROM club AS T1 JOIN player AS T2 ON T1.club_id = T2.club_id WHERE T1.name = "AIB"
### Instruction: 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 ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CR...
SELECT Nationality, COUNT(Nationality) FROM swimmer GROUP BY Nationality ORDER BY COUNT(Nationality)
### Instruction: 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, meter_200 text, meter_300 text, meter_400 text, meter_500 text, me...
SELECT Nationality, SUM(ID) FROM swimmer GROUP BY Nationality ORDER BY SUM(ID)
### Instruction: CREATE TABLE competition ( Competition_ID int, Year real, Competition_type text, Country text ) CREATE TABLE competition_result ( Competition_ID int, Club_ID_1 int, Club_ID_2 int, Score text ) CREATE TABLE club_rank ( Rank real, Club_ID int, Gold real, ...
SELECT Country, COUNT(Country) FROM competition GROUP BY Competition_type, Country ORDER BY COUNT(Country)
### Instruction: 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 ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 r...
SELECT Nationality, COUNT(Nationality) FROM swimmer GROUP BY Nationality ORDER BY Nationality
### 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_400, meter_100 FROM swimmer ORDER BY meter_100 DESC
### Instruction: CREATE TABLE Activity ( actid INTEGER, activity_name varchar(25) ) 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, ...
SELECT Sex, COUNT(*) FROM Faculty GROUP BY Sex
### Instruction: CREATE TABLE lots ( lot_id number, investor_id number, lot_details text ) CREATE TABLE transactions ( transaction_id number, investor_id number, transaction_type_code text, date_of_transaction time, amount_of_transaction number, share_count text, other_details t...
SELECT transaction_type_description FROM ref_transaction_types WHERE transaction_type_code = "PUR"
### 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 stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CR...
SELECT Nationality, AVG(ID) FROM swimmer GROUP BY Nationality ORDER BY AVG(ID) DESC
### Instruction: CREATE TABLE discipline_enrollments ( campus number, discipline number, year number, undergraduate number, graduate number ) CREATE TABLE enrollments ( campus number, year number, totalenrollment_ay number, fte_ay number ) CREATE TABLE faculty ( campus number, ...
SELECT degrees FROM campuses AS T1 JOIN degrees AS T2 ON t1.id = t2.campus WHERE t1.campus = "San Jose State University" AND t2.year = 2000
### 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 meter_400, meter_100 FROM swimmer ORDER BY meter_100
### Instruction: CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE univ...
SELECT Affiliation, SUM(Enrollment) FROM university WHERE Founded > 1850 GROUP BY Affiliation ORDER BY SUM(Enrollment) DESC
### Instruction: CREATE TABLE resultsdata15 ( sample_pk number, commod text, commtype text, lab text, pestcode text, testclass text, concen number, lod number, conunit text, confmethod text, confmethod2 text, annotate text, quantitate text, mean text, extract ...
SELECT growst FROM sampledata15 WHERE commod = "AP" GROUP BY growst ORDER BY COUNT(*) DESC LIMIT 1
### Instruction: CREATE TABLE district ( district_id number, district_name text, headquartered_city text, city_population number, city_area number ) CREATE TABLE store_district ( store_id number, district_id number ) CREATE TABLE store ( store_id number, store_name text, type t...
SELECT product FROM product WHERE max_page_size = "A4" OR pages_per_minute_color < 5
### Instruction: CREATE TABLE ref_budget_codes ( budget_type_code text, budget_type_description text ) CREATE TABLE ref_document_types ( document_type_code text, document_type_name text, document_type_description text ) CREATE TABLE statements ( statement_id number, statement_details text ...
SELECT COUNT(*) FROM documents_with_expenses
### 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 meter_400, meter_100 FROM swimmer ORDER BY meter_400 DESC
### Instruction: 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 grapes ( ID INTEGER, Grape TEXT, Color 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
### Instruction: 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, meter_200 text, meter_300 text, meter_400 text, meter_500 text, me...
SELECT meter_200, AVG(ID) FROM swimmer GROUP BY meter_200 ORDER BY AVG(ID) DESC
### 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_600, meter_100 FROM swimmer ORDER BY meter_600
### 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 Nationality, AVG(ID) FROM swimmer GROUP BY Nationality ORDER BY Nationality
### Instruction: CREATE TABLE transactions ( transaction_id number, investor_id number, transaction_type_code text, date_of_transaction time, amount_of_transaction number, share_count text, other_details text ) CREATE TABLE lots ( lot_id number, investor_id number, lot_details t...
SELECT investor_id, AVG(amount_of_transaction) FROM transactions GROUP BY investor_id
### Instruction: CREATE TABLE table_203_117 ( id number, "region/country" text, "1882-\n1918" number, "1919-\n1948" number, "1948-\n1951" number, "1952-\n1960" number, "1961-\n1971" number, "1972-\n1979" number, "1980-\n1989" number, "1990-\n2001" number, "2002-\n2010" number...
SELECT "1990-\n2001" FROM table_203_117 WHERE "region/country" = 'total'
### Instruction: CREATE TABLE party ( Party_ID int, Year real, Party text, Governor text, Lieutenant_Governor text, Comptroller text, Attorney_General text, US_Senate text ) CREATE TABLE county ( County_Id int, County_name text, Population real, Zip_code text ) CREATE T...
SELECT Comptroller, COUNT(Comptroller) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2 GROUP BY Comptroller ORDER BY Comptroller DESC
### Instruction: CREATE TABLE ref_budget_codes ( budget_type_code text, budget_type_description text ) CREATE TABLE statements ( statement_id number, statement_details text ) CREATE TABLE accounts ( account_id number, statement_id number, account_details text ) CREATE TABLE documents_with...
SELECT document_id, document_name FROM documents
### 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(ID) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC
### Instruction: CREATE TABLE settlements ( settlement_id number, claim_id number, effective_date time, settlement_amount number ) CREATE TABLE available_policies ( policy_id number, policy_type_code text, customer_phone text ) CREATE TABLE customers ( customer_id number, customer_...
SELECT MAX(settlement_amount), MIN(settlement_amount) FROM settlements
### Instruction: CREATE TABLE transactions ( transaction_id number, investor_id number, transaction_type_code text, date_of_transaction time, amount_of_transaction number, share_count text, other_details text ) CREATE TABLE sales ( sales_transaction_id number, sales_details text ) ...
SELECT transaction_type_code FROM transactions GROUP BY transaction_type_code ORDER BY COUNT(*) LIMIT 1
### Instruction: CREATE TABLE degrees ( year number, campus number, degrees number ) CREATE TABLE csu_fees ( campus number, year number, campusfee number ) CREATE TABLE enrollments ( campus number, year number, totalenrollment_ay number, fte_ay number ) CREATE TABLE faculty ( ...
SELECT T1.campus FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2003 ORDER BY T2.faculty DESC LIMIT 1
### Instruction: CREATE TABLE manager ( Manager_ID int, Name text, Country text, Working_year_starts text, Age int, Level int ) CREATE TABLE railway ( Railway_ID int, Railway text, Builder text, Built text, Wheels text, Location text, ObjectNumber text ) CREATE TABL...
SELECT T1.Location, T1.Railway_ID FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID ORDER BY T1.Railway_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 record ( ID int, Result text, Swimmer_ID int, ...
SELECT meter_600, meter_100 FROM swimmer ORDER BY meter_100 DESC
### Instruction: CREATE TABLE degrees ( year number, campus number, degrees number ) CREATE TABLE discipline_enrollments ( campus number, discipline number, year number, undergraduate number, graduate number ) CREATE TABLE faculty ( campus number, year number, faculty numbe...
SELECT degrees FROM campuses AS T1 JOIN degrees AS T2 ON t1.id = t2.campus WHERE t1.campus = "San Francisco State University" AND t2.year = 2001
### Instruction: CREATE TABLE table_test_4 ( "id" int, "ejection_fraction_ef" int, "systolic_blood_pressure_sbp" int, "active_infection" bool, "heart_disease" bool, "renal_disease" bool, "estimated_glomerular_filtration_rate_egfr" int, "cardiogenic_shock" bool, "diastolic_blood_press...
SELECT * FROM table_test_4 WHERE severe_left_ventricular_dysfunction = 1 AND ejection_fraction_ef < 20
### Instruction: CREATE TABLE vocals ( songid number, bandmate number, type text ) CREATE TABLE band ( id number, firstname text, lastname text ) CREATE TABLE instruments ( songid number, bandmateid number, instrument text ) CREATE TABLE songs ( songid number, title text )...
SELECT T3.title FROM performance AS T1 JOIN band AS T2 ON T1.bandmate = T2.id JOIN songs AS T3 ON T3.songid = T1.songid WHERE T2.firstname = "Marianne"
### Instruction: CREATE TABLE customer ( cust_ID varchar(3), cust_name varchar(20), acc_type char(1), acc_bal int, no_of_loans int, credit_score int, branch_ID int, state varchar(20) ) CREATE TABLE bank ( branch_ID int, bname varchar(20), no_of_customers int, city varcha...
SELECT bname, SUM(amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_ID = T2.branch_ID GROUP BY T1.bname ORDER BY bname DESC
### Instruction: CREATE TABLE party ( Party_ID int, Year real, Party text, Governor text, Lieutenant_Governor text, Comptroller text, Attorney_General text, US_Senate text ) CREATE TABLE election ( Election_ID int, Counties_Represented text, District int, Delegate text, ...
SELECT Comptroller, COUNT(Comptroller) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2 GROUP BY Comptroller ORDER BY Comptroller
### Instruction: CREATE TABLE bank ( branch_ID int, bname varchar(20), no_of_customers int, city varchar(10), state varchar(20) ) CREATE TABLE loan ( loan_ID varchar(3), loan_type varchar(15), cust_ID varchar(3), branch_ID varchar(3), amount int ) CREATE TABLE customer ( cu...
SELECT acc_type, AVG(acc_bal) FROM customer WHERE credit_score < 50 GROUP BY acc_type ORDER BY AVG(acc_bal) DESC
### Instruction: CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE univ...
SELECT Affiliation, SUM(Enrollment) FROM university WHERE Founded > 1850 GROUP BY Affiliation ORDER BY SUM(Enrollment) DESC
### Instruction: CREATE TABLE accounts ( account_id number, statement_id number, account_details text ) CREATE TABLE ref_document_types ( document_type_code text, document_type_name text, document_type_description text ) CREATE TABLE documents ( document_id number, document_type_code t...
SELECT project_id, project_details FROM projects
### Instruction: CREATE TABLE happy_hour ( HH_ID int, Shop_ID int, Month text, Num_of_shaff_in_charge int ) CREATE TABLE shop ( Shop_ID int, Address text, Num_of_staff text, Score real, Open_Year text ) CREATE TABLE happy_hour_member ( HH_ID int, Member_ID int, Total_am...
SELECT Address, Num_of_staff FROM shop WHERE NOT Shop_ID IN (SELECT Shop_ID FROM happy_hour) ORDER BY Num_of_staff
### Instruction: CREATE TABLE district ( district_id number, district_name text, headquartered_city text, city_population number, city_area number ) CREATE TABLE store_district ( store_id number, district_id number ) CREATE TABLE store_product ( store_id number, product_id number )...
SELECT product FROM product WHERE product <> (SELECT max_page_size FROM product GROUP BY max_page_size ORDER BY COUNT(*) DESC LIMIT 1)
### Instruction: CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) 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...
SELECT Sex, MAX(Age) FROM Student GROUP BY Sex ORDER BY MAX(Age)
### Instruction: CREATE TABLE table_20840 ( "C/W 15+" real, "Oblast\\Age" text, "15 to 17" real, "18 to 19" text, "20 to 24" real, "25 to 29" real, "30 to 34" real, "35 to 39" real, "40 to 44" real, "45 to 49" real, "50 to 54" real, "55 to 59" real, "60 to 64" real, ...
SELECT COUNT("25 to 29") FROM table_20840 WHERE "65 to 69" = '2073'
### Instruction: CREATE TABLE table_train_65 ( "id" int, "intention_to_arterial_catheter" bool, "steroid_therapy" bool, "intention_to_central_venous_catheter" bool, "central_venous_pressure_cvp" int, "receiving_vasopressor" bool, "pulmonary_artery_occlusive_pressure_paop" int, "septic_sh...
SELECT * FROM table_train_65 WHERE steroid_therapy = 1 AND septic_shock = 1
### Instruction: CREATE TABLE table_6690 ( "Average population (x 1000)" text, "Live births" text, "Deaths" text, "Natural change" text, "Crude birth rate (per 1000)" real, "Crude death rate (per 1000)" real, "Natural change (per 1000)" real ) -- Using valid SQLite, answer the following qu...
SELECT MAX("Crude death rate (per 1000)") FROM table_6690 WHERE "Natural change (per 1000)" < '-1' AND "Crude birth rate (per 1000)" < '10.5' AND "Deaths" = '102 400'
### 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 Lives_in ( st...
SELECT Sex, MAX(Age) FROM Student GROUP BY Sex ORDER BY Sex DESC
### Instruction: CREATE TABLE faculty_participates_in ( facid number, actid number ) CREATE TABLE activity ( actid number, activity_name text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code tex...
SELECT T1.fname, T1.lname FROM faculty AS T1 JOIN faculty_participates_in AS T2 ON T1.facid = T2.facid GROUP BY T1.facid ORDER BY COUNT(*) DESC LIMIT 1
### Instruction: CREATE TABLE sampledata15 ( sample_pk number, state text, year text, month text, day text, site text, commod text, source_id text, variety text, origin text, country text, disttype text, commtype text, claim text, quantity number, growst t...
SELECT distst FROM sampledata15 WHERE commod = "AP" GROUP BY distst ORDER BY COUNT(*) DESC LIMIT 1
### 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 COUNT(*), SUM(student_capacity) FROM Dorm GROUP BY gender
### Instruction: CREATE TABLE store ( store_id number, store_name text, type text, area_size number, number_of_product_category number, ranking number ) CREATE TABLE store_district ( store_id number, district_id number ) CREATE TABLE district ( district_id number, district_name...
SELECT district_name FROM district WHERE city_area > 10 OR city_population > 100000
### Instruction: CREATE TABLE product ( product_id number, product text, dimensions text, dpi number, pages_per_minute_color number, max_page_size text, interface text ) CREATE TABLE store ( store_id number, store_name text, type text, area_size number, number_of_product...
SELECT product FROM product WHERE max_page_size = "A4" AND pages_per_minute_color < 5
### Instruction: CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season ...
SELECT Affiliation, SUM(Enrollment) FROM university WHERE Founded > 1850 GROUP BY Affiliation ORDER BY Affiliation DESC