instruction
stringlengths
212
6.3k
output
stringlengths
6
2.03k
### Instruction: CREATE TABLE minor_in ( stuid number, dno number ) CREATE TABLE gradeconversion ( lettergrade text, gradepoint number ) CREATE TABLE course ( cid text, cname text, credits number, instructor number, days text, hours text, dno number ) CREATE TABLE enrolled...
SELECT cname FROM course WHERE credits = 1
### Instruction: CREATE TABLE products ( product_id number, product_name text, product_details text ) CREATE TABLE shipments ( shipment_id number, order_id number, invoice_number number, shipment_tracking_number text, shipment_date time, other_shipment_details text ) CREATE TABLE o...
SELECT order_id FROM shipments WHERE shipment_date = (SELECT MAX(shipment_date) FROM shipments)
### 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 T4.Name, COUNT(T4.Name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID JOIN event AS t3 ON t2.Event_ID = t3.ID JOIN stadium AS t4 ON t4.ID = t3.Stadium_ID WHERE t1.Nationality = 'Australia' GROUP BY T4.Name
### 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 untreated_hyperlipidemia = 1 OR (tc > 200 OR tgc > 200 OR ldl > 130)
### 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 serum_creatinine > 2.5 OR creatinine_clearance_cl < 30
### Instruction: CREATE TABLE review ( rid int, business_id varchar, user_id varchar, rating float, text longtext, year int, month varchar ) CREATE TABLE user ( uid int, user_id varchar, name varchar ) CREATE TABLE tip ( tip_id int, business_id varchar, text longtex...
SELECT AVG(rating) FROM review WHERE year = 2014
### Instruction: CREATE TABLE table_test_2 ( "id" int, "loss_of_consciousness" bool, "gender" string, "bleeding" int, "systolic_blood_pressure_sbp" int, "stroke" bool, "renal_disease" bool, "hemorrhagic_diathesis" bool, "transient_ischemic_attack" bool, "creatinine_clearance_cl" ...
SELECT * FROM table_test_2 WHERE final_timi >= 2
### Instruction: CREATE TABLE table_75810 ( "Member State sorted by GDP" text, "GDP in s billion of USD (2012)" real, "GDP % of EU (2012)" text, "Annual change % of GDP (2012)" text, "GDP per capita in PPP US$ (2012)" real, "Public Debt % of GDP (2013 Q1)" real, "Deficit (-)/ Surplus (+) % o...
SELECT AVG("Public Debt % of GDP (2013 Q1)") FROM table_75810 WHERE "Member State sorted by GDP" = 'czech republic' AND "GDP per capita in PPP US$ (2012)" > '27,191'
### Instruction: CREATE TABLE aircraft ( Aircraft_ID int(11), Aircraft varchar(50), Description varchar(50), Max_Gross_Weight varchar(50), Total_disk_area varchar(50), Max_disk_Loading varchar(50) ) CREATE TABLE airport_aircraft ( ID int, Airport_ID int, Aircraft_ID int ) CREATE TA...
SELECT Description, COUNT(Description) FROM aircraft GROUP BY Description
### Instruction: CREATE TABLE staff ( staff_id number, gender text, first_name text, last_name text, email_address text, phone_number text ) CREATE TABLE customers ( customer_id number, customer_type_code text, address_line_1 text, address_line_2 text, town_city text, st...
SELECT COUNT(DISTINCT complaint_type_code) FROM complaints
### Instruction: CREATE TABLE table_60679 ( "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 "Bookmarking, Tagging, Rating and Comments" FROM table_60679 WHERE "List Management" = 'no' AND "Charting" = 'no' AND "Web publishing" = 'no' AND "Name" = 'microsoft exchange server'
### Instruction: CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE field ...
SELECT DISTINCT venueid FROM venue WHERE venuename = 'Neuroscience'
### 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(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank ORDER BY COUNT(*)
### Instruction: CREATE TABLE ref_characteristic_types ( characteristic_type_code text, characteristic_type_description text ) CREATE TABLE product_characteristics ( product_id number, characteristic_id number, product_characteristic_value text ) CREATE TABLE products ( product_id number, ...
SELECT t1.product_name FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t2.color_description = "white"
### 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 city ( city_id number, city text, hanzi text, hanyu_piny...
SELECT T3.venue FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city JOIN match AS T3 ON T2.match_id = T3.match_id WHERE T1.city = "Nanjing ( Jiangsu )" AND T3.competition = "1994 FIFA World Cup qualification"
### Instruction: CREATE TABLE table_test_7 ( "id" int, "bleeding" int, "left_ventricular_ejection_fraction_lvef" int, "intra_aortic_balloon_pump_iabp" bool, "systolic_blood_pressure_sbp" int, "dialysis" bool, "intravenous_pressors" bool, "non_infarct_related_vessel" bool, "heart_dise...
SELECT * FROM table_test_7 WHERE liver_disease = 1 OR (child_pugh_score >= 10 AND child_pugh_score <= 15)
### Instruction: CREATE TABLE table_204_938 ( id number, "year" number, "edmonton\nhundred" number, "elthorne\nhundred" number, "gore\nhundred" number, "isleworth\nhundred" number, "ossulstone\nhundred\nholborn\ndivision" number, "ossulstone\nhundred\nfinsbury\ndivision" number, "oss...
SELECT "year" FROM table_204_938 ORDER BY "ossulstone\nhundred\ntower\ndivision" DESC LIMIT 1
### 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 liver_disease = 1 OR kidney_disease = 1
### Instruction: CREATE TABLE claims ( claim_id number, fnol_id number, effective_date time ) CREATE TABLE first_notification_of_loss ( fnol_id number, customer_id number, policy_id number, service_id number ) CREATE TABLE services ( service_id number, service_name text ) CREATE T...
SELECT t2.date_opened, t2.date_closed FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name LIKE "%Diana%"
### Instruction: CREATE TABLE table_75638 ( "Country" text, "Political Rights 2010" real, "Civil Liberties 2010" real, "Status 2010" text, "Political Rights 2011" real, "Civil Liberties 2011" real, "Status 2011" text, "Political Rights 2012" real, "Civil Liberties 2012" real, "St...
SELECT AVG("Civil Liberties 2012") FROM table_75638 WHERE "Status 2011" = 'not free' AND "Political Rights 2012" > '6' AND "Political Rights 2011" > '7'
### Instruction: CREATE TABLE checkin ( cid int, business_id varchar, count int, day varchar ) CREATE TABLE user ( uid int, user_id varchar, name varchar ) CREATE TABLE review ( rid int, business_id varchar, user_id varchar, rating float, text longtext, year int, ...
SELECT name FROM business WHERE rating < 2 AND state = 'Texas'
### Instruction: CREATE TABLE documents ( document_id number, document_type_code text, project_id number, document_date time, document_name text, document_description text, other_details text ) CREATE TABLE ref_document_types ( document_type_code text, document_type_name text, d...
SELECT T1.statement_details, T2.document_name FROM statements AS T1 JOIN documents AS T2 ON T1.statement_id = T2.document_id WHERE T1.statement_details = 'Private Project'
### Instruction: CREATE TABLE field ( fieldid int ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid in...
SELECT DISTINCT COUNT(1) FROM paper WHERE year = 1986
### Instruction: CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VA...
SELECT Fname, COUNT(Fname) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' GROUP BY Fname
### Instruction: CREATE TABLE review ( rid int, business_id varchar, user_id varchar, rating float, text longtext, year int, month varchar ) CREATE TABLE user ( uid int, user_id varchar, name varchar ) CREATE TABLE business ( bid int, business_id varchar, name varch...
SELECT review_count FROM business WHERE name = 'Acacia Cafe'
### Instruction: CREATE TABLE faculty ( campus number, year number, faculty number ) CREATE TABLE degrees ( year number, campus number, degrees number ) CREATE TABLE csu_fees ( campus number, year number, campusfee number ) CREATE TABLE enrollments ( campus number, year nu...
SELECT T1.campus FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2002 AND faculty > (SELECT MAX(faculty) FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2002 AND T1.county = "Orange")
### Instruction: CREATE TABLE table_train_101 ( "id" int, "systolic_blood_pressure_sbp" int, "uncontrolled_diabetes" bool, "hemoglobin_a1c_hba1c" float, "allergy_to_contrast_agent_gadolinium" bool, "diastolic_blood_pressure_dbp" int, "hypotension" bool, "hypertension" bool, "NOUSE" f...
SELECT * FROM table_train_101 WHERE (hypertension = 1 OR (systolic_blood_pressure_sbp > 160 OR diastolic_blood_pressure_dbp > 95)) OR (hypotension = 1 OR (systolic_blood_pressure_sbp < 90 OR diastolic_blood_pressure_dbp < 60))
### Instruction: CREATE TABLE projects ( project_id number, project_details text ) CREATE TABLE ref_budget_codes ( budget_type_code text, budget_type_description text ) CREATE TABLE documents_with_expenses ( document_id number, budget_type_code text, document_details text ) CREATE TABLE s...
SELECT T1.document_type_name, T1.document_type_description, T2.document_date FROM ref_document_types AS T1 JOIN documents AS T2 ON T1.document_type_code = T2.document_type_code
### Instruction: CREATE TABLE table_23558 ( "#" real, "Sanskrit" text, "Malayalam name \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02" text, "Tamil name \u0ba4\u0bae\u0bbf\u0bb4\u0bcd" text, "Telugu name \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41" text, "Kannada name \u0c95\u0ca8\u0ccd\u0ca8\u0ca1" text, "W...
SELECT "Kannada name \u0c95\u0ca8\u0ccd\u0ca8\u0ca1" FROM table_23558 WHERE "Tamil name \u0ba4\u0bae\u0bbf\u0bb4\u0bcd" = 'Anusham அனுஷம்'
### 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_Participates_in ( FacID INTEGER, actid INTEGER ) CREATE TABLE Faculty ( FacI...
SELECT Rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank ORDER BY COUNT(*) DESC
### Instruction: CREATE TABLE table_test_5 ( "id" int, "systemic_lupus_erythematosus" bool, "anemia" bool, "gender" string, "pregnancy_or_lactation" bool, "serum_potassium" float, "hemoglobin_a1c_hba1c" float, "heart_disease" bool, "renal_disease" bool, "creatinine_clearance_cl" ...
SELECT * FROM table_test_5 WHERE global_lvef >= 30 AND global_lvef <= 45
### Instruction: CREATE TABLE neighborhood ( id int, business_id varchar, neighborhood_name varchar ) CREATE TABLE business ( bid int, business_id varchar, name varchar, full_address varchar, city varchar, latitude varchar, longitude varchar, review_count bigint, is_open...
SELECT city FROM business WHERE name = 'Taj Mahal'
### Instruction: CREATE TABLE table_dev_24 ( "id" int, "active_ocular_disease" bool, "systolic_blood_pressure_sbp" int, "active_infection" bool, "hemoglobin_a1c_hba1c" float, "body_weight" float, "diabetic" string, "seasonal_allergy" bool, "retinal_nerve_disease" bool, "diastolic...
SELECT * FROM table_dev_24 WHERE diabetes = 1 AND hemoglobin_a1c_hba1c < 8.5
### Instruction: CREATE TABLE table_23562 ( "#" real, "Sanskrit" text, "Malayalam name \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02" text, "Tamil name \u0ba4\u0bae\u0bbf\u0bb4\u0bcd" text, "Telugu name \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41" text, "Kannada name \u0c95\u0ca8\u0ccd\u0ca8\u0ca1" text, "W...
SELECT "Malayalam name \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02" FROM table_23562 WHERE "Sanskrit" = 'Uttarāṣāḍha उत्तराषाढा'
### Instruction: CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE venue ( venue...
SELECT DISTINCT paperid FROM paper WHERE title = 'machine networks for one shot learning'
### Instruction: CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE field ( fieldid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE author ( authorid int, authorname varchar ) ...
SELECT DISTINCT paperid FROM paper WHERE year <> 2015
### Instruction: CREATE TABLE customers ( customer_id number, customer_details text ) 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, ...
SELECT customer_details FROM customers EXCEPT SELECT T1.customer_details FROM customers AS T1 JOIN customer_policies AS T2 ON T1.customer_id = T2.customer_id
### Instruction: CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Student (...
SELECT dorm_name, COUNT(*) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.Age > 20 GROUP BY T3.dorm_name
### Instruction: CREATE TABLE table_test_11 ( "id" int, "left_ventricular_ejection_fraction_lvef" int, "systolic_blood_pressure_sbp" int, "tachycardia" int, "bradycardia" int, "renal_disease" bool, "allergy_to_aspirin" bool, "temperature" float, "creatinine_clearance_cl" float, "...
SELECT * FROM table_test_11 WHERE hypertension = 1 OR systolic_blood_pressure_sbp >= 180 OR diastolic_blood_pressure_dbp >= 110
### Instruction: CREATE TABLE customers_policies ( customer_id number, policy_id number, date_opened time, date_closed time ) CREATE TABLE customers ( customer_id number, customer_name text ) CREATE TABLE services ( service_id number, service_name text ) CREATE TABLE available_policie...
SELECT t1.effective_date FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id ORDER BY SUM(t2.settlement_amount) DESC LIMIT 1
### Instruction: CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) 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...
SELECT COUNT(*), T1.dormid FROM Dorm AS T1 JOIN Has_amenity AS T2 ON T1.dormid = T2.dormid WHERE T1.student_capacity > 100 GROUP BY T1.dormid
### Instruction: CREATE TABLE table_train_69 ( "id" int, "systolic_blood_pressure_sbp" int, "language" string, "valvular_dysfunction" bool, "heart_disease" bool, "temperature" float, "sepsis" bool, "heart_rate" int, "lipid_metabolism" bool, "organ_failure" bool, "NOUSE" float...
SELECT * FROM table_train_69 WHERE (CASE WHEN temperature > 37.5 OR temperature < 35.5 OR temperature > 38 OR temperature < 36 THEN 1 ELSE 0 END + CASE WHEN heart_rate > 90 THEN 1 ELSE 0 END + CASE WHEN systolic_blood_pressure_sbp < 100 THEN 1 ELSE 0 END) >= 2
### Instruction: CREATE TABLE table_dev_36 ( "id" int, "gender" string, "prediabetes" bool, "leukopenia" int, "hemoglobin_a1c_hba1c" float, "cd4_count" int, "platelets" int, "hematocrit_hct" float, "fasting_triglycerides" int, "hyperlipidemia" bool, "lymphopenia" int, "fa...
SELECT * FROM table_dev_36 WHERE hyperlipidemia = 1 OR fasting_ldl_cholesterol > 130 OR fasting_triglycerides > 200
### 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 * FROM football_data WHERE season = "2016" AND ftr = "D" AND league = "Premier League"
### Instruction: CREATE TABLE district ( District_ID int, District_name text, Headquartered_City text, City_Population real, City_Area real ) CREATE TABLE store_product ( Store_ID int, Product_ID int ) CREATE TABLE product ( product_id int, product text, dimensions text, dp...
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 ORDER BY Headquartered_City
### Instruction: 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, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Dorm_am...
SELECT dorm_name, COUNT(*) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.Age > 20 GROUP BY T3.dorm_name
### Instruction: CREATE TABLE table_6461 ( "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 COUNT("Mining b") FROM table_6461 WHERE "Manufac turing b" = '16.8' AND "2008 GDP per capita (USD) a" < '4,162'
### 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 date_claim_made, date_claim_settled FROM claims WHERE amount_claimed > (SELECT AVG(amount_claimed) FROM claims)
### 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 Activity ( actid ...
SELECT Rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank ORDER BY Rank
### Instruction: CREATE TABLE table_dev_4 ( "id" int, "hypothyroidism" bool, "serum_bicarbonate" int, "c_peptide_level" float, "autoimmune_disease" bool, "hemoglobin_a1c_hba1c" float, "positive_serum" bool, "inhaled_steroids" bool, "diabetic_ketoacidosis" bool, "creatinine_cleara...
SELECT * FROM table_dev_4 WHERE chronic_inflammatory = 1 OR autoimmune_disease = 1 OR hypothyroidism = 1 OR asthma = 1 AND inhaled_steroids = 1
### Instruction: CREATE TABLE dorm ( dormid number, dorm_name text, student_capacity number, gender text ) CREATE TABLE has_amenity ( dormid number, amenid number ) CREATE TABLE lives_in ( stuid number, dormid number, room_number number ) CREATE TABLE student ( stuid number, ...
SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T2.dormid FROM dorm AS T3 JOIN has_amenity AS T4 ON T3.dormid = T4.dormid JOIN dorm_amenity AS T5 ON T4.amenid = T5.amenid GROUP BY T3.dormid ORDER BY COUNT(*) DESC LIMIT 1)
### Instruction: CREATE TABLE table_203_279 ( id number, "interferometer and observing mode" text, "waveband" text, "limiting magnitude" number, "minimum baseline (m)\n(un-projected)" number, "maximum baseline (m)" number, "approx. no. visibility measurements per year\n(measurements per nigh...
SELECT "interferometer and observing mode" FROM table_203_279 WHERE "limiting magnitude" > (SELECT "limiting magnitude" FROM table_203_279 WHERE "interferometer and observing mode" = 'coast visible') AND "interferometer and observing mode" IN ('chara array', 'coast infrared')
### Instruction: CREATE TABLE district ( District_ID int, District_name text, Headquartered_City text, City_Population real, City_Area real ) CREATE TABLE store ( Store_ID int, Store_Name text, Type text, Area_size real, Number_of_product_category real, Ranking int ) CREATE...
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 ORDER BY COUNT(*)
### Instruction: CREATE TABLE airport ( airport_id number, airport_name text, total_passengers number, %_change_2007 text, international_passengers number, domestic_passengers number, transit_passengers number, aircraft_movements number, freight_metric_tonnes number ) CREATE TABLE a...
SELECT T2.location, T1.aircraft FROM aircraft AS T1 JOIN match AS T2 ON T1.aircraft_id = T2.winning_aircraft
### Instruction: CREATE TABLE Faculty_Participates_in ( FacID INTEGER, actid INTEGER ) 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 VA...
SELECT activity_name, COUNT(*) FROM Activity AS T1 JOIN Faculty_Participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid
### Instruction: CREATE TABLE table_test_5 ( "id" int, "systemic_lupus_erythematosus" bool, "anemia" bool, "gender" string, "pregnancy_or_lactation" bool, "serum_potassium" float, "hemoglobin_a1c_hba1c" float, "heart_disease" bool, "renal_disease" bool, "creatinine_clearance_cl" ...
SELECT * FROM table_test_5 WHERE hemoglobin_a1c_hba1c < 9
### Instruction: CREATE TABLE transactions_lots ( transaction_id number, lot_id number ) CREATE TABLE lots ( lot_id number, investor_id number, lot_details text ) CREATE TABLE purchases ( purchase_transaction_id number, purchase_details text ) CREATE TABLE transactions ( transaction_i...
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 ORDER BY AVG(amount_of_transaction)
### Instruction: CREATE TABLE parking_fines ( council_tax_id number, cmi_cross_ref_id number ) CREATE TABLE benefits_overpayments ( council_tax_id number, cmi_cross_ref_id number ) CREATE TABLE council_tax ( council_tax_id number, cmi_cross_ref_id number ) CREATE TABLE customer_master_index (...
SELECT COUNT(DISTINCT source_system_code) FROM cmi_cross_references
### Instruction: CREATE TABLE match ( round number, location text, country text, date text, fastest_qualifying text, winning_pilot text, winning_aircraft text ) CREATE TABLE pilot ( pilot_id number, name text, age number ) CREATE TABLE airport_aircraft ( id number, airp...
SELECT T2.location, T1.aircraft FROM aircraft AS T1 JOIN match AS T2 ON T1.aircraft_id = T2.winning_aircraft
### Instruction: CREATE TABLE table_2273 ( "-Butadiene" text, "10 4 k /min \u22121 (30 \u00b0C) (\u00b1 1-2%) absolute" text, "10 4 k /min \u22121 (30 \u00b0C) (\u00b1 1-2%) relative" text, "\u0394H \u2021 /kcal mol \u22121" text, "\u0394S \u2021 /cal mol \u22121 K \u22121" text ) -- Using valid S...
SELECT "10 4 k /min \u22121 (30 \u00b0C) (\u00b1 1-2%) absolute" FROM table_2273 WHERE "10 4 k /min \u22121 (30 \u00b0C) (\u00b1 1-2%) relative" = '1.00'
### Instruction: CREATE TABLE statements ( statement_id number, statement_details text ) CREATE TABLE ref_budget_codes ( budget_type_code text, budget_type_description text ) CREATE TABLE documents ( document_id number, document_type_code text, project_id number, document_date time, ...
SELECT document_type_code, document_name, document_description FROM documents WHERE document_name = 'Noel CV' OR document_name = 'King Book'
### Instruction: CREATE TABLE airport_aircraft ( id number, airport_id number, aircraft_id number ) CREATE TABLE match ( round number, location text, country text, date text, fastest_qualifying text, winning_pilot text, winning_aircraft text ) CREATE TABLE airport ( airport...
SELECT international_passengers, domestic_passengers FROM airport WHERE airport_name = "London Heathrow"
### Instruction: CREATE TABLE customers ( customer_id number, customer_name text ) CREATE TABLE first_notification_of_loss ( fnol_id number, customer_id number, policy_id number, service_id number ) CREATE TABLE customers_policies ( customer_id number, policy_id number, date_opened...
SELECT t2.service_name FROM first_notification_of_loss AS t1 JOIN services AS t2 ON t1.service_id = t2.service_id GROUP BY t1.service_id HAVING COUNT(*) > 2
### Instruction: CREATE TABLE table_19408 ( "1890 No game" text, "1891 No game" text, "1892 No game" text, "1893 No game" text, "1894 WSU 10\u20130 Moscow" text, "1895 WSU* 10\u20134 Pullman" text, "1896 No game" text, "1897 No game" text, "1898 No game" text, "1899 WSU* 11\u2013...
SELECT COUNT("1899 WSU* 11\u20130 Pullman") FROM table_19408 WHERE "1894 WSU 10\u20130 Moscow" = '1934 WSU* 19–0 Pullman'
### Instruction: CREATE TABLE electoral_register ( electoral_register_id number, cmi_cross_ref_id number ) CREATE TABLE benefits_overpayments ( council_tax_id number, cmi_cross_ref_id number ) CREATE TABLE cmi_cross_references ( cmi_cross_ref_id number, master_customer_id number, source_sy...
SELECT * FROM customer_master_index ORDER BY cmi_details DESC
### 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 investors ( investor_id number, investor_details text ) CR...
SELECT T1.sales_details, T2.date_of_transaction FROM sales AS T1 JOIN transactions AS T2 ON T1.sales_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction < 3000
### Instruction: CREATE TABLE table_36504 ( "Arabic" text, "English" text, "Maltese" text, "Turkish" text, "Somali" text, "Persian" text, "Urdu" text, "Hindi" text, "Punjabi (India)" text, "Punjabi (Pakistan)" text, "Malayalam" text, "Bangla" text, "Hebrew" text, ...
SELECT "Pashto" FROM table_36504 WHERE "Malayalam" = 'വ്യാഴം vyazham'
### 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 leukopenia = 1 OR anemia = 1 OR hepatic_disease = 1 OR renal_disease = 1 OR malignancy = 1
### Instruction: CREATE TABLE store_district ( Store_ID int, District_ID int ) CREATE TABLE store_product ( Store_ID int, Product_ID int ) CREATE TABLE store ( Store_ID int, Store_Name text, Type text, Area_size real, Number_of_product_category real, Ranking int ) CREATE TABLE...
SELECT District_name, City_Population FROM district WHERE City_Population BETWEEN 200000 AND 2000000 ORDER BY District_name DESC
### Instruction: CREATE TABLE table_204_938 ( id number, "year" number, "edmonton\nhundred" number, "elthorne\nhundred" number, "gore\nhundred" number, "isleworth\nhundred" number, "ossulstone\nhundred\nholborn\ndivision" number, "ossulstone\nhundred\nfinsbury\ndivision" number, "oss...
SELECT "total" FROM table_204_938 WHERE "year" = 1801
### Instruction: CREATE TABLE Video_Games ( GameID INTEGER, GName VARCHAR(40), GType VARCHAR(40) ) CREATE TABLE SportsInfo ( StuID INTEGER, SportName VARCHAR(32), HoursPerWeek INTEGER, GamesPlayed INTEGER, OnScholarship VARCHAR(1) ) CREATE TABLE Plays_Games ( StuID INTEGER, Gam...
SELECT LName, COUNT(LName) FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.OnScholarship = 'Y' GROUP BY LName ORDER BY COUNT(LName) DESC
### 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 FacID, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.FacID
### Instruction: CREATE TABLE table_dev_48 ( "id" int, "gender" string, "systolic_blood_pressure_sbp" int, "hiv_infection" bool, "body_weight" float, "diabetic" string, "active_hepatitis" bool, "diastolic_blood_pressure_dbp" int, "liver_disease" bool, "high_density_lipoprotein_ch...
SELECT * FROM table_dev_48 WHERE (high_density_lipoprotein_cholesterol_hdl_c > 40 AND gender = 'male') OR (high_density_lipoprotein_cholesterol_hdl_c > 50 AND gender = 'female')
### Instruction: CREATE TABLE customers ( customer_id number, customer_details text ) 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 nu...
SELECT payment_id, date_payment_made, amount_payment FROM payments WHERE payment_method_code = 'Visa'
### Instruction: CREATE TABLE projects ( project_id number, project_details text ) CREATE TABLE ref_budget_codes ( budget_type_code text, budget_type_description text ) CREATE TABLE documents ( document_id number, document_type_code text, project_id number, document_date time, docu...
SELECT T1.project_details FROM projects AS T1 JOIN documents AS T2 ON T1.project_id = T2.project_id WHERE T2.document_name = "King Book"
### Instruction: CREATE TABLE table_54440 ( "Party" text, "Results 2004" text, "CSA 5/14/09" text, "Viavoice 5/15/09" text, "Ifop- La Croix 5/15/09" text, "Ipsos 5/16/09" text, "OpinionWay 5/18/09" text, "CSA 5/20/09" text, "Ipsos 5/25/09" text, "TNS-Sofres 5/26/09" text, "Op...
SELECT "TNS-Sofres 5/26/09" FROM table_54440 WHERE "Ipsos 5/25/09" = '1%'
### Instruction: CREATE TABLE product ( product_id int, product text, dimensions text, dpi real, pages_per_minute_color real, max_page_size text, interface text ) CREATE TABLE district ( District_ID int, District_name text, Headquartered_City text, City_Population real, ...
SELECT District_name, City_Population FROM district WHERE City_Population BETWEEN 200000 AND 2000000 ORDER BY District_name
### Instruction: CREATE TABLE SportsInfo ( StuID INTEGER, SportName VARCHAR(32), HoursPerWeek INTEGER, GamesPlayed INTEGER, OnScholarship VARCHAR(1) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, ...
SELECT LName, COUNT(LName) FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.OnScholarship = 'Y' GROUP BY LName ORDER BY LName
### Instruction: CREATE TABLE Restaurant_Type ( ResTypeID INTEGER, ResTypeName VARCHAR(40), ResTypeDescription VARCHAR(100) ) CREATE TABLE Type_Of_Restaurant ( ResID INTEGER, ResTypeID INTEGER ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER...
SELECT LName, COUNT(LName) FROM Student WHERE Major = 600 GROUP BY LName ORDER BY LName
### Instruction: CREATE TABLE tracklists ( albumid number, position number, songid number ) CREATE TABLE band ( id number, firstname text, lastname text ) CREATE TABLE albums ( aid number, title text, year number, label text, type text ) CREATE TABLE performance ( song...
SELECT T4.instrument FROM performance AS T1 JOIN band AS T2 ON T1.bandmate = T2.id JOIN songs AS T3 ON T3.songid = T1.songid JOIN instruments AS T4 ON T4.songid = T3.songid AND T4.bandmateid = T2.id WHERE T2.lastname = "Heilo" AND T3.title = "Badlands"
### 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 Activity ( actid INTEGER, activity_name varchar(25) ) CREATE TABLE Participates_in ( ...
SELECT Rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank
### Instruction: CREATE TABLE Participates_in ( stuid INTEGER, actid INTEGER ) CREATE TABLE Activity ( actid INTEGER, activity_name varchar(25) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor ...
SELECT Rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank
### Instruction: CREATE TABLE table_33324 ( "Country" text, "Area (km\u00b2) 2010" text, "Population 2011" text, "GDP (PPP) ( Intl. $ ) 2011" text, "GDP (PPP) per capita ( Intl. $ ) 2011" text, "Income inequality 1994\u20132011 (latest available)" text, "HDI 2011" text, "FSI 2012" text, ...
SELECT "IEF 2011" FROM table_33324 WHERE "FSI 2012" = '99.2'
### Instruction: CREATE TABLE sampledata15 ( sample_pk number, state text, year text, month text, day text, site text, commod text, source_id text, variety text, origin text, country text, disttype text, commtype text, claim text, quantity number, growst t...
SELECT T1.country FROM sampledata15 AS T1 JOIN resultsdata15 AS T2 ON T1.sample_pk = T2.sample_pk GROUP BY T1.country ORDER BY SUM(T2.concen) 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 "location" FROM table_204_277 WHERE "location" IN ('university of witwatersrand', 'iit guwahati') ORDER BY "x horiz disp (mm)" DESC LIMIT 1
### Instruction: CREATE TABLE photos ( id number, camera_lens_id number, mountain_id number, color text, name text ) CREATE TABLE camera_lens ( id number, brand text, name text, focal_length_mm number, max_aperture number ) CREATE TABLE mountain ( id number, name text, ...
SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Toubkal Atlas' INTERSECT SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.rang...
### Instruction: CREATE TABLE documents_with_expenses ( document_id number, budget_type_code text, document_details text ) CREATE TABLE accounts ( account_id number, statement_id number, account_details text ) CREATE TABLE documents ( document_id number, document_type_code text, pr...
SELECT T1.statement_id, T2.statement_details, T1.account_details FROM accounts AS T1 JOIN statements AS T2 ON T1.statement_id = T2.statement_id
### Instruction: CREATE TABLE transactions_lots ( transaction_id number, lot_id number ) 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 ) ...
SELECT T1.investor_details FROM investors AS T1 JOIN transactions AS T2 ON T1.investor_id = T2.investor_id WHERE T2.share_count > 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 AVG(rating)
### Instruction: CREATE TABLE customers ( customer_id number, customer_name text ) CREATE TABLE claims ( claim_id number, fnol_id number, effective_date time ) CREATE TABLE available_policies ( policy_id number, policy_type_code text, customer_phone text ) CREATE TABLE services ( ...
SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name 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 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 AVG(rating)
### Instruction: CREATE TABLE table_26421 ( "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 MIN("08-09 GP/JGP 2nd") FROM table_26421 WHERE "07-08 GP/JGP best" = '223'
### Instruction: CREATE TABLE table_train_128 ( "id" int, "vascular" bool, "mania" bool, "pulmonary_disease" bool, "cardiac" bool, "stroke" bool, "substance_dependence" bool, "schizophrenia" bool, "cerebrovascular_disease" bool, "hematologic_disease" bool, "adverse_reactions_...
SELECT * FROM table_train_128 WHERE schizophrenia = 1 OR mania = 1 OR major_depression = 1
### Instruction: CREATE TABLE table_45554 ( "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_45554 WHERE "1999" = '2r' AND "1992" = '3r'
### Instruction: CREATE TABLE accounts ( account_id number, customer_id number, account_name text, other_account_details text ) CREATE TABLE financial_transactions ( transaction_id number, previous_transaction_id number, account_id number, card_id number, transaction_type text, ...
SELECT customer_id, COUNT(*) FROM accounts GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1
### Instruction: CREATE TABLE settlements ( settlement_id number, claim_id number, effective_date time, settlement_amount number ) CREATE TABLE claims ( claim_id number, fnol_id number, effective_date time ) CREATE TABLE first_notification_of_loss ( fnol_id number, customer_id numb...
SELECT customer_phone FROM available_policies WHERE policy_type_code = (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1)
### Instruction: CREATE TABLE table_73709 ( "Model" text, "Launch" text, "Model Number" text, "Code name" text, "Fab ( nm )" text, "Bus interface" text, "Memory ( MiB )" text, "Core clock ( MHz )" text, "Memory clock ( MHz )" text, "Config core 1" text, "Pixel ( GP /s)" text,...
SELECT COUNT("Bus width ( bit )") FROM table_73709 WHERE "Bandwidth ( GB /s)" = '25.6' AND "Model Number" = 'Granville Pro'
### Instruction: CREATE TABLE Video_Games ( GameID INTEGER, GName VARCHAR(40), GType VARCHAR(40) ) 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 Sp...
SELECT LName, COUNT(LName) FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.OnScholarship = 'Y' GROUP BY LName ORDER BY COUNT(LName)
### Instruction: CREATE TABLE product_characteristics ( product_id number, characteristic_id number, product_characteristic_value text ) CREATE TABLE ref_characteristic_types ( characteristic_type_code text, characteristic_type_description text ) CREATE TABLE characteristics ( characteristic_i...
SELECT product_category_description FROM ref_product_categories WHERE product_category_code = "Spices"
### Instruction: CREATE TABLE table_75075 ( "Rank" real, "Country/Territory" text, "Nuestra Belleza Latina" real, "1st runner-up" real, "2nd runner-up" real, "3rd runner-up" real, "4th runner-up" real, "5th runner-up" real, "6th runner-up" real, "7th runner-up" real, "8th run...
SELECT SUM("9th runner-up") FROM table_75075 WHERE "5th runner-up" = '2' AND "Top 18/20/24/30" > '17'