instruction
stringlengths
212
6.3k
output
stringlengths
6
2.03k
### Instruction: CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adults INTEGER, Kids INTEGER ) CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy I...
SELECT roomName, COUNT(roomName) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE FirstName LIKE '%ROY%' GROUP BY roomName ORDER BY COUNT(roomName)
### 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 All_Home, SUM(Team_ID) FROM basketball_match GROUP BY All_Home ORDER BY SUM(Team_ID)
### Instruction: CREATE TABLE table_test_6 ( "id" int, "scr" int, "anemia" bool, "blood_hemoglobin" int, "bleeding" int, "hemorrhagic_diseases" bool, "stroke" bool, "blood_platelet_counts" int, "trauma" bool, "renal_disease" bool, "hematocrit_hct" float, "hepatic_disease"...
SELECT * FROM table_test_6 WHERE blood_hemoglobin < 90
### Instruction: CREATE TABLE medicine ( id number, name text, trade_name text, fda_approved text ) CREATE TABLE medicine_enzyme_interaction ( enzyme_id number, medicine_id number, interaction_type text ) CREATE TABLE enzyme ( id number, name text, location text, product te...
SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole'
### Instruction: CREATE TABLE player ( player_id number, player text, years_played text, total_wl text, singles_wl text, doubles_wl text, team number ) CREATE TABLE team ( team_id number, name text ) CREATE TABLE match_season ( season number, player text, position text,...
SELECT T1.player, T1.years_played FROM player AS T1 JOIN team AS T2 ON T1.team = T2.team_id WHERE T2.name = "Columbus Crew"
### Instruction: CREATE TABLE table_3179 ( "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, "08...
SELECT "Name" FROM table_3179 WHERE "Country" = 'Georgia'
### 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 All_Home, School_ID FROM basketball_match GROUP BY ACC_Home, All_Home ORDER BY All_Home DESC
### Instruction: CREATE TABLE table_40815 ( "1935" text, "1936" text, "1937" text, "1938" text, "1939" text, "1940" text, "1941" text, "1943" text, "1945" text, "1946" text, "1947" text, "1948" text, "1949" text, "1950" text, "1951" text, "1952" text, ...
SELECT "1938" FROM table_40815 WHERE "1948" = 'n/a'
### Instruction: CREATE TABLE plays_games ( stuid number, gameid number, hours_played number ) CREATE TABLE sportsinfo ( stuid number, sportname text, hoursperweek number, gamesplayed number, onscholarship text ) CREATE TABLE student ( stuid number, lname text, fname text, ...
SELECT T2.lname, T2.fname FROM sportsinfo AS T1 JOIN student AS T2 ON T1.stuid = T2.stuid WHERE T1.sportname = "Football" OR T1.sportname = "Lacrosse"
### Instruction: CREATE TABLE table_20955 ( "Year" real, "Edmonton Hundred" real, "Elthorne Hundred" real, "Gore Hundred" real, "Isleworth Hundred" real, "Holborn Division" real, "Finsbury Division" real, "Kensington Division" real, "Tower Division" real, "Spelthorne Hundred" rea...
SELECT MIN("Without the Walls") FROM table_20955 WHERE "Within the Walls" > '56174.0'
### Instruction: CREATE TABLE train ( Train_ID int, Train_Num text, Name text, From text, Arrival text, Railway_ID int ) CREATE TABLE railway_manage ( Railway_ID int, Manager_ID int, From_Year text ) CREATE TABLE manager ( Manager_ID int, Name text, Country text, Wo...
SELECT Arrival, COUNT(Arrival) FROM train GROUP BY Arrival ORDER BY COUNT(Arrival) DESC
### 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 cust_name, acc_bal FROM customer WHERE cust_name LIKE '%a%' ORDER BY cust_name
### 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 All_Home, SUM(Team_ID) FROM basketball_match GROUP BY All_Home ORDER BY All_Home DESC
### 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 All_Home, Team_ID FROM basketball_match GROUP BY ACC_Road, All_Home ORDER BY Team_ID DESC
### 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
### Instruction: CREATE TABLE table_56433 ( "Tournament" 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, "2002" text, "2003" text...
SELECT "Tournament" FROM table_56433 WHERE "2000" = '3r'
### 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 All_Home, Team_ID FROM basketball_match GROUP BY ACC_Road, All_Home ORDER BY All_Home
### 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 T2.Party, COUNT(T2.Party) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party ORDER BY COUNT(T2.Party)
### 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 Time, ID FROM swimmer ORDER BY ID DESC
### Instruction: CREATE TABLE airlines ( alid number, name text, iata text, icao text, callsign text, country text, active text ) CREATE TABLE airports ( apid number, name text, city text, country text, x number, y number, elevation number, iata text, ica...
SELECT rid FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country = 'United States') AND src_apid IN (SELECT apid FROM airports WHERE country = 'United States')
### 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 All_Home, AVG(Team_ID) FROM basketball_match GROUP BY All_Home ORDER BY All_Home DESC
### Instruction: CREATE TABLE competition_record ( competition_id number, farm_id number, rank number ) CREATE TABLE farm ( farm_id number, year number, total_horses number, working_horses number, total_cattle number, oxen number, bulls number, cows number, pigs number, ...
SELECT status, AVG(population) FROM city GROUP BY status
### 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 All_Home, School_ID FROM basketball_match GROUP BY ACC_Home, All_Home ORDER BY School_ID
### Instruction: CREATE TABLE files ( f_id number, artist_name text, file_size text, duration text, formats text ) CREATE TABLE artist ( artist_name text, country text, gender text, preferred_genre text ) CREATE TABLE song ( song_name text, artist_name text, country tex...
SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.gender = "Female" AND T2.languages = "bangla"
### 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
### 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 All_Home, Team_ID FROM basketball_match GROUP BY ACC_Road, All_Home ORDER BY Team_ID
### Instruction: CREATE TABLE table_train_172 ( "id" int, "systolic_blood_pressure_sbp" int, "c_peptide_level" float, "hemoglobin_a1c_hba1c" float, "peak_stimulated_c_peptide" float, "diastolic_blood_pressure_dbp" int, "mixed_meal_tolerance_test_mmtt" bool, "vitamin_d" int, "NOUSE" f...
SELECT * FROM table_train_172 WHERE peak_stimulated_c_peptide > 0.2 AND mixed_meal_tolerance_test_mmtt = 1
### 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 All_Home, COUNT(All_Home) FROM basketball_match GROUP BY All_Home ORDER BY All_Home DESC
### Instruction: CREATE TABLE table_59918 ( "7:00 am" text, "7:30 am" text, "8:00 am" text, "9: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, "4:00 pm" text, "5:00 pm" tex...
SELECT "8:00 am" FROM table_59918 WHERE "2:00 pm" = 'another world'
### Instruction: CREATE TABLE table_59915 ( "7:00 am" text, "7:30 am" text, "8:00 am" text, "9: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, "4:00 pm" text, "5:00 pm" tex...
SELECT "4:00 pm" FROM table_59915 WHERE "1:00 pm" = 'all my children'
### Instruction: CREATE TABLE weekly_weather ( station_id int, day_of_week text, high_temperature int, low_temperature int, precipitation real, wind_speed_mph int ) CREATE TABLE station ( id int, network_name text, services text, local_authority text ) CREATE TABLE route ( ...
SELECT local_authority, id FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id ORDER BY local_authority
### Instruction: CREATE TABLE table_12684 ( "Season" text, "GP/MP" text, "Kills" real, "K/Game" real, "Errors" real, "Total Attempts" real, "Percentage" real, "Assists" real, "Service Aces" real, "Digs" real, "Solo Blocks" real, "Block Assists" real, "Total Blocks" re...
SELECT SUM("Solo Blocks") FROM table_12684 WHERE "Errors" > '126' AND "Kills" > '551' AND "Season" = '2007' AND "Assists" > '40'
### Instruction: CREATE TABLE bank ( branch_ID int, bname varchar(20), no_of_customers int, city varchar(10), state varchar(20) ) 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_I...
SELECT cust_name, acc_bal FROM customer WHERE cust_name LIKE '%a%' ORDER BY acc_bal DESC
### Instruction: CREATE TABLE schedule ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) CREATE TABLE cinema ( Cinema_ID int, Name text, Openning_year int, Capacity int, Location text ) CREATE TABLE film ( Film_ID int, Rank_in_series int, ...
SELECT Name, Price FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID JOIN cinema AS T3 ON T1.Cinema_ID = T3.Cinema_ID GROUP BY Title, Name ORDER BY Name DESC
### Instruction: CREATE TABLE table_203_516 ( id number, "year" text, "team" text, "games" number, "punt return attempts" number, "punt return yards" number, "punts returned for touchdown" number, "punts fair caught" number, "longest punt return" number, "kickoff attempts" number...
SELECT AVG("games") FROM table_203_516 WHERE "year" IN (2011, 2012)
### Instruction: CREATE TABLE movie ( movie_id int, Title text, Year int, Director text, Budget_million real, Gross_worldwide int ) CREATE TABLE book_club ( book_club_id int, Year int, Author_or_Editor text, Book_Title text, Publisher text, Category text, Result text...
SELECT Director, COUNT(Director) FROM movie WHERE Year = 1999 OR Year = 2000 GROUP BY Director ORDER BY Director
### Instruction: CREATE TABLE loan ( loan_ID varchar(3), loan_type varchar(15), cust_ID varchar(3), branch_ID varchar(3), amount int ) 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, bra...
SELECT cust_name, acc_bal FROM customer WHERE cust_name LIKE '%a%' ORDER BY cust_name
### 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 All_Home, School_ID FROM basketball_match GROUP BY ACC_Road, All_Home ORDER BY School_ID
### Instruction: CREATE TABLE table_3449 ( "Country" text, "Population in 2011 (In thousands)" real, "GDP (nominal) in 2011 ( USD millions)" real, "GDP (nominal) per capita" real, "GDP (PPP) in 2011 ( USD millions)" real, "GDP (PPP) per capita" real, "Merchandise exports ($ billions), 2011" ...
SELECT MIN("GDP (PPP) per capita") FROM table_3449
### 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 Winery, COUNT(Winery) FROM wine WHERE Price > 100 GROUP BY Winery ORDER BY COUNT(Winery)
### 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 building ( building_id text, Name text, Stree...
SELECT Type, COUNT(*) FROM Institution GROUP BY Type ORDER BY COUNT(*)
### 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 ACC_Regular_Season, All_Games_Percent FROM basketball_match ORDER BY ACC_Regular_Season 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 County_name, COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District GROUP BY T1.County_Id ORDER BY COUNT(*)
### Instruction: CREATE TABLE table_20553 ( "Vehicle" text, "EPA rated All-electric range" text, "EPA rated combined fuel economy" text, "Alaska ( Juneau )" text, "California (San Francisco)" text, "Mid-Atlantic South (Washington, D.C.)" text, "U.S. national average electric mix" text, "...
SELECT "U.S. national average electric mix" FROM table_20553 WHERE "Midwest (Des Moines)" = '280 g/mi (174 g/km)'
### Instruction: CREATE TABLE table_51138 ( "2004/ 05" text, "2007/ 08" text, "2010/ 11" text, "2011/ 12" text, "2012/ 13" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What shows for 2004/ 05 when 2007/ 08 shows not held, 2012/ 13 is A, 2011/ 12 o...
SELECT "2004/ 05" FROM table_51138 WHERE "2007/ 08" = 'not held' AND "2012/ 13" = 'a' AND "2011/ 12" = 'a' AND "2010/ 11" = 'not held'
### 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 All_Home, Team_ID FROM basketball_match GROUP BY ACC_Home, All_Home ORDER BY All_Home DESC
### Instruction: CREATE TABLE train ( Train_ID int, Train_Num text, Name text, From text, Arrival text, Railway_ID int ) CREATE TABLE manager ( Manager_ID int, Name text, Country text, Working_year_starts text, Age int, Level int ) CREATE TABLE railway_manage ( Rail...
SELECT Country, COUNT(Country) FROM manager WHERE Age > 50 OR Age < 46 GROUP BY Country ORDER BY Country DESC
### Instruction: CREATE TABLE routes ( rid number, dst_apid number, dst_ap text, src_apid number, src_ap text, alid number, airline text, codeshare text ) CREATE TABLE airlines ( alid number, name text, iata text, icao text, callsign text, country text, activ...
SELECT T1.country, T1.name, COUNT(*) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.country, T1.name
### 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 pulmonary_artery_occlusive_pressure_paop < 12 OR central_venous_pressure_cvp < 8
### Instruction: CREATE TABLE table_train_179 ( "id" int, "systolic_blood_pressure_sbp" int, "fasting_plasma_glucose_fpg" float, "diastolic_blood_pressure_dbp" int, "diabetes" bool, "body_mass_index_bmi" float, "triglyceride_tg" float, "hypertension" bool, "age" float, "NOUSE" fl...
SELECT * FROM table_train_179 WHERE fasting_plasma_glucose_fpg > 100 AND fasting_plasma_glucose_fpg < 126
### 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 All_Home, School_ID FROM basketball_match GROUP BY ACC_Road, All_Home ORDER BY All_Home
### Instruction: CREATE TABLE loan ( loan_ID varchar(3), loan_type varchar(15), cust_ID varchar(3), branch_ID varchar(3), amount int ) 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, bra...
SELECT cust_name, credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_ID = T2.cust_ID
### 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 ACC_Road, AVG(Team_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY AVG(Team_ID) DESC
### 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 Time, ID FROM swimmer ORDER BY Time
### Instruction: CREATE TABLE table_12194 ( "Rank 2014" real, "Rank 2013" text, "2009\u201310" text, "2010\u201311" text, "2011\u201312" text, "2012\u201313" text, "2013\u201314" text, "Coeff." text, "Teams" text, "CL places" real, "EL places" real, "Total" real ) -- Us...
SELECT "2009\u201310" FROM table_12194 WHERE "Rank 2013" = '18'
### Instruction: CREATE TABLE repair_assignment ( technician_id number, repair_id number, machine_id number ) CREATE TABLE repair ( repair_id number, name text, launch_date text, notes text ) CREATE TABLE machine ( machine_id number, making_year number, class text, team tex...
SELECT T3.name, T2.machine_series FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_id = T3.technician_id
### Instruction: CREATE TABLE table_12192 ( "Rank 2014" real, "Rank 2013" text, "2009\u201310" text, "2010\u201311" text, "2011\u201312" text, "2012\u201313" text, "2013\u201314" text, "Coeff." text, "Teams" text, "CL places" real, "EL places" real, "Total" real ) -- Us...
SELECT MAX("EL places") FROM table_12192 WHERE "2010\u201311" = '15.666'
### Instruction: CREATE TABLE stadium ( id number, name text, capacity number, city text, country text, opening_year number ) CREATE TABLE event ( id number, name text, stadium_id number, year text ) CREATE TABLE swimmer ( id number, name text, nationality text, ...
SELECT name FROM stadium WHERE capacity < (SELECT AVG(capacity) FROM stadium)
### Instruction: CREATE TABLE competition ( competition_id number, year number, competition_type text, country text ) CREATE TABLE competition_result ( competition_id number, club_id_1 number, club_id_2 number, score text ) CREATE TABLE player ( player_id number, name text, ...
SELECT competition_type FROM competition GROUP BY competition_type HAVING COUNT(*) <= 5
### Instruction: CREATE TABLE Video_Games ( GameID INTEGER, GName VARCHAR(40), GType VARCHAR(40) ) CREATE TABLE SportsInfo ( StuID INTEGER, SportName VARCHAR(32), HoursPerWeek INTEGER, GamesPlayed INTEGER, OnScholarship VARCHAR(1) ) CREATE TABLE Student ( StuID INTEGER, LName V...
SELECT Major, MAX(Age) FROM Student GROUP BY Major
### 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 All_Home, School_ID FROM basketball_match GROUP BY ACC_Home, All_Home ORDER BY School_ID
### Instruction: CREATE TABLE medicine_enzyme_interaction ( enzyme_id number, medicine_id number, interaction_type text ) CREATE TABLE enzyme ( id number, name text, location text, product text, chromosome text, omim number, porphyria text ) CREATE TABLE medicine ( id numbe...
SELECT name, trade_name FROM medicine EXCEPT SELECT T1.name, T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id JOIN enzyme AS T3 ON T3.id = T2.enzyme_id WHERE T3.product = 'Protoporphyrinogen IX'
### Instruction: CREATE TABLE table_61207 ( "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 "5:00 pm" FROM table_61207 WHERE "7:00 am" = 'cbs this morning'
### Instruction: CREATE TABLE election ( Election_ID int, Counties_Represented text, District int, Delegate text, Party int, First_Elected real, Committee text ) CREATE TABLE party ( Party_ID int, Year real, Party text, Governor text, Lieutenant_Governor text, Comptr...
SELECT T2.Party, COUNT(T2.Party) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party ORDER BY T2.Party 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
### Instruction: CREATE TABLE table_51903 ( "Draw" real, "Artist" text, "Song" text, "Rank" real, "Points" real, "A. Krajka" real, "Gj. Leka" real, "B. Haxhia" real, "D. Tukiqi" real, "R. Magjistari" real, "Gj. Xhuvani" real, "A. Sk\u00ebnderaj" real ) -- Using valid SQ...
SELECT AVG("A. Krajka") FROM table_51903 WHERE "R. Magjistari" < '6' AND "D. Tukiqi" = '6' AND "Rank" < '5'
### Instruction: CREATE TABLE Voting_record ( StuID INTEGER, Registration_Date VARCHAR(12), Election_Cycle VARCHAR(12), President_Vote INTEGER, Vice_President_Vote INTEGER, Secretary_Vote INTEGER, Treasurer_Vote INTEGER, Class_President_Vote INTEGER, Class_Senator_Vote INTEGER ) CRE...
SELECT Registration_Date, COUNT(Registration_Date) FROM Voting_record
### 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 name, ID FROM swimmer ORDER BY ID
### Instruction: CREATE TABLE city ( City_ID int, City text, Hanzi text, Hanyu_Pinyin text, Regional_Population int, GDP real ) CREATE TABLE match ( Match_ID int, Date text, Venue text, Score text, Result text, Competition text ) CREATE TABLE temperature ( City_ID i...
SELECT Competition, COUNT(*) FROM match GROUP BY Competition ORDER BY COUNT(*)
### 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 ACC_Road, Team_ID FROM basketball_match GROUP BY All_Home, ACC_Road ORDER BY ACC_Road
### Instruction: CREATE TABLE table_12625 ( "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:30 pm" text, "4:00 pm" text, "5:00 pm" te...
SELECT "8:00 am" FROM table_12625 WHERE "3:30 pm" = 'general hospital'
### 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 T2.Party, AVG(COUNT(*)) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party ORDER BY T2.Party
### Instruction: CREATE TABLE table_train_268 ( "id" int, "basal_rate" float, "systolic_blood_pressure_sbp" int, "renal_disease" bool, "major_illness" bool, "creatinine_clearance_cl" float, "injury_to_body" bool, "diastolic_blood_pressure_dbp" int, "injury_to_limb" bool, "hyperte...
SELECT * FROM table_train_268 WHERE major_illness = 1 OR renal_disease = 1 OR creatinine_clearance_cl < 60
### Instruction: CREATE TABLE building ( building_id text, name text, street_address text, years_as_tallest text, height_feet number, floors number ) CREATE TABLE protein ( common_name text, protein_name text, divergence_from_human_lineage number, accession_number text, sequ...
SELECT name FROM building WHERE height_feet >= 200 AND floors >= 20
### Instruction: CREATE TABLE table_80372 ( "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 "2010/ 11" FROM table_80372 WHERE "2004/ 05" = 'not held' AND "2011/ 12" = 'non-ranking'
### 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
### 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 All_Home, AVG(Team_ID) FROM basketball_match GROUP BY All_Home ORDER BY All_Home
### Instruction: CREATE TABLE table_20954 ( "Year" real, "Edmonton Hundred" real, "Elthorne Hundred" real, "Gore Hundred" real, "Isleworth Hundred" real, "Holborn Division" real, "Finsbury Division" real, "Kensington Division" real, "Tower Division" real, "Spelthorne Hundred" rea...
SELECT "Inns of Court and Chancery" FROM table_20954 WHERE "Without the Walls" = '70489'
### Instruction: CREATE TABLE table_58801 ( "Song" text, "International Jury" text, "Lule\u00e5" text, "Ume\u00e5" text, "Sundsvall" text, "Falun" text, "Karlstad" text, "\u00d6rebro" text, "Norrk\u00f6ping" text, "G\u00f6teborg" text, "V\u00e4xj\u00f6" text, "Malm\u00f6"...
SELECT MAX("Total") FROM table_58801 WHERE "Norrk\u00f6ping" = '12'
### Instruction: CREATE TABLE schedule ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) CREATE TABLE cinema ( Cinema_ID int, Name text, Openning_year int, Capacity int, Location text ) CREATE TABLE film ( Film_ID int, Rank_in_series int, ...
SELECT Name, SUM(T1.Show_times_per_day) FROM schedule AS T1 JOIN cinema AS T2 ON T1.Cinema_ID = T2.Cinema_ID GROUP BY T1.Cinema_ID ORDER BY Name
### Instruction: CREATE TABLE people ( people_id number, age number, name text, nationality text, graduation_college text ) CREATE TABLE employment ( company_id number, people_id number, year_working number ) CREATE TABLE company ( company_id number, name text, headquarters...
SELECT T2.name FROM employment AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id JOIN company AS T3 ON T1.company_id = T3.company_id WHERE T3.sales_in_billion > 200
### Instruction: CREATE TABLE railway_manage ( Railway_ID int, Manager_ID int, From_Year text ) 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 te...
SELECT Country, COUNT(Country) FROM manager WHERE Age > 50 OR Age < 46 GROUP BY Country ORDER BY Country
### 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 name, ID FROM swimmer ORDER BY ID DESC
### 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 All_Home, School_ID FROM basketball_match GROUP BY ACC_Home, All_Home ORDER BY All_Home
### 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 ACC_Road, AVG(Team_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY AVG(Team_ID)
### 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 ACC_Road, COUNT(ACC_Road) FROM basketball_match GROUP BY ACC_Road
### Instruction: CREATE TABLE airports ( apid integer, name text, city text, country text, x real, y real, elevation bigint, iata character varchar(3), icao character varchar(4) ) CREATE TABLE routes ( rid integer, dst_apid integer, dst_ap varchar(4), src_apid bigint...
SELECT name, elevation FROM airports WHERE city = 'New York'
### Instruction: CREATE TABLE table_243 ( "Model" text, "Engine make/Capacity" text, "Power kW@rpm" text, "Torque Nm@rpm" text, "Transmission Make/Type/Speed" text, "GVM (kg) Technical Capacity" text, "GCM (kg) Technical Capacity" text ) -- Using valid SQLite, answer the following question...
SELECT "Torque Nm@rpm" FROM table_243 WHERE "GCM (kg) Technical Capacity" = '23000' AND "Engine make/Capacity" = 'MWM 6.10 TCA-EURO III (Turbo Intercooler)'
### 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 All_Home, Team_ID FROM basketball_match GROUP BY ACC_Home, All_Home ORDER BY Team_ID
### Instruction: CREATE TABLE table_38963 ( "Week 2 Sept 7" text, "Week 3 Sept 14" text, "Week 4 Sept 21" text, "Week 5 Sept 28" text, "Week 6 Oct 5" text, "Week 7 Oct 12" text, "Week 10 Nov 2" text, "Week 12 Nov 16" text, "Week 14 Nov 30" text, "Week 15 Dec 7" text, "Week 16...
SELECT "Week 14 Nov 30" FROM table_38963 WHERE "Week 10 Nov 2" = 'michigan state (8-2)'
### Instruction: CREATE TABLE schedule ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_season int, Title text, Directed_by text, Original_air_date text, Production_code text ) ...
SELECT Name, COUNT(Name) FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID JOIN cinema AS T3 ON T1.Cinema_ID = T3.Cinema_ID GROUP BY Name ORDER BY COUNT(Name) DESC
### Instruction: CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE faculty_participates_in ( facid number, actid number ) CREATE TABLE activity ( actid number, activity_name tex...
SELECT T2.stuid FROM faculty AS T1 JOIN student AS T2 ON T1.facid = T2.advisor WHERE T1.rank = "Professor"
### 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 acc_type, AVG(acc_bal) FROM customer WHERE credit_score < 50 GROUP BY acc_type
### 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 T2.Party, COUNT(T2.Party) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party ORDER BY T2.Party
### Instruction: CREATE TABLE table_27476 ( "Rank" real, "Rank w/o Hydropower" real, "State" text, "% Renewable" text, "% Renewable w/o Hydro" text, "Renewable electricity (GW\u00b7h)" real, "Renewable electricity w/o Hydro (GW\u00b7h)" real, "Total electricity (GW\u00b7h)" real ) -- U...
SELECT COUNT("Total electricity (GW\u00b7h)") FROM table_27476 WHERE "Renewable electricity w/o Hydro (GW\u00b7h)" = '3601'
### 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 ACC_Percent, All_Games_Percent FROM basketball_match GROUP BY ACC_Regular_Season
### Instruction: CREATE TABLE city ( city_id number, official_name text, status text, area_km_2 number, population number, census_ranking text ) CREATE TABLE competition_record ( competition_id number, farm_id number, rank number ) CREATE TABLE farm_competition ( competition_id...
SELECT total_horses FROM farm ORDER BY total_horses
### 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 ACC_Regular_Season, Team_ID FROM basketball_match ORDER BY ACC_Regular_Season
### Instruction: CREATE TABLE company ( company_id number, name text, headquarters text, industry text, sales_in_billion number, profits_in_billion number, assets_in_billion number, market_value_in_billion number ) CREATE TABLE employment ( company_id number, people_id number, ...
SELECT T3.name, T2.name FROM employment AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id JOIN company AS T3 ON T1.company_id = T3.company_id ORDER BY T1.year_working
### Instruction: CREATE TABLE table_47841 ( "Tournament" text, "1998" text, "1999" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text...
SELECT "2000" FROM table_47841 WHERE "2012" = '4r'