instruction stringlengths 212 6.3k | output stringlengths 6 2.03k |
|---|---|
### Instruction:
CREATE TABLE dorm_amenity (
amenid number,
amenity_name text
)
CREATE TABLE student (
stuid number,
lname text,
fname text,
age number,
sex text,
major number,
advisor number,
city_code text
)
CREATE TABLE dorm (
dormid number,
dorm_name text,
stude... | SELECT T1.fname, T1.lname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge') |
### Instruction:
CREATE TABLE table_45556 (
"Tournament" text,
"1988" text,
"1989" text,
"1990" text,
"1991" text,
"1992" text,
"1993" text,
"1994" text,
"1995" text,
"1996" text,
"1997" text,
"1998" text,
"1999" text,
"2000" text,
"2001" text,
"2002" text... | SELECT "2001" FROM table_45556 WHERE "1989" = 'a' AND "Tournament" = 'u.s. open' |
### Instruction:
CREATE TABLE screen_mode (
Graphics_mode real,
Char_cells text,
Pixels text,
Hardware_colours real,
used_kb real,
map text,
Type text
)
CREATE TABLE phone (
Company_name text,
Hardware_Model_name text,
Accreditation_type text,
Accreditation_level text,
D... | SELECT Company_name, COUNT(Company_name) FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T1.Launch_year = 2002 OR T1.RAM_MiB > 32 GROUP BY Company_name |
### Instruction:
CREATE TABLE first_notification_of_loss (
fnol_id number,
customer_id number,
policy_id number,
service_id number
)
CREATE TABLE claims (
claim_id number,
fnol_id number,
effective_date time
)
CREATE TABLE settlements (
settlement_id number,
claim_id number,
ef... | SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id |
### Instruction:
CREATE TABLE table_63300 (
"Municipality (2010)" text,
"White (both Hispanic and Non-Hispanic)" real,
"Black (Both Hispanic and Non-Hispanic)" real,
"Amerindian (Both Hispanic and Non-Hispanic)" real,
"n Asia (Both Hispanic and Non-Hispanic)" real,
"Multiracial (Both Hispanic an... | SELECT MAX("Amerindian (Both Hispanic and Non-Hispanic)") FROM table_63300 WHERE "Black (Both Hispanic and Non-Hispanic)" = '15.7' AND "White (both Hispanic and Non-Hispanic)" > '69.5' |
### Instruction:
CREATE TABLE store (
store_id number,
store_name text,
type text,
area_size number,
number_of_product_category number,
ranking number
)
CREATE TABLE district (
district_id number,
district_name text,
headquartered_city text,
city_population number,
city_area... | SELECT t3.headquartered_city FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id WHERE t1.store_name = "Blackville" |
### Instruction:
CREATE TABLE claims (
claim_id number,
fnol_id number,
effective_date time
)
CREATE TABLE settlements (
settlement_id number,
claim_id number,
effective_date time,
settlement_amount number
)
CREATE TABLE customers (
customer_id number,
customer_name text
)
CREATE ... | SELECT COUNT(*) FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Dayana Robel" |
### Instruction:
CREATE TABLE airport_aircraft (
id number,
airport_id number,
aircraft_id number
)
CREATE TABLE pilot (
pilot_id number,
name text,
age number
)
CREATE TABLE match (
round number,
location text,
country text,
date text,
fastest_qualifying text,
winning_... | SELECT MAX(transit_passengers), MIN(transit_passengers) FROM airport |
### Instruction:
CREATE TABLE Lives_in (
stuid INTEGER,
dormid INTEGER,
room_number INTEGER
)
CREATE TABLE Has_amenity (
dormid INTEGER,
amenid INTEGER
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
... | SELECT Fname, COUNT(Fname) FROM Student WHERE Age < (SELECT AVG(Age) FROM Student) GROUP BY Fname ORDER BY COUNT(Fname) 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 GROUP BY Official_Name ORDER BY Year |
### Instruction:
CREATE TABLE event (
id number,
name text,
stadium_id number,
year text
)
CREATE TABLE record (
id number,
result text,
swimmer_id number,
event_id number
)
CREATE TABLE stadium (
id number,
name text,
capacity number,
city text,
country text,
o... | SELECT t1.name, t1.nationality FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE result = 'Win' GROUP BY t2.swimmer_id HAVING COUNT(*) > 1 |
### Instruction:
CREATE TABLE customers (
customer_id number,
customer_first_name text,
customer_last_name text,
customer_address text,
customer_phone text,
customer_email text,
other_customer_details text
)
CREATE TABLE financial_transactions (
transaction_id number,
previous_trans... | SELECT customer_id, COUNT(*) FROM customers_cards GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1 |
### Instruction:
CREATE TABLE competition_result (
Competition_ID int,
Club_ID_1 int,
Club_ID_2 int,
Score text
)
CREATE TABLE player (
Player_ID int,
name text,
Position text,
Club_ID int,
Apps real,
Tries real,
Goals text,
Points real
)
CREATE TABLE competition (
... | 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 ORDER BY T1.name DESC |
### Instruction:
CREATE TABLE farm_competition (
Competition_ID int,
Year int,
Theme text,
Host_city_ID int,
Hosts text
)
CREATE TABLE competition_record (
Competition_ID int,
Farm_ID int,
Rank int
)
CREATE TABLE farm (
Farm_ID int,
Year int,
Total_Horses real,
Working_... | SELECT Year, COUNT(Year) FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY Official_Name ORDER BY Year DESC |
### Instruction:
CREATE TABLE table_test_23 (
"id" int,
"previous_mi" bool,
"anemia" bool,
"left_ventricular_ejection_fraction_lvef" int,
"tolerate_gadolinium_contrast_media" bool,
"renal_disease" bool,
"creatinine_clearance_cl" float,
"estimated_glomerular_filtration_rate_egfr" int,
... | SELECT * FROM table_test_23 WHERE previous_mi = 1 |
### Instruction:
CREATE TABLE store_district (
Store_ID int,
District_ID int
)
CREATE TABLE store_product (
Store_ID int,
Product_ID int
)
CREATE TABLE product (
product_id int,
product text,
dimensions text,
dpi real,
pages_per_minute_color real,
max_page_size text,
interf... | SELECT Headquartered_City, COUNT(*) FROM store AS t1 JOIN store_district AS t2 ON t1.Store_ID = t2.Store_ID JOIN district AS t3 ON t2.District_ID = t3.District_ID GROUP BY t3.Headquartered_City |
### Instruction:
CREATE TABLE competition_record (
Competition_ID int,
Farm_ID int,
Rank int
)
CREATE TABLE city (
City_ID int,
Official_Name text,
Status text,
Area_km_2 real,
Population real,
Census_Ranking text
)
CREATE TABLE farm_competition (
Competition_ID int,
Year i... | SELECT Official_Name, COUNT(Official_Name) FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY Official_Name ORDER BY COUNT(Official_Name) |
### Instruction:
CREATE TABLE table_26258 (
"Party" text,
"Result, Parliam. election 2005" text,
"Result, County elections 2007" text,
"Aug 2008" text,
"Sep 2008" text,
"Oct 2008" text,
"Nov 2008" text,
"Dec 2008" text,
"Jan 2009" text,
"Feb 2009" text,
"Mar 2009" text,
"... | SELECT COUNT("Oct 2008") FROM table_26258 WHERE "Aug 2008" = '30.8%' |
### Instruction:
CREATE TABLE VISITS (
Tourist_Attraction_ID VARCHAR,
Tourist_ID VARCHAR
)
CREATE TABLE VISITORS (
Tourist_Details VARCHAR,
Tourist_ID VARCHAR
)
CREATE TABLE Tourist_Attractions (
Name VARCHAR,
Tourist_Attraction_ID VARCHAR
)
-- Using valid SQLite, answer the following questi... | SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Alison" EXCEPT SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attrac... |
### 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 WHERE "3 points\n(made/attempts)" IS NULL ORDER BY id DESC LIMIT 1 |
### Instruction:
CREATE TABLE table_41090 (
"Tournament" text,
"1987" text,
"1988" text,
"1989" text,
"1990" text,
"1991" text,
"1992" text,
"1993" text,
"1994" text,
"1995" text,
"1996" text,
"1997" text,
"1998" text,
"1999" text,
"2000" text,
"2001" text... | SELECT "1989" FROM table_41090 WHERE "1999" = 'f' AND "1994" = '2r' |
### Instruction:
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Country text,
Opening_year int
)
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
me... | SELECT meter_200, COUNT(meter_200) FROM swimmer GROUP BY meter_200 ORDER BY COUNT(meter_200) |
### Instruction:
CREATE TABLE betfront (
year number,
datetime time,
country text,
competion text,
match text,
home_opening number,
draw_opening number,
away_opening number,
home_closing number,
draw_closing number,
away_closing number
)
CREATE TABLE football_data (
seas... | SELECT * FROM football_data WHERE (fthg + ftag) = 0 |
### Instruction:
CREATE TABLE table_43662 (
"Bank" text,
"Score (Iran)" real,
"Score (Global)" real,
"Banking Power/Capital Base ($ Million)" real,
"Banking Power/Capital Base (% Change)" text,
"Total Assets ($ Million)" real,
"Total Assets (Score)" real,
"Total Assets (% Change)" text,
... | SELECT COUNT("Performance/Return on Capital (Score)") FROM table_43662 WHERE "Score (Iran)" < '3' AND "Score (Global)" = '266' |
### Instruction:
CREATE TABLE table_48072 (
"State" text,
"Abbreviation" text,
"Capital" text,
"Area (km\u00b2)" real,
"Population (2005)" real,
"Density (2005)" real,
"GDP (% total) (2004)" text,
"GDP per capita (US$) (2004)" real,
"HDI (2005)" real,
"Literacy (2003)" text,
... | SELECT SUM("Density (2005)") FROM table_48072 WHERE "Area (km\u00b2)" = '340086.7' AND "Population (2005)" < '5926300' |
### Instruction:
CREATE TABLE genre (
g_name varchar2(20),
rating varchar2(10),
most_popular_in varchar2(50)
)
CREATE TABLE files (
f_id number(10),
artist_name varchar2(50),
file_size varchar2(20),
duration varchar2(20),
formats varchar2(20)
)
CREATE TABLE artist (
artist_name var... | SELECT languages, AVG(rating) FROM song GROUP BY languages ORDER BY languages |
### 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 competition (
Competition_ID int,
Year real,... | 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 ORDER BY COUNT(T1.name) |
### Instruction:
CREATE TABLE table_77382 (
"Tournament" text,
"1988" text,
"1989" text,
"1990" text,
"1991" text,
"1992" text,
"1993" text,
"1994" text,
"1995" text,
"1996" text,
"1997" text,
"1998" text,
"1999" text,
"2000" text,
"2001" text,
"2002" text... | SELECT "2002" FROM table_77382 WHERE "1994" = 'a' AND "1989" = 'nme' AND "1999" = '2r' |
### Instruction:
CREATE TABLE table_test_17 (
"id" int,
"anemia" bool,
"left_ventricular_ejection_fraction_lvef" int,
"systolic_blood_pressure_sbp" int,
"active_infection" bool,
"fever" bool,
"bradycardia" int,
"renal_disease" bool,
"oliguria" bool,
"creatinine_clearance_cl" floa... | SELECT * FROM table_test_17 WHERE systolic_blood_pressure_sbp < 100 |
### Instruction:
CREATE TABLE files (
f_id number(10),
artist_name varchar2(50),
file_size varchar2(20),
duration varchar2(20),
formats varchar2(20)
)
CREATE TABLE song (
song_name varchar2(50),
artist_name varchar2(50),
country varchar2(20),
f_id number(10),
genre_is varchar2(2... | SELECT languages, AVG(rating) FROM song GROUP BY languages ORDER BY languages DESC |
### Instruction:
CREATE TABLE certificate (
eid number,
aid number
)
CREATE TABLE aircraft (
aid number,
name text,
distance number
)
CREATE TABLE flight (
flno number,
origin text,
destination text,
distance number,
departure_date time,
arrival_date time,
price number,... | 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" INTERSECT 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 = "Airbus A340-300" |
### Instruction:
CREATE TABLE table_dev_46 (
"id" int,
"ogtt" int,
"systolic_blood_pressure_sbp" int,
"neuromuscular_disease" bool,
"renal_disease" bool,
"hepatic_disease" bool,
"active_oncologic_disease" bool,
"hematologic_disease" bool,
"diastolic_blood_pressure_dbp" int,
"musc... | SELECT * FROM table_dev_46 WHERE hypertension = 1 OR (systolic_blood_pressure_sbp > 180 OR diastolic_blood_pressure_dbp > 110) |
### Instruction:
CREATE TABLE degrees (
year number,
campus number,
degrees number
)
CREATE TABLE faculty (
campus number,
year number,
faculty number
)
CREATE TABLE campuses (
id number,
campus text,
location text,
county text,
year number
)
CREATE TABLE csu_fees (
ca... | SELECT T1.campus FROM campuses AS t1 JOIN enrollments AS t2 ON t1.id = t2.campus WHERE t2.year = 1956 AND totalenrollment_ay > 400 AND fte_ay > 200 |
### Instruction:
CREATE TABLE Participates_in (
stuid INTEGER,
actid INTEGER
)
CREATE TABLE Faculty_Participates_in (
FacID INTEGER,
actid INTEGER
)
CREATE TABLE Activity (
actid INTEGER,
activity_name varchar(25)
)
CREATE TABLE Faculty (
FacID INTEGER,
Lname VARCHAR(15),
Fname VA... | SELECT Building, COUNT(*) FROM Faculty GROUP BY Building ORDER BY COUNT(*) DESC |
### Instruction:
CREATE TABLE district (
district_id number,
district_name text,
headquartered_city text,
city_population number,
city_area number
)
CREATE TABLE store (
store_id number,
store_name text,
type text,
area_size number,
number_of_product_category number,
ranking... | SELECT t3.headquartered_city, COUNT(*) FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id GROUP BY t3.headquartered_city |
### Instruction:
CREATE TABLE customers (
customer_id number,
customer_first_name text,
customer_last_name text,
customer_address text,
customer_phone text,
customer_email text,
other_customer_details text
)
CREATE TABLE customers_cards (
card_id number,
customer_id number,
card... | SELECT customer_id, customer_first_name, customer_last_name, customer_phone FROM customers |
### Instruction:
CREATE TABLE football_data (
season text,
datetime time,
div text,
country text,
league text,
referee text,
hometeam text,
awayteam text,
fthg number,
ftag number,
ftr text,
hthg number,
htag number,
htr text,
psh number,
psd number,
p... | SELECT match FROM betfront ORDER BY draw_opening DESC LIMIT 1 |
### Instruction:
CREATE TABLE temperature (
city_id number,
jan number,
feb number,
mar number,
apr number,
jun number,
jul number,
aug number,
sep number,
oct number,
nov number,
dec number
)
CREATE TABLE match (
match_id number,
date text,
venue text,
s... | SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.mar < T2.jul INTERSECT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city |
### Instruction:
CREATE TABLE transactions (
transaction_id number,
investor_id number,
transaction_type_code text,
date_of_transaction time,
amount_of_transaction number,
share_count text,
other_details text
)
CREATE TABLE ref_transaction_types (
transaction_type_code text,
transac... | SELECT T2.lot_id, AVG(amount_of_transaction) FROM transactions AS T1 JOIN transactions_lots AS T2 ON T1.transaction_id = T2.transaction_id GROUP BY T2.lot_id |
### Instruction:
CREATE TABLE table_22411 (
"Country" text,
"Tourist arrivals (2011) (Millions)" text,
"Tourism receipts (2011) (Millions of US$)" real,
"Tourism receipts (2011) (US$ per arrival)" real,
"Tourism receipts (2011) (US$ per capita)" real,
"Tourism receipts (2003) (as % of GDP)" text... | SELECT COUNT("Tourism receipts (2003) (as % of exports)") FROM table_22411 WHERE "Tourism competitiveness (2011) (TTCI)" = '3.26' |
### Instruction:
CREATE TABLE table_test_17 (
"id" int,
"anemia" bool,
"left_ventricular_ejection_fraction_lvef" int,
"systolic_blood_pressure_sbp" int,
"active_infection" bool,
"fever" bool,
"bradycardia" int,
"renal_disease" bool,
"oliguria" bool,
"creatinine_clearance_cl" floa... | SELECT * FROM table_test_17 WHERE anemia = 1 OR hgb < 100 |
### Instruction:
CREATE TABLE ref_colors (
color_code text,
color_description text
)
CREATE TABLE products (
product_id number,
color_code text,
product_category_code text,
product_name text,
typical_buying_price text,
typical_selling_price text,
product_description text,
other_... | SELECT COUNT(*) FROM ref_colors WHERE NOT color_code IN (SELECT color_code FROM products) |
### Instruction:
CREATE TABLE competition (
Competition_ID int,
Year real,
Competition_type text,
Country text
)
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,
Ap... | 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 ORDER BY T1.name |
### Instruction:
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Country text,
Opening_year int
)
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
me... | SELECT name, COUNT(name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID WHERE Result = 'Win' GROUP BY name ORDER BY COUNT(name) DESC |
### Instruction:
CREATE TABLE settlements (
settlement_id number,
claim_id number,
date_claim_made time,
date_claim_settled time,
amount_claimed number,
amount_settled number,
customer_policy_id number
)
CREATE TABLE payments (
payment_id number,
settlement_id number,
payment_me... | SELECT date_claim_made FROM claims ORDER BY date_claim_made LIMIT 1 |
### Instruction:
CREATE TABLE club (
Club_ID int,
name text,
Region text,
Start_year text
)
CREATE TABLE competition (
Competition_ID int,
Year real,
Competition_type text,
Country text
)
CREATE TABLE club_rank (
Rank real,
Club_ID int,
Gold real,
Silver real,
Bronz... | SELECT Position, COUNT(Position) FROM player GROUP BY Position HAVING AVG(Points) >= 20 ORDER BY COUNT(Position) DESC |
### Instruction:
CREATE TABLE club (
Club_ID int,
Club_name text,
Region text,
Start_year int
)
CREATE TABLE coach (
Coach_ID int,
Coach_name text,
Gender text,
Club_ID int,
Rank int
)
CREATE TABLE player_coach (
Player_ID int,
Coach_ID int,
Starting_year int
)
CREATE ... | SELECT Gender, COUNT(Gender) FROM player GROUP BY Gender ORDER BY Gender DESC |
### Instruction:
CREATE TABLE hosting_city (
year number,
match_id number,
host_city text
)
CREATE TABLE match (
match_id number,
date text,
venue text,
score text,
result text,
competition text
)
CREATE TABLE temperature (
city_id number,
jan number,
feb number,
ma... | SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.mar < T2.dec EXCEPT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city |
### Instruction:
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Country text,
Opening_year int
)
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
me... | SELECT meter_200, SUM(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY SUM(meter_100) DESC |
### Instruction:
CREATE TABLE table_test_26 (
"id" int,
"bleeding" int,
"left_ventricular_ejection_fraction_lvef" int,
"left_main_coronary_artery_disease" bool,
"uncontrolled_diabetes" bool,
"hiv_infection" bool,
"hemoglobin_a1c_hba1c" float,
"hepatitis_b_infection" bool,
"renal_dise... | SELECT * FROM table_test_26 WHERE unprotected_left_main_disease = 1 OR stenosis >= 50 |
### Instruction:
CREATE TABLE table_3448 (
"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) in 2011 ( USD millions)") FROM table_3448 WHERE "Imports from Mercosur (% of each, 2010)" = '48.8' |
### Instruction:
CREATE TABLE table_test_26 (
"id" int,
"bleeding" int,
"left_ventricular_ejection_fraction_lvef" int,
"left_main_coronary_artery_disease" bool,
"uncontrolled_diabetes" bool,
"hiv_infection" bool,
"hemoglobin_a1c_hba1c" float,
"hepatitis_b_infection" bool,
"renal_dise... | SELECT * FROM table_test_26 WHERE renal_disease = 1 OR creatinine_clearance_cl < 30 |
### 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 Faculty_Participates_in (
FacID INTEGER,
actid INTEGER
)
CREATE TABLE Participates_... | SELECT Building, COUNT(*) FROM Faculty GROUP BY Building ORDER BY Building DESC |
### Instruction:
CREATE TABLE customer_policies (
policy_id number,
customer_id number,
policy_type_code text,
start_date time,
end_date time
)
CREATE TABLE customers (
customer_id number,
customer_details text
)
CREATE TABLE settlements (
settlement_id number,
claim_id number,
... | SELECT payment_method_code FROM payments GROUP BY payment_method_code ORDER BY COUNT(*) LIMIT 1 |
### Instruction:
CREATE TABLE files (
f_id number(10),
artist_name varchar2(50),
file_size varchar2(20),
duration varchar2(20),
formats varchar2(20)
)
CREATE TABLE artist (
artist_name varchar2(50),
country varchar2(20),
gender varchar2(20),
preferred_genre varchar2(50)
)
CREATE TA... | SELECT formats, COUNT(*) FROM files GROUP BY formats ORDER BY COUNT(*) 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 Participates_in (
stuid INTEGER,
actid INTEGER
)
CREATE TABLE Faculty_Participates_in (
... | SELECT Building, COUNT(*) FROM Faculty GROUP BY Building 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 Participates_in (
stuid INTEGER,
actid INTEGER
)
CREATE TABLE Faculty (
FacID INTEGE... | SELECT Sex, COUNT(*) FROM Faculty WHERE Rank = "AsstProf" GROUP BY Sex ORDER BY Sex |
### Instruction:
CREATE TABLE genre (
g_name varchar2(20),
rating varchar2(10),
most_popular_in varchar2(50)
)
CREATE TABLE files (
f_id number(10),
artist_name varchar2(50),
file_size varchar2(20),
duration varchar2(20),
formats varchar2(20)
)
CREATE TABLE artist (
artist_name var... | SELECT formats, COUNT(*) FROM files GROUP BY formats ORDER BY COUNT(*) |
### Instruction:
CREATE TABLE football_data (
season text,
datetime time,
div text,
country text,
league text,
referee text,
hometeam text,
awayteam text,
fthg number,
ftag number,
ftr text,
hthg number,
htag number,
htr text,
psh number,
psd number,
p... | SELECT year FROM betfront GROUP BY year ORDER BY COUNT(*) DESC LIMIT 1 |
### Instruction:
CREATE TABLE betfront (
year number,
datetime time,
country text,
competion text,
match text,
home_opening number,
draw_opening number,
away_opening number,
home_closing number,
draw_closing number,
away_closing number
)
CREATE TABLE football_data (
seas... | SELECT year FROM betfront GROUP BY year ORDER BY COUNT(*) DESC LIMIT 1 |
### Instruction:
CREATE TABLE genre (
g_name varchar2(20),
rating varchar2(10),
most_popular_in varchar2(50)
)
CREATE TABLE artist (
artist_name varchar2(50),
country varchar2(20),
gender varchar2(20),
preferred_genre varchar2(50)
)
CREATE TABLE song (
song_name varchar2(50),
artis... | SELECT languages, AVG(rating) FROM song GROUP BY languages ORDER BY languages DESC |
### Instruction:
CREATE TABLE table_41805 (
"Country" text,
"1997" real,
"1998" real,
"1999" real,
"2000" real,
"2001" real,
"2002" real,
"2003" real,
"2004" real,
"2005" real,
"2006" real,
"2007" real,
"2008" real,
"2009" real,
"2010" real,
"2011" real,
... | SELECT COUNT("2009") FROM table_41805 WHERE "1999" < '1' AND "2006" > '0' AND "1997" < '0' |
### Instruction:
CREATE TABLE Has_amenity (
dormid INTEGER,
amenid INTEGER
)
CREATE TABLE Lives_in (
stuid INTEGER,
dormid INTEGER,
room_number INTEGER
)
CREATE TABLE Dorm (
dormid INTEGER,
dorm_name VARCHAR(20),
student_capacity INTEGER,
gender VARCHAR(1)
)
CREATE TABLE Dorm_amen... | SELECT Fname, COUNT(Fname) FROM Student WHERE Major <> (SELECT Major FROM Student) GROUP BY Fname ORDER BY Fname |
### Instruction:
CREATE TABLE geographic (
city_name varchar,
county varchar,
region varchar
)
CREATE TABLE restaurant (
id int,
name varchar,
food_type varchar,
city_name varchar,
rating "decimal
)
CREATE TABLE location (
restaurant_id int,
house_number int,
street_name va... | SELECT location.house_number, restaurant.name FROM geographic, location, restaurant WHERE geographic.region = 'bay area' AND restaurant.city_name = geographic.city_name AND restaurant.food_type = 'american' AND restaurant.id = location.restaurant_id AND restaurant.rating = (SELECT MAX(RESTAURANTalias1.rating) FROM geog... |
### Instruction:
CREATE TABLE ref_product_categories (
product_category_code text,
product_category_description text,
unit_of_measure text
)
CREATE TABLE ref_characteristic_types (
characteristic_type_code text,
characteristic_type_description text
)
CREATE TABLE characteristics (
characterist... | SELECT COUNT(*) FROM products WHERE product_category_code = "Seeds" |
### 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 payments (
payment_id number,
settlement_id number,
payment_method_code text,
date_payment_made ti... | SELECT payment_method_code FROM payments GROUP BY payment_method_code ORDER BY COUNT(*) DESC LIMIT 1 |
### Instruction:
CREATE TABLE genre (
g_name varchar2(20),
rating varchar2(10),
most_popular_in varchar2(50)
)
CREATE TABLE artist (
artist_name varchar2(50),
country varchar2(20),
gender varchar2(20),
preferred_genre varchar2(50)
)
CREATE TABLE song (
song_name varchar2(50),
artis... | SELECT g_name, rating FROM genre ORDER BY g_name |
### 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 WHERE "name" <> 'amber merritt' ORDER BY "points" DESC LIMIT 1 |
### Instruction:
CREATE TABLE Participates_in (
stuid INTEGER,
actid INTEGER
)
CREATE TABLE Faculty_Participates_in (
FacID INTEGER,
actid INTEGER
)
CREATE TABLE Faculty (
FacID INTEGER,
Lname VARCHAR(15),
Fname VARCHAR(15),
Rank VARCHAR(15),
Sex VARCHAR(1),
Phone INTEGER,
... | SELECT Rank, COUNT(Rank) FROM Faculty GROUP BY Rank ORDER BY COUNT(Rank) DESC |
### Instruction:
CREATE TABLE Faculty_Participates_in (
FacID INTEGER,
actid INTEGER
)
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,
Advis... | SELECT Rank, COUNT(*) FROM Faculty GROUP BY Rank ORDER BY Rank DESC |
### Instruction:
CREATE TABLE Activity (
actid INTEGER,
activity_name varchar(25)
)
CREATE TABLE Faculty_Participates_in (
FacID INTEGER,
actid INTEGER
)
CREATE TABLE Participates_in (
stuid INTEGER,
actid INTEGER
)
CREATE TABLE Faculty (
FacID INTEGER,
Lname VARCHAR(15),
Fname VA... | SELECT Rank, COUNT(*) FROM Faculty GROUP BY Rank ORDER BY COUNT(*) DESC |
### 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 weekly_weather (
station_id int,
... | 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 COUNT(time) DESC |
### Instruction:
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
CREATE TABLE event (
ID int,
Name text,
Stadium_ID int,
Year text
)
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Country text,
Opening_year int
)
CR... | SELECT meter_200, COUNT(meter_200) FROM swimmer GROUP BY meter_200 ORDER BY COUNT(meter_200) |
### Instruction:
CREATE TABLE technician (
technician_id real,
Name text,
Team text,
Starting_Year real,
Age int
)
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... | 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 ORDER BY COUNT(Name) |
### Instruction:
CREATE TABLE airport_aircraft (
id number,
airport_id number,
aircraft_id number
)
CREATE TABLE pilot (
pilot_id number,
name text,
age number
)
CREATE TABLE aircraft (
aircraft_id number,
aircraft text,
description text,
max_gross_weight text,
total_disk_a... | SELECT AVG(international_passengers) FROM airport |
### Instruction:
CREATE TABLE finrev_fed_key_17 (
state_code number,
state text,
#_records text
)
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 nde... | SELECT T2.state, T3.average_scale_score FROM finrev_fed_key_17 AS T2 JOIN finrev_fed_17 AS T1 ON T1.state_code = T2.state_code JOIN ndecoreexcel_math_grade8 AS T3 ON T2.state = T3.state GROUP BY T2.state ORDER BY SUM(T1.t_fed_rev) DESC LIMIT 1 |
### Instruction:
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
meter_600 text,
meter_700 text,
Time text
)
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
... | SELECT meter_200, AVG(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 |
### Instruction:
CREATE TABLE table_65192 (
"Country or territory" text,
"2000" real,
"2001" real,
"2002" real,
"2003" real,
"2004" real,
"2005" real,
"2006" real,
"2007" real,
"2008" real,
"2009" real,
"2010" real,
"2011" real
)
-- Using valid SQLite, answer the fo... | SELECT SUM("2000") FROM table_65192 WHERE "2005" < '583,590' AND "2009" < '156,761' AND "2002" > '1,393,020' |
### Instruction:
CREATE TABLE participates_in (
stuid number,
actid number
)
CREATE TABLE faculty_participates_in (
facid number,
actid number
)
CREATE TABLE student (
stuid number,
lname text,
fname text,
age number,
sex text,
major number,
advisor number,
city_code te... | SELECT DISTINCT T1.lname FROM faculty AS T1 JOIN faculty_participates_in AS T2 ON T1.facid = T2.facid JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking' |
### Instruction:
CREATE TABLE store_product (
store_id number,
product_id number
)
CREATE TABLE district (
district_id number,
district_name text,
headquartered_city text,
city_population number,
city_area number
)
CREATE TABLE store (
store_id number,
store_name text,
type tex... | SELECT t1.product FROM product AS t1 JOIN store_product AS t2 ON t1.product_id = t2.product_id JOIN store AS t3 ON t2.store_id = t3.store_id WHERE t3.store_name = "Miramichi" |
### Instruction:
CREATE TABLE store_district (
Store_ID int,
District_ID int
)
CREATE TABLE store_product (
Store_ID int,
Product_ID int
)
CREATE TABLE product (
product_id int,
product text,
dimensions text,
dpi real,
pages_per_minute_color real,
max_page_size text,
interf... | SELECT District_name, City_Population FROM district WHERE City_Population BETWEEN 200000 AND 2000000 |
### Instruction:
CREATE TABLE accounts (
account_id number,
customer_id number,
account_name text,
other_account_details text
)
CREATE TABLE customers_cards (
card_id number,
customer_id number,
card_type_code text,
card_number text,
date_valid_from time,
date_valid_to time,
... | SELECT account_id, customer_id, account_name FROM accounts |
### Instruction:
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
CREATE TABLE Faculty (
FacID INTEGER,
Lname VARCHAR(15),
Fname VARCHAR(15),
Rank VARCHAR(15),
... | SELECT Building, COUNT(*) FROM Faculty GROUP BY Building ORDER BY Building |
### Instruction:
CREATE TABLE table_46413 (
"C/W 15+" real,
"Oblast\\Age" text,
"15 to 17" real,
"18 to 19" text,
"20 to 24" real,
"25 to 29" real,
"30 to 34" real,
"35 to 39" real,
"40 to 44" real,
"45 to 49" real,
"50 to 54" real,
"55 to 59" real,
"60 to 64" real,
... | SELECT AVG("C/W 15+") FROM table_46413 WHERE "18 to 19" = '132' AND "65 to 69" > '1,869' |
### Instruction:
CREATE TABLE table_64692 (
"Term Abroad" text,
"2000/01" real,
"2001/02" real,
"2002/03" real,
"2003/04" real,
"2004/05" real,
"2005/06" real,
"2006/07" real,
"2007/08" real,
"2008/09" real
)
-- Using valid SQLite, answer the following questions for the tables ... | SELECT AVG("2007/08") FROM table_64692 WHERE "2002/03" > '3.8' AND "2003/04" > '8.9' AND "2001/02" < '34.4' |
### 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 meter_200, AVG(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 |
### Instruction:
CREATE TABLE dorm_amenity (
amenid number,
amenity_name text
)
CREATE TABLE lives_in (
stuid number,
dormid number,
room_number number
)
CREATE TABLE has_amenity (
dormid number,
amenid number
)
CREATE TABLE student (
stuid number,
lname text,
fname text,
... | SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T2.amenid = T1.amenid JOIN dorm AS T3 ON T2.dormid = T3.dormid WHERE T3.dorm_name = 'Anonymous Donor Hall' ORDER BY T1.amenity_name |
### 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 Faculty_Participates_in (
FacID INTEGER,
actid INTEGER
)
CREATE TABLE Student (
... | SELECT Sex, COUNT(*) FROM Faculty WHERE Rank = "AsstProf" GROUP BY Sex ORDER BY COUNT(*) DESC |
### Instruction:
CREATE TABLE table_23948 (
"City (Utility)" text,
"Residential Monthly usage: 1000 kWh" text,
"Small power Power demand: 40 kW; Consumption 10,000 kWh, load factor: 35%." text,
"Medium power Power demand: 1,000 kW; Consumption: 400,000 kWh, load factor: 56 %." text,
"Large power Pow... | SELECT COUNT("Small power Power demand: 40 kW; Consumption 10,000 kWh, load factor: 35%.") FROM table_23948 WHERE "Medium power Power demand: 1,000 kW; Consumption: 400,000 kWh, load factor: 56 %." = '11.07' |
### Instruction:
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
meter_600 text,
meter_700 text,
... | SELECT meter_200, AVG(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 DESC |
### Instruction:
CREATE TABLE table_train_240 (
"id" int,
"anemia" bool,
"gender" string,
"systolic_blood_pressure_sbp" int,
"hemoglobin_a1c_hba1c" float,
"estimated_glomerular_filtration_rate_egfr" int,
"diastolic_blood_pressure_dbp" int,
"insulin_requirement" float,
"kidney_disease... | SELECT * FROM table_train_240 WHERE hypertension = 1 OR (diastolic_blood_pressure_dbp > 90 OR systolic_blood_pressure_sbp > 160) |
### Instruction:
CREATE TABLE event (
id number,
name text,
stadium_id number,
year text
)
CREATE TABLE swimmer (
id number,
name text,
nationality text,
meter_100 number,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
meter_600 text,
meter_700 t... | SELECT t3.name FROM record AS t1 JOIN event AS t2 ON t1.event_id = t2.id JOIN stadium AS t3 ON t3.id = t2.stadium_id GROUP BY t2.stadium_id ORDER BY COUNT(*) DESC LIMIT 1 |
### Instruction:
CREATE TABLE files (
f_id number(10),
artist_name varchar2(50),
file_size varchar2(20),
duration varchar2(20),
formats varchar2(20)
)
CREATE TABLE genre (
g_name varchar2(20),
rating varchar2(10),
most_popular_in varchar2(50)
)
CREATE TABLE song (
song_name varchar... | SELECT formats, COUNT(*) FROM files GROUP BY formats ORDER BY formats DESC |
### Instruction:
CREATE TABLE event (
ID int,
Name text,
Stadium_ID int,
Year text
)
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
meter_600 text,
meter_700 text,
Ti... | SELECT meter_200, SUM(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 |
### Instruction:
CREATE TABLE table_9745 (
"Tournament" text,
"1985" text,
"1986" text,
"1987" text,
"1988" text,
"1989" text,
"1990" text,
"1991" text,
"1992" text,
"1993" text,
"1994" text,
"1995" text,
"1996" text,
"1997" text,
"1998" text,
"1999" text,... | SELECT "1987" FROM table_9745 WHERE "1999" = 'a' AND "1989" = 'a' AND "1997" = 'a' |
### 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 Rank, COUNT(*) FROM Faculty GROUP BY Sex, Rank ORDER BY Rank DESC |
### Instruction:
CREATE TABLE chip_model (
Model_name text,
Launch_year real,
RAM_MiB real,
ROM_MiB real,
Slots text,
WiFi text,
Bluetooth text
)
CREATE TABLE phone (
Company_name text,
Hardware_Model_name text,
Accreditation_type text,
Accreditation_level text,
Date tex... | SELECT Company_name, COUNT(Company_name) FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = "Graphics" GROUP BY Company_name ORDER BY Company_name |
### 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 name, COUNT(name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID WHERE Result = 'Win' GROUP BY name ORDER BY name DESC |
### Instruction:
CREATE TABLE table_28268 (
"Model" text,
"Launch" text,
"Code name" text,
"Transistors (million)" real,
"Die size (mm 2 )" real,
"Bus interface" text,
"Memory ( MB )" text,
"SM count" real,
"Core config 1,3" text,
"Core ( MHz )" real,
"Shader ( MHz )" real,
... | SELECT COUNT("Die size (mm 2 )") FROM table_28268 WHERE "Texture ( GT /s)" = '34' |
### 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, COUNT(meter_200) FROM swimmer GROUP BY meter_200 ORDER BY COUNT(meter_200) DESC |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.