instruction stringlengths 212 6.3k | output stringlengths 6 2.03k |
|---|---|
### 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 WHERE Rank = "AsstProf" GROUP BY Sex |
### Instruction:
CREATE TABLE table_204_292 (
id number,
"no." number,
"name" text,
"class" number,
"games" number,
"minutes" number,
"points" number,
"2 points\n(made/attempts)" text,
"2 points\n(%)" number,
"3 points\n(made/attempts)" text,
"3 points\n(%)" number,
"free... | SELECT "name" FROM table_204_292 ORDER BY "steals" DESC LIMIT 1 |
### Instruction:
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 int
)
CREATE TABLE station (
id int,
network_name text,
services text,
local_authority ... | SELECT name, COUNT(name) FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id JOIN train AS t3 ON t2.train_id = t3.id WHERE t1.local_authority = "Chiltern" GROUP BY name ORDER BY COUNT(name) DESC |
### Instruction:
CREATE TABLE table_46090 (
"Country" text,
"Population (July 2005 est.)" real,
"Land Area (km\u00b2)" real,
"% of arable land (2005 est.)" text,
"Arable Land (km\u00b2)" real,
"Population Density (pop per km\u00b2)" real
)
-- Using valid SQLite, answer the following questions ... | SELECT COUNT("Population (July 2005 est.)") FROM table_46090 WHERE "Arable Land (km\u00b2)" < '16,280' AND "Land Area (km\u00b2)" < '240' AND "Country" = 'american samoa (us)' AND "Population Density (pop per km\u00b2)" > '291' |
### Instruction:
CREATE TABLE Activity (
actid INTEGER,
activity_name varchar(25)
)
CREATE TABLE Participates_in (
stuid INTEGER,
actid INTEGER
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor ... | SELECT Sex, COUNT(*) FROM Faculty GROUP BY Sex ORDER BY Sex DESC |
### Instruction:
CREATE TABLE ref_characteristic_types (
characteristic_type_code text,
characteristic_type_description text
)
CREATE TABLE ref_product_categories (
product_category_code text,
product_category_description text,
unit_of_measure text
)
CREATE TABLE ref_colors (
color_code text,
... | SELECT color_description FROM ref_colors |
### Instruction:
CREATE TABLE Faculty_Participates_in (
FacID INTEGER,
actid INTEGER
)
CREATE TABLE Faculty (
FacID INTEGER,
Lname VARCHAR(15),
Fname VARCHAR(15),
Rank VARCHAR(15),
Sex VARCHAR(1),
Phone INTEGER,
Room VARCHAR(5),
Building VARCHAR(13)
)
CREATE TABLE Activity (
... | SELECT Building, COUNT(*) FROM Faculty GROUP BY Building |
### Instruction:
CREATE TABLE Activity (
actid INTEGER,
activity_name varchar(25)
)
CREATE TABLE Participates_in (
stuid INTEGER,
actid INTEGER
)
CREATE TABLE Faculty_Participates_in (
FacID INTEGER,
actid INTEGER
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VA... | SELECT Building, COUNT(*) FROM Faculty GROUP BY Building |
### Instruction:
CREATE TABLE ref_document_types (
document_type_code text,
document_type_name text,
document_type_description text
)
CREATE TABLE accounts (
account_id number,
statement_id number,
account_details text
)
CREATE TABLE projects (
project_id number,
project_details text
)... | SELECT statement_id, COUNT(*) FROM accounts GROUP BY statement_id |
### Instruction:
CREATE TABLE table_73596 (
"Rank" real,
"WS Points" real,
"Name" text,
"Country" text,
"08-09 I/O best" real,
"08-09 GP/JGP best" real,
"08-09 GP/JGP 2nd" real,
"08-09 OI best" real,
"08-09 OI 2nd" real,
"07-08 I/O best" real,
"07-08 GP/JGP best" real,
"0... | SELECT "07-08 GP/JGP 2nd" FROM table_73596 WHERE "Name" = 'Mao Asada' |
### Instruction:
CREATE TABLE player (
Player_ID int,
Sponsor_name text,
Player_name text,
Gender text,
Residence text,
Occupation text,
Votes int,
Rank text
)
CREATE TABLE player_coach (
Player_ID int,
Coach_ID int,
Starting_year int
)
CREATE TABLE match_result (
Rank ... | SELECT Gender, COUNT(Gender) FROM player GROUP BY Gender |
### 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 injury_accident (
game_id int,
id int,
Player text,
Injury text,
Number_of_matches text,
Source text
)
... | SELECT Season, COUNT(Season) FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.Injury = 'Foot injury' OR T3.Injury = 'Knee problem' |
### Instruction:
CREATE TABLE dorm_amenity (
amenid number,
amenity_name text
)
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 numb... | SELECT T1.dorm_name, T1.student_capacity FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid GROUP BY T2.dormid ORDER BY COUNT(*) LIMIT 1 |
### Instruction:
CREATE TABLE table_204_277 (
id number,
"region" text,
"country" text,
"location" text,
"size (m)" text,
"payload (metric tonnes)" text,
"degrees of freedom" number,
"x horiz disp (mm)" number,
"y horiz disp (mm)" number,
"z vert disp (mm)" number,
"x horiz v... | SELECT "region" FROM table_204_277 WHERE "region" <> 'asia' GROUP BY "region" ORDER BY COUNT(*) DESC LIMIT 1 |
### Instruction:
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 VARCHAR(15),
Rank VARCHAR(15),
Sex VARCHAR(1),
Phone INTEGER,
... | SELECT Building, COUNT(*) FROM Faculty GROUP BY Building |
### Instruction:
CREATE TABLE claims (
claim_id number,
policy_id number,
date_claim_made time,
date_claim_settled time,
amount_claimed number,
amount_settled number
)
CREATE TABLE customer_policies (
policy_id number,
customer_id number,
policy_type_code text,
start_date time,
... | SELECT SUM(amount_claimed) FROM claims |
### Instruction:
CREATE TABLE accounts (
account_id number,
statement_id number,
account_details text
)
CREATE TABLE statements (
statement_id number,
statement_details text
)
CREATE TABLE documents_with_expenses (
document_id number,
budget_type_code text,
document_details text
)
CRE... | SELECT project_id FROM documents GROUP BY project_id HAVING COUNT(*) >= 2 |
### Instruction:
CREATE TABLE projects (
project_id number,
project_details 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
)
CREATE TABLE docu... | SELECT project_id FROM documents GROUP BY project_id ORDER BY COUNT(*) LIMIT 1 |
### Instruction:
CREATE TABLE school_details (
School_ID int,
Nickname text,
Colors text,
League text,
Class text,
Division text
)
CREATE TABLE school (
School_ID int,
School text,
Location text,
Enrollment real,
Founded real,
Denomination text,
Boys_or_Girls text,
... | SELECT Denomination, COUNT(*) FROM school GROUP BY Denomination ORDER BY Denomination |
### Instruction:
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 int,
name text,
Region text,
Start_year text
)
CREATE TABLE competition (
Competition_ID int,
... | SELECT T1.name, COUNT(T1.name) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID GROUP BY T1.name |
### Instruction:
CREATE TABLE event (
ID int,
Name text,
Stadium_ID int,
Year text
)
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Country text,
Opening_year int
)
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
... | SELECT meter_200, SUM(ID) FROM swimmer GROUP BY meter_200 ORDER BY SUM(ID) DESC |
### Instruction:
CREATE TABLE school_details (
school_id number,
nickname text,
colors text,
league text,
class text,
division text
)
CREATE TABLE school (
school_id number,
school text,
location text,
enrollment number,
founded number,
denomination text,
boys_or_gir... | SELECT denomination FROM school WHERE founded < 1890 INTERSECT SELECT denomination FROM school WHERE founded > 1900 |
### 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, SUM(meter_100) FROM swimmer GROUP BY Nationality ORDER BY SUM(meter_100) DESC |
### Instruction:
CREATE TABLE table_19520 (
"Station Name" text,
"2002\u201303" real,
"2004\u201305" real,
"2005\u201306" real,
"2006\u201307" real,
"2007\u201308" real,
"2008\u201309" real,
"2009\u201310" real,
"2010\u201311" real,
"2011\u201312" real
)
-- Using valid SQLite, ... | SELECT COUNT("2011\u201312") FROM table_19520 WHERE "2008\u201309" = '11580' |
### Instruction:
CREATE TABLE customers (
customer_id number,
customer_details text
)
CREATE TABLE payments (
payment_id number,
settlement_id number,
payment_method_code text,
date_payment_made time,
amount_payment number
)
CREATE TABLE claims (
claim_id number,
policy_id number,
... | SELECT SUM(amount_payment) FROM payments |
### Instruction:
CREATE TABLE school_details (
school_id number,
nickname text,
colors text,
league text,
class text,
division text
)
CREATE TABLE player (
player_id number,
player text,
team text,
age number,
position text,
school_id number
)
CREATE TABLE school (
... | SELECT T2.location FROM player AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id GROUP BY T1.school_id HAVING COUNT(*) > 1 |
### Instruction:
CREATE TABLE table_61740 (
"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,
"4:30 pm" text,
"5:00 pm" text,
"6:30 pm" tex... | SELECT "1:00 pm" FROM table_61740 WHERE "4:30 pm" = 'local programs' AND "7:30 am" = 'the today show with katie couric & matt lauer' |
### 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 DISTINCT T2.hardware_model_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.graphics_mode = T2.screen_mode WHERE T1.type = "Graphics" OR t2.company_name = "Nokia Corporation" |
### Instruction:
CREATE TABLE claims (
claim_id number,
policy_id number,
date_claim_made time,
date_claim_settled time,
amount_claimed number,
amount_settled number
)
CREATE TABLE customers (
customer_id number,
customer_details text
)
CREATE TABLE settlements (
settlement_id numb... | SELECT DISTINCT customer_details FROM customers |
### 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 hemodynamic_instability = 1 OR heart_disease = 1 |
### Instruction:
CREATE TABLE table_203_530 (
id number,
"country" text,
"gdp (usd bln, 2012)" number,
"gdp (usd bln, 2017)" number,
"gdp (usd ppp bln, 2012)" number,
"gdp (usd ppp bln, 2017)" number,
"per capita (usd, 2012)" number,
"per capita (usd, 2017)" number,
"per capita (usd ... | SELECT SUM("gdp (usd ppp bln, 2012)") FROM table_203_530 WHERE "country" IN ('niger', 'sierra leone') |
### Instruction:
CREATE TABLE table_dev_42 (
"id" int,
"gender" string,
"depression" bool,
"familial_hypercholesterolemia" bool,
"microalbuminuria" int,
"renal_disease" bool,
"diabetic" string,
"estimated_glomerular_filtration_rate_egfr" int,
"serum_creatinine" float,
"fbg" int,
... | SELECT * FROM table_dev_42 WHERE diabetic = 'ii' AND depression = 1 AND body_mass_index_bmi < 44 AND (age >= 21 AND age <= 65) AND gender = 'female' |
### 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_200, AVG(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 |
### 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, COUNT(Nationality) FROM swimmer GROUP BY Nationality ORDER BY COUNT(Nationality) DESC |
### Instruction:
CREATE TABLE table_42588 (
"Average population (x 1,000)" text,
"Live births" text,
"Deaths" text,
"Natural change" text,
"Migration" text,
"Crude birth rate (per 1,000)" real,
"Crude death rate (per 1,000)" real,
"Natural change (per 1,000)" real,
"Migration (per 1,... | SELECT SUM("Migration (per 1,000)") FROM table_42588 WHERE "Crude birth rate (per 1,000)" = '17.54' AND "Natural change (per 1,000)" > '10.95' |
### Instruction:
CREATE TABLE table_55582 (
"Party" text,
"Results 2004" text,
"CSA 5/28/09" text,
"Ifop 5/30/09" text,
"Ipsos 5/30/09" text,
"BVA 6/1/09" text,
"TNS-Sofres 6/2/09" text,
"OpinionWay 6/3/09" text,
"Ipsos 6/3/09" text,
"TNS-Sofres 6/4/09" text,
"CSA 6/4/09" tex... | SELECT "TNS-Sofres 6/2/09" FROM table_55582 WHERE "Ipsos 6/3/09" = '27%' |
### Instruction:
CREATE TABLE table_204_277 (
id number,
"region" text,
"country" text,
"location" text,
"size (m)" text,
"payload (metric tonnes)" text,
"degrees of freedom" number,
"x horiz disp (mm)" number,
"y horiz disp (mm)" number,
"z vert disp (mm)" number,
"x horiz v... | SELECT "size (m)" FROM table_204_277 WHERE "country" = 'algeria' |
### Instruction:
CREATE TABLE player_coach (
Player_ID int,
Coach_ID int,
Starting_year int
)
CREATE TABLE player (
Player_ID int,
Sponsor_name text,
Player_name text,
Gender text,
Residence text,
Occupation text,
Votes int,
Rank text
)
CREATE TABLE coach (
Coach_ID int... | SELECT Occupation, COUNT(*) FROM player GROUP BY Occupation ORDER BY COUNT(*) 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 COUNT(Comptroller) DESC |
### Instruction:
CREATE TABLE table_204_292 (
id number,
"no." number,
"name" text,
"class" number,
"games" number,
"minutes" number,
"points" number,
"2 points\n(made/attempts)" text,
"2 points\n(%)" number,
"3 points\n(made/attempts)" text,
"3 points\n(%)" number,
"free... | SELECT "name" FROM table_204_292 ORDER BY "points" DESC LIMIT 1 |
### Instruction:
CREATE TABLE table_79011 (
"Rank (2012)" real,
"IATA Code" text,
"Major City Served" text,
"State" text,
"2012" real,
"2011" real,
"2010" real,
"2009" real,
"2008" real,
"2007" real,
"2006" real,
"2005" real
)
-- Using valid SQLite, answer the following... | SELECT MIN("2009") FROM table_79011 WHERE "2008" > '10,215,225' AND "2007" < '20,796,173' AND "Major City Served" = 'philadelphia' |
### Instruction:
CREATE TABLE table_train_3 (
"id" int,
"pregnancy_or_lactation" bool,
"severe_sepsis" bool,
"systolic_blood_pressure_sbp" int,
"mean_arterial_pressure_map" int,
"leukocyte_count" int,
"renal_disease" bool,
"temperature" float,
"sepsis" bool,
"hypotension" bool,
... | SELECT * FROM table_train_3 WHERE pregnancy_or_lactation = 1 |
### Instruction:
CREATE TABLE match (
round number,
location text,
country text,
date text,
fastest_qualifying text,
winning_pilot text,
winning_aircraft text
)
CREATE TABLE aircraft (
aircraft_id number,
aircraft text,
description text,
max_gross_weight text,
total_disk... | SELECT COUNT(*) FROM aircraft |
### Instruction:
CREATE TABLE table_60043 (
"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,
"4:00 pm" text,
"4:30 pm" te... | SELECT "6:30 pm" FROM table_60043 WHERE "9:00 am" = 'local programs' AND "8:00 am" = 'the early show' |
### Instruction:
CREATE TABLE product_characteristics (
product_id number,
characteristic_id number,
product_characteristic_value text
)
CREATE TABLE ref_colors (
color_code text,
color_description text
)
CREATE TABLE ref_product_categories (
product_category_code text,
product_category_de... | SELECT COUNT(*) FROM ref_colors |
### Instruction:
CREATE TABLE table_14022 (
"Township" text,
"County" text,
"Pop. (2010)" real,
"Land ( sqmi )" real,
"Water (sqmi)" real,
"Latitude" real,
"Longitude" real,
"GEO ID" real,
"ANSI code" real
)
-- Using valid SQLite, answer the following questions for the tables provi... | SELECT AVG("Pop. (2010)") FROM table_14022 WHERE "ANSI code" < '1036864' AND "Longitude" > '-98.46611' AND "Land ( sqmi )" < '36.238' AND "Latitude" < '48.144102' |
### Instruction:
CREATE TABLE table_60678 (
"Name" text,
"Wikis" text,
"Web publishing" text,
"Calendaring software" text,
"Project Management" text,
"Workflow system" text,
"Document Management" text,
"List Management" text,
"XML Forms Management and workflow" text,
"Discussion"... | SELECT "Social software" FROM table_60678 WHERE "Discussion" = 'no' AND "Time Tracking" = 'no' AND "Charting" = 'no' |
### Instruction:
CREATE TABLE table_37645 (
"Location (State, City)" text,
"USN 2013" real,
"BW 2013" real,
"Forbes 2011" real,
"Ec 2013" real,
"FT 2011" real,
"AE 2011" real,
"CNN 2011" real,
"BI 2013" real,
"ARWU 2012" real
)
-- Using valid SQLite, answer the following questi... | SELECT AVG("ARWU 2012") FROM table_37645 WHERE "USN 2013" < '91' AND "Location (State, City)" = 'illinois, champaign' AND "Ec 2013" > '1000' |
### 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 estimated_glomerular_filtration_rate_egfr < 30 |
### Instruction:
CREATE TABLE station (
id int,
network_name text,
services text,
local_authority text
)
CREATE TABLE route (
train_id int,
station_id int
)
CREATE TABLE train (
id int,
train_number int,
name text,
origin text,
destination text,
time text,
interval ... | SELECT time, COUNT(time) FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id JOIN train AS t3 ON t2.train_id = t3.id WHERE t1.local_authority = "Chiltern" GROUP BY time ORDER BY time DESC |
### Instruction:
CREATE TABLE Faculty_Participates_in (
FacID INTEGER,
actid INTEGER
)
CREATE TABLE Faculty (
FacID INTEGER,
Lname VARCHAR(15),
Fname VARCHAR(15),
Rank VARCHAR(15),
Sex VARCHAR(1),
Phone INTEGER,
Room VARCHAR(5),
Building VARCHAR(13)
)
CREATE TABLE Participates_... | SELECT Sex, COUNT(*) FROM Faculty WHERE Rank = "AsstProf" GROUP BY Sex |
### Instruction:
CREATE TABLE city (
city_id number,
city text,
hanzi text,
hanyu_pinyin text,
regional_population number,
gdp number
)
CREATE TABLE hosting_city (
year number,
match_id number,
host_city text
)
CREATE TABLE temperature (
city_id number,
jan number,
feb ... | SELECT T2.year FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T1.city = "Taizhou ( Zhejiang )" |
### 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_200, COUNT(meter_200) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 DESC |
### Instruction:
CREATE TABLE Dorm (
dormid INTEGER,
dorm_name VARCHAR(20),
student_capacity INTEGER,
gender VARCHAR(1)
)
CREATE TABLE Dorm_amenity (
amenid INTEGER,
amenity_name VARCHAR(25)
)
CREATE TABLE Has_amenity (
dormid INTEGER,
amenid INTEGER
)
CREATE TABLE Student (
StuID... | SELECT city_code, AVG(Age) FROM Student GROUP BY city_code ORDER BY city_code |
### Instruction:
CREATE TABLE Has_amenity (
dormid INTEGER,
amenid INTEGER
)
CREATE TABLE Lives_in (
stuid INTEGER,
dormid INTEGER,
room_number INTEGER
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
... | SELECT Sex, MAX(Age) FROM Student GROUP BY Sex ORDER BY MAX(Age) |
### 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_200, SUM(ID) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 DESC |
### Instruction:
CREATE TABLE Activity (
actid INTEGER,
activity_name varchar(25)
)
CREATE TABLE Participates_in (
stuid INTEGER,
actid INTEGER
)
CREATE TABLE Faculty (
FacID INTEGER,
Lname VARCHAR(15),
Fname VARCHAR(15),
Rank VARCHAR(15),
Sex VARCHAR(1),
Phone INTEGER,
Roo... | SELECT Rank, COUNT(Rank) FROM Faculty GROUP BY Rank |
### Instruction:
CREATE TABLE table_204_292 (
id number,
"no." number,
"name" text,
"class" number,
"games" number,
"minutes" number,
"points" number,
"2 points\n(made/attempts)" text,
"2 points\n(%)" number,
"3 points\n(made/attempts)" text,
"3 points\n(%)" number,
"free... | SELECT SUM("3 points\n(made/attempts)") FROM table_204_292 |
### 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(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 COUNT(AllergyType) DESC |
### Instruction:
CREATE TABLE farm (
Farm_ID int,
Year int,
Total_Horses real,
Working_Horses real,
Total_Cattle real,
Oxen real,
Bulls real,
Cows real,
Pigs real,
Sheep_and_Goats real
)
CREATE TABLE competition_record (
Competition_ID int,
Farm_ID int,
Rank int
)
C... | SELECT Year, COUNT(Year) FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID ORDER BY COUNT(Year) DESC |
### Instruction:
CREATE TABLE ref_document_types (
document_type_code text,
document_type_name text,
document_type_description text
)
CREATE TABLE projects (
project_id number,
project_details text
)
CREATE TABLE documents (
document_id number,
document_type_code text,
project_id numbe... | SELECT document_type_code, COUNT(*) FROM documents GROUP BY document_type_code |
### Instruction:
CREATE TABLE dept_locations (
dnumber number,
dlocation text
)
CREATE TABLE department (
dname text,
dnumber number,
mgr_ssn number,
mgr_start_date text
)
CREATE TABLE dependent (
essn number,
dependent_name text,
sex text,
bdate text,
relationship text
)
... | SELECT fname, lname, address FROM employee ORDER BY bdate |
### Instruction:
CREATE TABLE Faculty (
FacID INTEGER,
Lname VARCHAR(15),
Fname VARCHAR(15),
Rank VARCHAR(15),
Sex VARCHAR(1),
Phone INTEGER,
Room VARCHAR(5),
Building VARCHAR(13)
)
CREATE TABLE Participates_in (
stuid INTEGER,
actid INTEGER
)
CREATE TABLE Faculty_Participates_... | SELECT Rank, COUNT(Rank) FROM Faculty GROUP BY Rank |
### Instruction:
CREATE TABLE table_dev_45 (
"id" int,
"tc" int,
"systolic_blood_pressure_sbp" int,
"parenteral_antibiotic_therapy" bool,
"fasting_plasma_glucose_fpg" float,
"active_infection" bool,
"untreated_hyperlipidemia" bool,
"hemoglobin_a1c_hba1c" float,
"temperature" float,
... | SELECT * FROM table_dev_45 WHERE alcohol_abuse = 1 |
### Instruction:
CREATE TABLE building (
building_id text,
Name text,
Street_address text,
Years_as_tallest text,
Height_feet int,
Floors int
)
CREATE TABLE Institution (
Institution_id text,
Institution text,
Location text,
Founded real,
Type text,
Enrollment int,
T... | SELECT Institution, COUNT(*) FROM Institution AS T1 JOIN protein AS T2 ON T1.Institution_id = T2.Institution_id GROUP BY T1.Institution_id ORDER BY COUNT(*) |
### Instruction:
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
CREATE TABLE Has_Allergy (
StuID INTEGER,
Allergy VARCHAR(20)
)
CREATE TABLE Allergy_Type (
Aller... | SELECT T1.Allergy, COUNT(T1.Allergy) FROM Allergy_Type AS T1 JOIN Has_Allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = "Lisa" GROUP BY T1.Allergy ORDER BY T1.Allergy DESC |
### Instruction:
CREATE TABLE table_55580 (
"Party" text,
"Results 2004" text,
"CSA 5/28/09" text,
"Ifop 5/30/09" text,
"Ipsos 5/30/09" text,
"BVA 6/1/09" text,
"TNS-Sofres 6/2/09" text,
"OpinionWay 6/3/09" text,
"Ipsos 6/3/09" text,
"TNS-Sofres 6/4/09" text,
"CSA 6/4/09" tex... | SELECT "TNS-Sofres 6/2/09" FROM table_55580 WHERE "Ifop 5/30/09" = '5%' |
### 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 |
### Instruction:
CREATE TABLE table_204_217 (
id number,
"camp" text,
"div sec\ndivision" text,
"admin\ndistrict" text,
"9 feb" number,
"11 feb" number,
"16 feb" number,
"25 feb" number,
"27 feb" number,
"2 mar" number,
"4 mar" number,
"6 mar" number,
"11 mar" number,... | SELECT "camp" FROM table_204_217 WHERE "camp" IN ('gamini maha vidyalayam', 'nelukkulam kalaimahal maha vidyalayam') ORDER BY "9 feb" DESC LIMIT 1 |
### Instruction:
CREATE TABLE discipline_enrollments (
campus number,
discipline number,
year number,
undergraduate number,
graduate number
)
CREATE TABLE campuses (
id number,
campus text,
location text,
county text,
year number
)
CREATE TABLE faculty (
campus number,
... | SELECT campusfee FROM campuses AS T1 JOIN csu_fees AS T2 ON T1.id = t2.campus WHERE t1.campus = "San Jose State University" AND T2.year = 1996 |
### Instruction:
CREATE TABLE table_train_104 (
"id" int,
"migraines" bool,
"depression" bool,
"mini_mental_state_examination_mmse" int,
"systolic_blood_pressure_sbp" int,
"renal_disease" bool,
"alzheimer" bool,
"estimated_glomerular_filtration_rate_egfr" int,
"diastolic_blood_pressu... | SELECT * FROM table_train_104 WHERE renal_disease = 1 OR estimated_glomerular_filtration_rate_egfr < 44 |
### Instruction:
CREATE TABLE table_dev_56 (
"id" int,
"anemia" bool,
"gender" string,
"white_blood_cell_count_wbc" int,
"hemoglobinopathy" bool,
"major_hematological_conditions" bool,
"laboratory_abnormality" bool,
"hemoglobin_a1c_hba1c" float,
"renal_disease" bool,
"hematocrit_... | SELECT * FROM table_dev_56 WHERE (hematocrit_hct < 36 AND gender = 'male') OR (hematocrit_hct < 34 AND gender = 'female') |
### Instruction:
CREATE TABLE Events (
Event_ID INTEGER,
Service_ID INTEGER,
Event_Details VARCHAR(255)
)
CREATE TABLE Participants_in_Events (
Event_ID INTEGER,
Participant_ID INTEGER
)
CREATE TABLE Services (
Service_ID INTEGER,
Service_Type_Code CHAR(15)
)
CREATE TABLE Participants (
... | SELECT T1.Participant_Type_Code, AVG(COUNT(*)) FROM Participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID GROUP BY T1.Participant_Type_Code ORDER BY AVG(COUNT(*)) DESC |
### Instruction:
CREATE TABLE transactions_lots (
transaction_id number,
lot_id number
)
CREATE TABLE purchases (
purchase_transaction_id number,
purchase_details text
)
CREATE TABLE sales (
sales_transaction_id number,
sales_details text
)
CREATE TABLE lots (
lot_id number,
investor_... | SELECT MAX(share_count) FROM transactions WHERE amount_of_transaction < 10000 |
### Instruction:
CREATE TABLE club (
Club_ID int,
name text,
Region text,
Start_year text
)
CREATE TABLE club_rank (
Rank real,
Club_ID int,
Gold real,
Silver real,
Bronze real,
Total real
)
CREATE TABLE competition (
Competition_ID int,
Year real,
Competition_type ... | SELECT Position, COUNT(*) FROM player WHERE Points < 30 GROUP BY Position ORDER BY COUNT(*) DESC |
### Instruction:
CREATE TABLE table_2054 (
"Index" real,
"Ozone, Running 8 hourly mean (\u03bcg/m 3 )" text,
"Nitrogen Dioxide, Hourly mean (\u03bcg/m 3 )" text,
"Sulphur Dioxide, 15 minute mean (\u03bcg/m 3 )" text,
"PM10 Particles, 24 hour mean (\u03bcg/m 3 )" text,
"PM2.5 Particles, 24 hour m... | SELECT "Sulphur Dioxide, 15 minute mean (\u03bcg/m 3 )" FROM table_2054 WHERE "Ozone, Running 8 hourly mean (\u03bcg/m 3 )" = '121-140' |
### Instruction:
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
CREATE TABLE Allergy_Type (
Allergy VARCHAR(20),
AllergyType VARCHAR(20)
)
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_42827 (
"Poll" text,
"Wk 2" real,
"Wk 3" real,
"Wk 4" real,
"Wk 5" real,
"Wk 6" real,
"Wk 7" real,
"Wk 8" real,
"Wk 9" real,
"Wk 10" real,
"Wk 11" real,
"Wk 12" real,
"Wk 13" text,
"Wk 14" text,
"Final" text
)
-- Using val... | SELECT MIN("Wk 7") FROM table_42827 WHERE "Wk 3" = '12' AND "Wk 4" < '9' AND "Wk 2" > '11' |
### Instruction:
CREATE TABLE table_51819 (
"Tournament" text,
"1968" text,
"1969" text,
"1970" text,
"1971" text,
"1972" text,
"1973" text,
"1974" text,
"1975" text,
"1976" text,
"1977" text,
"1978" text,
"1979" text,
"Career SR" text,
"Career W\u2013L" text,... | SELECT "Career W\u2013L" FROM table_51819 WHERE "1968" = 'a' AND "1974" = '4r' |
### 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 Lives_in (
stui... | SELECT city_code, AVG(Age) FROM Student GROUP BY city_code ORDER BY AVG(Age) DESC |
### Instruction:
CREATE TABLE table_6460 (
"District" text,
"2010 Population (000)" real,
"2008 GDP (USD bn) a" real,
"2008 GDP per capita (USD) a" real,
"Agri culture b" real,
"Mining b" real,
"Manufac turing b" real,
"Services & cons truction b" real,
"Exports (USD mn) 2011" text,
... | SELECT MIN("Vehicles (per 1000) d") FROM table_6460 WHERE "Agri culture b" > '12.6' |
### 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 T2.bname FROM loan AS T1 JOIN bank AS T2 ON T1.branch_id = T2.branch_id JOIN customer AS T3 ON T1.cust_id = T3.cust_id WHERE T3.credit_score < 100 GROUP BY T2.bname ORDER BY SUM(T1.amount) DESC LIMIT 1 |
### Instruction:
CREATE TABLE Has_Allergy (
StuID INTEGER,
Allergy VARCHAR(20)
)
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,
... | SELECT Fname, COUNT(Fname) FROM Student WHERE NOT StuID IN (SELECT T1.StuID FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.AllergyType = "food") GROUP BY Fname ORDER BY COUNT(Fname) DESC |
### Instruction:
CREATE TABLE stadium (
id number,
name text,
capacity number,
city text,
country text,
opening_year number
)
CREATE TABLE record (
id number,
result text,
swimmer_id number,
event_id number
)
CREATE TABLE swimmer (
id number,
name text,
nationality ... | SELECT country FROM stadium WHERE capacity > 60000 INTERSECT SELECT country FROM stadium WHERE capacity < 50000 |
### Instruction:
CREATE TABLE event (
ID int,
Name text,
Stadium_ID int,
Year text
)
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
meter_600 text,
meter_700 text,
Ti... | SELECT meter_200, AVG(meter_100) FROM swimmer GROUP BY meter_200 |
### Instruction:
CREATE TABLE table_65071 (
"Project" text,
"License" text,
"Date" text,
"Protocol" text,
"Technology" text,
"Server" text,
"Client" text,
"Web Client" text,
"Multiple Sessions" text,
"Encryption" text,
"Authentication" text,
"Data Compression" text,
"... | SELECT "Image Quality" FROM table_65071 WHERE "Multiple Sessions" = 'x' AND "Authentication" = '✓' AND "Date" = 'may 15, 2007' |
### 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 Nationality, AVG(meter_100) FROM swimmer GROUP BY Nationality ORDER BY Nationality |
### 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 Competition_type, COUNT(Competition_type) FROM competition GROUP BY Competition_type ORDER BY COUNT(Competition_type) DESC |
### Instruction:
CREATE TABLE table_train_175 (
"id" int,
"lipid_lowering_therapy" bool,
"hemoglobin_a1c_hba1c" float,
"diabetic" string,
"fasting_serum_triglycerides" int,
"gilbert_syndrome" bool,
"age" float,
"alanine_aminotransferase" bool,
"NOUSE" float
)
-- Using valid SQLite,... | SELECT * FROM table_train_175 WHERE fasting_serum_triglycerides > 400 OR (fasting_serum_triglycerides > 250 AND lipid_lowering_therapy = 0) |
### Instruction:
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 text,
Start_year text
)
CREATE TABLE competition (
Competition_ID int,
Year real,
Competition_type text,
... | SELECT Position, AVG(Points) FROM player GROUP BY Position ORDER BY AVG(Points) |
### 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 Name, COUNT(Name) 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 WHERE T2.value_points > 70 GROUP BY Name |
### 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 (
Competition_ID int,
... | SELECT Position, COUNT(Position) FROM player GROUP BY Position HAVING AVG(Points) >= 20 ORDER BY COUNT(Position) |
### Instruction:
CREATE TABLE table_49073 (
"Year" text,
"2001" real,
"2002" real,
"2003" real,
"2004" real,
"2005" real,
"2006" real,
"2007" real,
"2008" real,
"2009" real,
"2010" real,
"2011" real,
"2012" real
)
-- Using valid SQLite, answer the following question... | SELECT MIN("2003") FROM table_49073 WHERE "2009" < '15,884' AND "2006" < '9,845' AND "2004" < '868' |
### Instruction:
CREATE TABLE Faculty_Participates_in (
FacID INTEGER,
actid INTEGER
)
CREATE TABLE Faculty (
FacID INTEGER,
Lname VARCHAR(15),
Fname VARCHAR(15),
Rank VARCHAR(15),
Sex VARCHAR(1),
Phone INTEGER,
Room VARCHAR(5),
Building VARCHAR(13)
)
CREATE TABLE Participates_... | SELECT Rank, COUNT(*) FROM Faculty GROUP BY Sex, Rank |
### 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 Position, AVG(Points) FROM player GROUP BY Position ORDER BY AVG(Points) DESC |
### Instruction:
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
CREATE TABLE Has_amenity (
dormid INTEGER,
amenid INTEGER
)
CREATE TABLE Dorm_amenity (
amenid IN... | SELECT city_code, COUNT(*) FROM Student GROUP BY city_code ORDER BY city_code DESC |
### Instruction:
CREATE TABLE table_61661 (
"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,
"4:00 pm" te... | SELECT "8:00 am" FROM table_61661 WHERE "12:30 pm" = 'port charles' |
### 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 bname, SUM(amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_ID = T2.branch_ID GROUP BY T1.bname ORDER BY SUM(amount) DESC |
### Instruction:
CREATE TABLE competition_result (
Competition_ID int,
Club_ID_1 int,
Club_ID_2 int,
Score text
)
CREATE TABLE competition (
Competition_ID int,
Year real,
Competition_type text,
Country text
)
CREATE TABLE club (
Club_ID int,
name text,
Region text,
Sta... | SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type ORDER BY Competition_type DESC |
### Instruction:
CREATE TABLE Dorm (
dormid INTEGER,
dorm_name VARCHAR(20),
student_capacity INTEGER,
gender VARCHAR(1)
)
CREATE TABLE Lives_in (
stuid INTEGER,
dormid INTEGER,
room_number INTEGER
)
CREATE TABLE Has_amenity (
dormid INTEGER,
amenid INTEGER
)
CREATE TABLE Dorm_amen... | SELECT city_code, AVG(Age) FROM Student GROUP BY city_code ORDER BY city_code DESC |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.