instruction
stringlengths
212
6.3k
output
stringlengths
6
2.03k
### Instruction: CREATE TABLE has_amenity ( dormid number, amenid number ) CREATE TABLE lives_in ( stuid number, dormid number, room_number number ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city...
SELECT student_capacity, gender FROM dorm WHERE dorm_name LIKE '%Donor%'
### Instruction: CREATE TABLE event ( Event_ID int, Date text, Venue text, Name text, Event_Attendance int ) CREATE TABLE news_report ( journalist_ID int, Event_ID int, Work_Type text ) CREATE TABLE journalist ( journalist_ID int, Name text, Nationality text, Age text, ...
SELECT T3.Name, COUNT(*) FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name ORDER BY T3.Name DESC
### Instruction: CREATE TABLE shop ( Shop_ID int, Address text, Num_of_staff text, Score real, Open_Year text ) CREATE TABLE happy_hour ( HH_ID int, Shop_ID int, Month text, Num_of_shaff_in_charge int ) CREATE TABLE member ( Member_ID int, Name text, Membership_card tex...
SELECT Address, COUNT(*) FROM member GROUP BY Address
### Instruction: CREATE TABLE table_7582 ( "1900s" real, "1920s" real, "1930s" real, "1940s" real, "1950s" real, "1960s" real, "1970s" real, "1980s" real, "1990s" real, "2000s to date" real, "Total to date" real ) -- Using valid SQLite, answer the following questions for th...
SELECT AVG("1990s") FROM table_7582 WHERE "Total to date" = '1' AND "1980s" < '0'
### Instruction: CREATE TABLE game ( stadium_id int, id int, Season int, Date text, Home_team text, Away_team text, Score text, Competition text ) CREATE TABLE stadium ( id int, name text, Home_Games int, Average_Attendance real, Total_Attendance real, Capacity_P...
SELECT Season, COUNT(Season) FROM game GROUP BY Home_team, Season ORDER BY Season
### 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
### Instruction: CREATE TABLE table_37734 ( "Tournament" 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 ) -- Using valid SQLite, answer...
SELECT "2010" FROM table_37734 WHERE "2001" = 'grand slam tournaments'
### Instruction: CREATE TABLE bank ( branch_id number, bname text, no_of_customers number, city text, state text ) CREATE TABLE loan ( loan_id text, loan_type text, cust_id text, branch_id text, amount number ) CREATE TABLE customer ( cust_id text, cust_name text, a...
SELECT SUM(amount), T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname
### 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 Year, MAX(Score) FROM wine GROUP BY Year ORDER BY Year 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 Grape, COUNT(*) FROM wine GROUP BY Grape ORDER BY Grape
### Instruction: CREATE TABLE aircraft ( aid number(9,0), name varchar2(30), distance number(6,0) ) CREATE TABLE flight ( flno number(4,0), origin varchar2(20), destination varchar2(20), distance number(6,0), departure_date date, arrival_date date, price number(7,2), aid num...
SELECT origin, COUNT(origin) FROM flight GROUP BY origin
### Instruction: CREATE TABLE Album ( Title VARCHAR, AlbumId VARCHAR ) CREATE TABLE Genre ( GenreID VARCHAR, Name VARCHAR ) CREATE TABLE Track ( AlbumId VARCHAR, GenreID VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the album titl...
SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Reggae' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Rock'
### Instruction: CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State ...
SELECT Year, MAX(Score) FROM wine GROUP BY Year ORDER BY Year
### Instruction: CREATE TABLE table_203_59 ( id number, "country" text, "2000" number, "2001" number, "2002" number, "2003" number, "2004" number, "2005" number, "2006" number, "2007" number, "2008" number, "2009" number, "2010" number, "2011" number ) -- Using ...
SELECT "2000" FROM table_203_59 WHERE "country" = 'world'
### Instruction: CREATE TABLE repair_assignment ( technician_id int, repair_ID int, Machine_ID int ) CREATE TABLE repair ( repair_ID int, name text, Launch_Date text, Notes text ) CREATE TABLE technician ( technician_id real, Name text, Team text, Starting_Year real, Ag...
SELECT Name, COUNT(Name) FROM technician WHERE Team <> "NYY" GROUP BY Name ORDER BY Name
### Instruction: CREATE TABLE problems ( problem_id VARCHAR, reported_by_staff_id VARCHAR ) CREATE TABLE staff ( staff_id VARCHAR, staff_first_name VARCHAR, staff_last_name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the ids of the p...
SELECT T1.problem_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE date_problem_reported < (SELECT MIN(date_problem_reported) FROM problems AS T3 JOIN staff AS T4 ON T3.reported_by_staff_id = T4.staff_id WHERE T4.staff_first_name = "Lysanne" AND T4.staff_last_name = "Turcotte")
### Instruction: CREATE TABLE table_8288 ( "Player" text, "PL Apps" real, "PL G" real, "CL Apps" real, "CL G" real, "FAC / LC Apps" real, "FAC / LC G" real, "Total Apps" real, "Total G" real, "FA YC" real, "UEFA YC" real ) -- Using valid SQLite, answer the following questio...
SELECT COUNT("PL G") FROM table_8288 WHERE "CL G" < '7' AND "CL Apps" < '7' AND "FA YC" = '0' AND "Player" = 'pennant'
### Instruction: CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following ...
SELECT Headquarter, COUNT(Headquarter) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY COUNT(Headquarter)
### Instruction: CREATE TABLE management ( department_ID int, head_ID int, temporary_acting text ) CREATE TABLE head ( head_ID int, name text, born_state text, age real ) CREATE TABLE department ( Department_ID int, Name text, Creation text, Ranking int, Budget_in_Billi...
SELECT Name, SUM(Num_Employees) FROM department AS T1 JOIN management AS T2 ON T1.department_ID = T2.department_ID WHERE T2.temporary_acting = 'Yes' GROUP BY Name ORDER BY Name
### Instruction: CREATE TABLE airports ( apid number, name text, city text, country text, x number, y number, elevation number, iata text, icao text ) CREATE TABLE airlines ( alid number, name text, iata text, icao text, callsign text, country text, activ...
SELECT name FROM airports WHERE elevation BETWEEN -50 AND 50
### Instruction: CREATE TABLE flight ( flno number, origin text, destination text, distance number, departure_date time, arrival_date time, price number, aid number ) CREATE TABLE certificate ( eid number, aid number ) CREATE TABLE employee ( eid number, name text, ...
SELECT T1.name FROM employee AS T1 JOIN certificate AS T2 ON T1.eid = T2.eid JOIN aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800"
### Instruction: CREATE TABLE table_204_940 ( id number, "year" number, "tournaments\nplayed" number, "cuts\nmade" number, "wins" number, "2nd" number, "3rd" number, "top 10s" number, "best\nfinish" text, "earnings\n(\u20ac)" number, "money\nlist rank" number, "scoring\na...
SELECT "year" FROM table_204_940 ORDER BY "2nd" DESC LIMIT 1
### 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(School_ID) FROM basketball_match GROUP BY All_Home
### Instruction: CREATE TABLE news_report ( journalist_ID int, Event_ID int, Work_Type text ) CREATE TABLE journalist ( journalist_ID int, Name text, Nationality text, Age text, Years_working int ) CREATE TABLE event ( Event_ID int, Date text, Venue text, Name text, ...
SELECT T3.Name, COUNT(*) FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name ORDER BY COUNT(*) DESC
### Instruction: CREATE TABLE table_44560 ( "Poll Source" text, "Dates administered" text, "Democrat: Carl Levin" text, "Republican: Jack Hoogendyk" text, "Lead Margin" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Dates Administered, when ...
SELECT "Dates administered" FROM table_44560 WHERE "Poll Source" = 'rasmussen reports' AND "Lead Margin" > '18' AND "Republican: Jack Hoogendyk" = '36%' AND "Democrat: Carl Levin" = '59%'
### 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 country FROM airlines WHERE active = 'Y' GROUP BY country ORDER BY COUNT(*) DESC LIMIT 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 Team_Name, All_Games_Percent FROM basketball_match
### Instruction: CREATE TABLE table_71058 ( "Year" real, "Population (Total)" real, "(Caboolture)" real, "(Pine Rivers)" real, "(Redcliffe)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average Caboolture population with a Redcliffe po...
SELECT AVG("(Caboolture)") FROM table_71058 WHERE "(Redcliffe)" > '27,327' AND "(Pine Rivers)" > '119,236' AND "Year" > '1971' AND "Population (Total)" > '344,878'
### 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 Year, AVG(MAX(Price)) FROM wine ORDER BY AVG(MAX(Price))
### Instruction: CREATE TABLE phone ( Name text, Phone_ID int, Memory_in_G int, Carrier text, Price real ) CREATE TABLE phone_market ( Market_ID int, Phone_ID text, Num_of_stock int ) CREATE TABLE market ( Market_ID int, District text, Num_of_employees int, Num_of_shops...
SELECT Name, COUNT(Name) FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID GROUP BY Name ORDER BY COUNT(Name)
### Instruction: CREATE TABLE finrev_fed_17 ( state_code number, idcensus number, school_district text, nces_id text, yr_data number, t_fed_rev number, c14 number, c25 number ) CREATE TABLE finrev_fed_key_17 ( state_code number, state text, #_records text ) CREATE TABLE nde...
SELECT SUM(c14) FROM finrev_fed_17 WHERE yr_data = 17
### 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 Year, MAX(Price) FROM wine GROUP BY Year ORDER BY Year
### Instruction: CREATE TABLE repair ( repair_ID int, name text, Launch_Date text, Notes text ) CREATE TABLE machine ( Machine_ID int, Making_Year int, Class text, Team text, Machine_series text, value_points real, quality_rank int ) CREATE TABLE technician ( technician...
SELECT Team, COUNT(*) FROM technician GROUP BY Team ORDER BY COUNT(*) 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 Team_Name, Team_ID FROM basketball_match ORDER BY Team_ID DESC
### Instruction: CREATE TABLE region ( region_id number, region_code text, region_name text ) CREATE TABLE storm ( storm_id number, name text, dates_active text, max_speed number, damage_millions_usd number, number_deaths number ) CREATE TABLE affected_region ( region_id number...
SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id ORDER BY T3.number_deaths DESC LIMIT 1
### 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_Neutral, ACC_Percent FROM basketball_match
### Instruction: CREATE TABLE film ( Film_ID int, Title text, Studio text, Director text, Gross_in_dollar int ) CREATE TABLE film_market_estimation ( Estimation_ID int, Low_Estimate real, High_Estimate real, Film_ID int, Type text, Market_ID int, Year int ) CREATE TABLE...
SELECT Title, COUNT(Title) FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID GROUP BY Title ORDER BY COUNT(Title) DESC
### Instruction: CREATE TABLE shop ( Shop_ID int, Shop_Name text, Location text, Open_Date text, Open_Year int ) CREATE TABLE device ( Device_ID int, Device text, Carrier text, Package_Version text, Applications text, Software_Platform text ) CREATE TABLE stock ( Shop_I...
SELECT Carrier, COUNT(Carrier) FROM stock AS T1 JOIN device AS T2 ON T1.Device_ID = T2.Device_ID JOIN shop AS T3 ON T1.Shop_ID = T3.Shop_ID GROUP BY Carrier ORDER BY COUNT(Carrier)
### 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 accreditation_type, COUNT(*) FROM phone GROUP BY accreditation_type
### Instruction: CREATE TABLE table_42101 ( "Ecozone" text, "Area (km\u00b2) Territorial waters" real, "Area (km\u00b2) Exclusive Economic Zone" real, "Percentage of total area (forEEZ)" real, "Percentage of marine area (forEEZ)" real ) -- Using valid SQLite, answer the following questions for the...
SELECT AVG("Percentage of total area (forEEZ)") FROM table_42101 WHERE "Percentage of marine area (forEEZ)" > '39.3' AND "Area (km\u00b2) Territorial waters" < '2,788,349'
### Instruction: CREATE TABLE member_of_club ( stuid number, clubid number, position text ) CREATE TABLE club ( clubid number, clubname text, clubdesc text, clublocation text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major ...
SELECT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.major = "600" GROUP BY t1.clubname ORDER BY COUNT(*) DESC LIMIT 1
### Instruction: CREATE TABLE table_train_106 ( "id" int, "gender" string, "pregnancy_or_lactation" bool, "mini_mental_state_examination_mmse" int, "uncontrolled_diabetes" bool, "blood_glucose" int, "rosen_modified_hachinski_ischemic_score" int, "body_mass_index_bmi" float, "age" flo...
SELECT * FROM table_train_106 WHERE uncontrolled_diabetes = 1 OR blood_glucose > 180
### 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 Year, COUNT(Year) FROM wine
### Instruction: CREATE TABLE artist ( Artist_ID int, Artist text, Age int, Famous_Title text, Famous_Release_date text ) CREATE TABLE music_festival ( ID int, Music_Festival text, Date_of_ceremony text, Category text, Volume int, Result text ) CREATE TABLE volume ( Vol...
SELECT Category, COUNT(Category) FROM music_festival WHERE Result = "Awarded" GROUP BY Category ORDER BY Category DESC
### Instruction: CREATE TABLE culture_company ( company_name text, type text, incorporated_in text, group_equity_shareholding number, book_club_id text, movie_id text ) CREATE TABLE movie ( movie_id number, title text, year number, director text, budget_million number, g...
SELECT book_title, author_or_editor FROM book_club WHERE year > 1989
### Instruction: CREATE TABLE faculty ( facid number, lname text, fname text, rank text, sex text, phone number, room text, building text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, ci...
SELECT building FROM faculty GROUP BY building ORDER BY COUNT(*) DESC LIMIT 1
### 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_Road, ACC_Percent FROM basketball_match
### Instruction: CREATE TABLE station ( id int, network_name text, services text, local_authority text ) CREATE TABLE train ( id int, train_number int, name text, origin text, destination text, time text, interval text ) CREATE TABLE route ( train_id int, station_id...
SELECT services, COUNT(services) FROM station GROUP BY services ORDER BY COUNT(services)
### Instruction: CREATE TABLE table_train_127 ( "id" int, "depression" bool, "mini_mental_state_examination_mmse" int, "back_pain" bool, "renal_disease" bool, "osteoarthritis" bool, "hamilton_depression_scale_hds" int, "liver_disease" bool, "painful_condition" bool, "other_chroni...
SELECT * FROM table_train_127 WHERE hamilton_depression_scale_hds >= 16
### Instruction: CREATE TABLE table_34165 ( "Tournament" text, "1990" text, "1991" text, "1992" text, "1993" text, "1994" text, "1995" text, "1996" text, "1997" text, "1998" text, "1999" text, "2000" text ) -- Using valid SQLite, answer the following questions for the t...
SELECT "1993" FROM table_34165 WHERE "1994" = '2r' AND "1995" = '1r'
### Instruction: CREATE TABLE news_report ( journalist_ID int, Event_ID int, Work_Type text ) CREATE TABLE event ( Event_ID int, Date text, Venue text, Name text, Event_Attendance int ) CREATE TABLE journalist ( journalist_ID int, Name text, Nationality text, Age text, ...
SELECT T3.Name, COUNT(*) FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name 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 grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE appe...
SELECT Grape, COUNT(*) FROM wine GROUP BY Grape ORDER BY Grape
### Instruction: CREATE TABLE volume ( Volume_ID int, Volume_Issue text, Issue_Date text, Weeks_on_Top real, Song text, Artist_ID int ) CREATE TABLE music_festival ( ID int, Music_Festival text, Date_of_ceremony text, Category text, Volume int, Result text ) CREATE TABL...
SELECT Result, COUNT(Result) FROM music_festival GROUP BY Result ORDER BY COUNT(Result)
### Instruction: CREATE TABLE people ( People_ID int, District text, Name text, Party text, Age int ) CREATE TABLE debate ( Debate_ID int, Date text, Venue text, Num_of_Audience int ) CREATE TABLE debate_people ( Debate_ID int, Affirmative int, Negative int, If_Affi...
SELECT Name, COUNT(Name) FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID GROUP BY Name ORDER BY Name DESC
### Instruction: CREATE TABLE faculty_participates_in ( facid number, actid number ) CREATE TABLE participates_in ( stuid number, actid number ) CREATE TABLE faculty ( facid number, lname text, fname text, rank text, sex text, phone number, room text, building text ) C...
SELECT facid FROM faculty EXCEPT SELECT advisor FROM student
### Instruction: CREATE TABLE city ( City_ID int, County_ID int, Name text, White real, Black real, Amerindian real, Asian real, Multiracial real, Hispanic real ) CREATE TABLE county_public_safety ( County_ID int, Name text, Population int, Police_officers int, R...
SELECT White, Crime_rate FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID
### Instruction: CREATE TABLE table_17771 ( "Day: (see Irregularities )" text, "Sunday S\u014dl (Sun)" text, "Monday Luna (Moon)" text, "Tuesday Mars (Mars)" text, "Wednesday Mercurius (Mercury)" text, "Thursday Iuppiter (Jupiter)" text, "Friday Venus (Venus)" text, "Saturday Saturnus ( ...
SELECT "Saturday Saturnus ( Saturn)" FROM table_17771 WHERE "Wednesday Mercurius (Mercury)" = 'Mercuridi'
### Instruction: CREATE TABLE company ( Company_ID real, Name text, Headquarters text, Industry text, Sales_in_Billion real, Profits_in_Billion real, Assets_in_Billion real, Market_Value_in_Billion real ) CREATE TABLE employment ( Company_ID int, People_ID int, Year_working ...
SELECT Headquarters, COUNT(Headquarters) FROM company GROUP BY Industry, Headquarters ORDER BY COUNT(Headquarters)
### Instruction: CREATE TABLE professor ( prof_office VARCHAR, emp_num VARCHAR ) CREATE TABLE CLASS ( prof_num VARCHAR, crs_code VARCHAR ) CREATE TABLE course ( crs_description VARCHAR, crs_code VARCHAR ) CREATE TABLE employee ( emp_fname VARCHAR, emp_num VARCHAR ) -- Using valid SQ...
SELECT T2.emp_fname, T4.prof_office, T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num
### Instruction: CREATE TABLE Has_Allergy ( StuID INTEGER, Allergy 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 Allergy_Type ( Aller...
SELECT AllergyType, COUNT(*) FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy GROUP BY T2.AllergyType
### Instruction: CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3) ) CREATE TABLE College ( cName varchar(20), state varchar(2), enr numeric(5,0) ) CREATE TABLE Player ( pID numeric(5,0), pName varchar(20), yCard varchar(3), HS ...
SELECT state, enr FROM College AS T1 JOIN Tryout AS T2 ON T1.cName = T2.cName WHERE T2.decision = 'yes' ORDER BY state
### 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
### Instruction: CREATE TABLE channel ( Channel_ID int, Name text, Owner text, Share_in_percent real, Rating_in_percent real ) CREATE TABLE broadcast_share ( Channel_ID int, Program_ID int, Date text, Share_in_percent real ) CREATE TABLE broadcast ( Channel_ID int, Program_...
SELECT Time_of_day, COUNT(*) FROM broadcast GROUP BY Time_of_day ORDER BY Time_of_day
### Instruction: CREATE TABLE table_29203 ( "Rank" real, "Rider" text, "Sat 21 Aug" text, "Mon 23 Aug" text, "Tues 24 Aug" text, "Wed 25 Aug" text, "Thurs 26 Aug" text, "Fri 27 Aug" text, "Sat 28 Aug" text ) -- Using valid SQLite, answer the following questions for the tables provi...
SELECT "Sat 21 Aug" FROM table_29203 WHERE "Thurs 26 Aug" = '20'' 56.01 108.143mph'
### Instruction: CREATE TABLE volume ( volume_id number, volume_issue text, issue_date text, weeks_on_top number, song text, artist_id number ) CREATE TABLE music_festival ( id number, music_festival text, date_of_ceremony text, category text, volume number, result text ...
SELECT T2.issue_date FROM artist AS T1 JOIN volume AS T2 ON T1.artist_id = T2.artist_id WHERE T1.artist = "Gorgoroth"
### Instruction: 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 text ) CREATE TABLE faculty_participates_in ( facid number, actid numbe...
SELECT rank, sex, COUNT(*) FROM faculty GROUP BY rank, sex
### Instruction: CREATE TABLE phone_market ( market_id number, phone_id text, num_of_stock number ) CREATE TABLE phone ( name text, phone_id number, memory_in_g number, carrier text, price number ) CREATE TABLE market ( market_id number, district text, num_of_employees numb...
SELECT T3.name FROM phone_market AS T1 JOIN market AS T2 ON T1.market_id = T2.market_id JOIN phone AS T3 ON T1.phone_id = T3.phone_id WHERE T2.num_of_shops > 50
### Instruction: CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE lives_in ( stuid number, dormid number, room_number number ) CREATE TABLE has_amenity ( dormid number, ame...
SELECT COUNT(*), SUM(student_capacity), gender FROM dorm GROUP BY gender
### Instruction: CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE activity ( actid number, activity_name text ) CREATE TABLE participates_in ( stuid number, actid number ) CRE...
SELECT COUNT(DISTINCT facid) FROM faculty_participates_in
### Instruction: CREATE TABLE storm ( storm_id number, name text, dates_active text, max_speed number, damage_millions_usd number, number_deaths number ) CREATE TABLE affected_region ( region_id number, storm_id number, number_city_affected number ) CREATE TABLE region ( region...
SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id ORDER BY T3.number_deaths DESC LIMIT 1
### Instruction: CREATE TABLE table_25137 ( "Position" real, "1990\u20131991" text, "1991\u20131992" text, "1992\u20131993" text, "1993\u20131994" text, "1994\u20131995" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was ranked in the same p...
SELECT "1990\u20131991" FROM table_25137 WHERE "1993\u20131994" = 'Andy Roberts'
### Instruction: CREATE TABLE table_53213 ( "Year" text, "2010" real, "2009" real, "2008" real, "2005" real, "2000" real, "1995" real, "1990" real, "1985" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the 1995 value with a 2...
SELECT SUM("1995") FROM table_53213 WHERE "2005" > '74' AND "2008" = '84' AND "2000" < '80'
### Instruction: CREATE TABLE stadium ( id int, name text, Home_Games int, Average_Attendance real, Total_Attendance real, Capacity_Percentage real ) CREATE TABLE game ( stadium_id int, id int, Season int, Date text, Home_team text, Away_team text, Score text, Co...
SELECT Away_team, COUNT(Away_team) FROM game GROUP BY Home_team, Away_team
### Instruction: CREATE TABLE table_train_213 ( "id" int, "serum_potassium" float, "laboratory_abnormality" bool, "hemoglobin_a1c_hba1c" float, "positive_hiv" bool, "serum_calcium" float, "estimated_glomerular_filtration_rate_egfr" int, "body_mass_index_bmi" float, "age" float, "...
SELECT * FROM table_train_213 WHERE hemoglobin_a1c_hba1c < 9 OR hemoglobin_a1c_hba1c < 9
### Instruction: CREATE TABLE table_64934 ( "Country" text, "1960" real, "1961" real, "1962" real, "1963" real, "1964" real, "1965" real, "1966" real, "1967" real, "1968" real, "1969" real ) -- Using valid SQLite, answer the following questions for the tables provided above...
SELECT COUNT("1969") FROM table_64934 WHERE "1967" < '0.73' AND "1964" > '0.07'
### 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 MAX(elevation) FROM airports WHERE country = 'Iceland'
### Instruction: CREATE TABLE table_name_83 ( rank VARCHAR, total_passengers__millions__2011_12 VARCHAR, annual_interchanges__millions__2011_12 VARCHAR, annual_entry_exit__millions__2011_12 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What rank has...
SELECT rank FROM table_name_83 WHERE annual_interchanges__millions__2011_12 < 1.99 AND annual_entry_exit__millions__2011_12 < 13.835 AND total_passengers__millions__2011_12 > 13.772
### Instruction: CREATE TABLE College ( cName varchar(20), state varchar(2), enr numeric(5,0) ) CREATE TABLE Player ( pID numeric(5,0), pName varchar(20), yCard varchar(3), HS numeric(5,0) ) CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decisio...
SELECT pPos, MIN(T2.HS) FROM Tryout AS T1 JOIN Player AS T2 ON T1.pID = T2.pID GROUP BY pPos ORDER BY MIN(T2.HS) DESC
### Instruction: CREATE TABLE table_6267 ( "Rank" real, "Airport" text, "Total Passengers" real, "% Change 2005/2006" text, "International Passengers" real, "Domestic Passengers" real, "Transit Passengers" real, "Aircraft Movements" real, "Freight (Metric Tonnes)" real ) -- Using v...
SELECT COUNT("International Passengers") FROM table_6267 WHERE "Aircraft Movements" < '88,592' AND "Transit Passengers" = '319,093' AND "Rank" < '4'
### Instruction: CREATE TABLE employee ( eid number(9,0), name varchar2(30), salary number(10,2) ) CREATE TABLE flight ( flno number(4,0), origin varchar2(20), destination varchar2(20), distance number(6,0), departure_date date, arrival_date date, price number(7,2), aid numb...
SELECT name, distance FROM aircraft
### 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_Neutral, ACC_Percent FROM basketball_match
### Instruction: CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following ...
SELECT T1.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name ORDER BY T1.Manufacturer
### Instruction: CREATE TABLE employment ( Company_ID int, People_ID int, Year_working int ) CREATE TABLE people ( People_ID int, Age int, Name text, Nationality text, Graduation_College text ) CREATE TABLE company ( Company_ID real, Name text, Headquarters text, Indust...
SELECT Headquarters, COUNT(Headquarters) FROM company GROUP BY Headquarters ORDER BY COUNT(Headquarters)
### Instruction: CREATE TABLE news_report ( journalist_ID int, Event_ID int, Work_Type text ) CREATE TABLE event ( Event_ID int, Date text, Venue text, Name text, Event_Attendance int ) CREATE TABLE journalist ( journalist_ID int, Name text, Nationality text, Age text, ...
SELECT Work_Type, AVG(Years_working) FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_ID = t2.journalist_ID GROUP BY t2.Work_Type ORDER BY AVG(Years_working) DESC
### Instruction: CREATE TABLE people ( People_ID int, Name text, Age real, Height real, Hometown text ) CREATE TABLE gymnast ( Gymnast_ID int, Floor_Exercise_Points real, Pommel_Horse_Points real, Rings_Points real, Vault_Points real, Parallel_Bars_Points real, Horizonta...
SELECT Hometown, COUNT(*) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown ORDER BY COUNT(*)
### Instruction: CREATE TABLE table_train_234 ( "id" int, "orthostatic_hypotension" bool, "systolic_blood_pressure_sbp" int, "estimated_glomerular_filtration_rate_egfr" int, "postural_fall_of_dbp" int, "diastolic_blood_pressure_dbp" int, "postural_fall_of_sbp" int, "allergy_to_sglt_2_inh...
SELECT * FROM table_train_234 WHERE estimated_glomerular_filtration_rate_egfr > 60
### Instruction: CREATE TABLE table_14223 ( "T-35" text, "T-100" text, "KV-1 M1940" text, "KV-1 M1941" text, "KV-1 M1942" text, "KV-1S M1942" text, "KV-85 M1943" text, "IS-2 M1945" text, "IS-3 M1945" text ) -- Using valid SQLite, answer the following questions for the tables provid...
SELECT "T-100" FROM table_14223 WHERE "IS-3 M1945" = '150 (225)'
### Instruction: CREATE TABLE table_75341 ( "Station" text, "Services" text, "Local authority" text, "Zone 2007" text, "Zone 2008" text, "Zone 2010" text, "Zone 2013" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Local authority has a...
SELECT "Local authority" FROM table_75341 WHERE "Zone 2007" = 'outside zones' AND "Zone 2008" = 'outside zones' AND "Zone 2010" = 'outside zones' AND "Station" = 'waltham cross'
### Instruction: CREATE TABLE table_14299 ( "Name A[\u203a ]" text, "Dam or A[\u203a ] Reservoir" text, "GNIS Feature ID # Link A[\u203a ] B[\u203a ]" real, "Elevation A[\u203a ]" text, "Borough or A[\u203a ] Census area" text ) -- Using valid SQLite, answer the following questions for the tables ...
SELECT MAX("GNIS Feature ID # Link A[\u203a ] B[\u203a ]") FROM table_14299 WHERE "Name A[\u203a ]" = 'upper dewey lake dam'
### 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 Grape, COUNT(*) FROM wine GROUP BY Grape ORDER BY Grape DESC
### Instruction: CREATE TABLE company ( Company_ID int, Rank int, Company text, Headquarters text, Main_Industry text, Sales_billion real, Profits_billion real, Assets_billion real, Market_Value real ) CREATE TABLE station_company ( Station_ID int, Company_ID int, Rank_o...
SELECT Main_Industry, SUM(Market_Value) FROM company GROUP BY Main_Industry
### Instruction: CREATE TABLE College ( cName varchar(20), state varchar(2), enr numeric(5,0) ) CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3) ) CREATE TABLE Player ( pID numeric(5,0), pName varchar(20), yCard varchar(3), HS ...
SELECT state, enr FROM College AS T1 JOIN Tryout AS T2 ON T1.cName = T2.cName WHERE T2.decision = 'yes' ORDER BY enr
### 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 Team_Name, ACC_Percent FROM basketball_match
### Instruction: CREATE TABLE table_44029 ( "Rank" real, "Company" text, "Headquarters" text, "Industry" text, "Sales (billion $)" real, "Profits (billion $)" real, "Assets (billion $)" real, "Market Value (billion $)" real ) -- Using valid SQLite, answer the following questions for th...
SELECT SUM("Profits (billion $)") FROM table_44029 WHERE "Headquarters" = 'usa' AND "Industry" = 'banking' AND "Sales (billion $)" < '98.64'
### Instruction: CREATE TABLE station ( id int, network_name text, services text, local_authority text ) CREATE TABLE train ( id int, train_number int, name text, origin text, destination text, time text, interval text ) CREATE TABLE route ( train_id int, station_id...
SELECT services, COUNT(services) FROM station GROUP BY services ORDER BY COUNT(services)
### Instruction: CREATE TABLE train ( id int, train_number int, name text, origin text, destination text, time text, interval text ) CREATE TABLE station ( id int, network_name text, services text, local_authority text ) CREATE TABLE weekly_weather ( station_id int, ...
SELECT time, train_number FROM train WHERE destination = 'Chennai' ORDER BY time
### Instruction: CREATE TABLE table_203_510 ( id number, "township" text, "fips" number, "population\ncenter" text, "population" number, "population\ndensity\n(/mi2)" number, "population\ndensity\n(/km2)" number, "land area\n(mi2)" number, "land area\n(km2)" number, "water area\n...
SELECT COUNT("township") FROM table_203_510 WHERE "population" > 1000
### Instruction: CREATE TABLE table_test_18 ( "id" int, "bleeding" int, "dialysis" bool, "hct" int, "hepatic_disease" bool, "anaemia" bool, "creatinine_clearance_cl" float, "polycytaemia" bool, "thrombocytopenia" float, "kidney_disease" bool, "body_mass_index_bmi" float, ...
SELECT * FROM table_test_18 WHERE creatinine_clearance_cl > 20 OR dialysis = 1
### Instruction: CREATE TABLE table_203_642 ( id number, "name" text, "quadrant" text, "sector" text, "ward" text, "type" text, "2012\npopulation\nrank" number, "population\n(2012)" number, "population\n(2011)" number, "% change" number, "dwellings\n(2012)" number, "area\...
SELECT "name" FROM table_203_642 ORDER BY "population\n(2012)" DESC LIMIT 1
### Instruction: CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following ...
SELECT Headquarter, AVG(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY AVG(Revenue)