instruction
stringlengths
212
6.3k
output
stringlengths
6
2.03k
### Instruction: CREATE TABLE table_train_180 ( "id" int, "gender" string, "pregnancy_or_lactation" bool, "systolic_blood_pressure_sbp" int, "hemoglobin_a1c_hba1c" float, "diabetic" string, "post_load_glucose" int, "diastolic_blood_pressure_dbp" int, "impaired_glucose_tolerance" bool...
SELECT * FROM table_train_180 WHERE fasting_glucose >= 100 AND fasting_glucose <= 125 OR impaired_glucose_tolerance = 1 OR (post_load_glucose >= 140 AND post_load_glucose <= 199) OR impaired_glucose_tolerance = 1
### Instruction: CREATE TABLE accounts ( account_id number, customer_id number, account_name text, other_account_details text ) CREATE TABLE customers ( customer_id number, customer_first_name text, customer_last_name text, customer_address text, customer_phone text, customer_em...
SELECT COUNT(*) FROM customers_cards AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Blanche" AND T2.customer_last_name = "Huels" AND T1.card_type_code = "Credit"
### Instruction: CREATE TABLE business ( bid int, business_id varchar, name varchar, full_address varchar, city varchar, latitude varchar, longitude varchar, review_count bigint, is_open tinyint, rating float, state varchar ) CREATE TABLE checkin ( cid int, business_...
SELECT user.name FROM review, user WHERE user.user_id = review.user_id GROUP BY user.name ORDER BY COUNT(DISTINCT (review.text)) DESC LIMIT 1
### Instruction: CREATE TABLE catalogs ( catalog_id number, catalog_name text, catalog_publisher text, date_of_publication time, date_of_latest_revision time ) CREATE TABLE catalog_contents_additional_attributes ( catalog_entry_id number, catalog_level_number number, attribute_id number...
SELECT DISTINCT (catalog_publisher) FROM catalogs WHERE catalog_publisher LIKE "%Murray%"
### Instruction: CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE paper ( paper...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'Luke S Zettlemoyer' AND writes.authorid = author.authorid
### Instruction: CREATE TABLE table_train_137 ( "id" int, "hbv" bool, "systolic_blood_pressure_sbp" int, "hemoglobin_a1c_hba1c" float, "substance_dependence" bool, "hcv" bool, "schizophrenia" bool, "neutrophil_count" int, "renal_disease" bool, "creatinine_clearance_cl" float, ...
SELECT * FROM table_train_137 WHERE alcohol_abuse = 1 OR substance_dependence = 1 OR substance_dependence = 1
### Instruction: CREATE TABLE checkin ( cid int, business_id varchar, count int, day varchar ) 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, ...
SELECT COUNT(DISTINCT (tip.text)) FROM tip, user WHERE user.name = 'Michelle' AND user.user_id = tip.user_id
### Instruction: CREATE TABLE table_203_827 ( id number, "name" 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 "name" FROM table_203_827 WHERE id = (SELECT id FROM table_203_827 WHERE "name" = 'australian open') + 1
### Instruction: CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE writes ( ...
SELECT DISTINCT COUNT(paper.paperid) FROM paper, venue WHERE venue.venueid = paper.venueid AND venue.venuename = 'emnlp'
### Instruction: CREATE TABLE table_test_21 ( "id" int, "gender" string, "systolic_blood_pressure_sbp" int, "tachycardia" int, "body_weight" float, "renal_disease" bool, "anaemia" bool, "creatinine_clearance_cl" float, "estimated_glomerular_filtration_rate_egfr" int, "cardiogenic...
SELECT * FROM table_test_21 WHERE body_weight >= 50 AND body_weight <= 140
### Instruction: CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) 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 r...
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 ORDER BY T4.Name
### Instruction: CREATE TABLE match ( Round real, Location text, Country text, Date text, Fastest_Qualifying text, Winning_Pilot text, Winning_Aircraft text ) CREATE TABLE airport_aircraft ( ID int, Airport_ID int, Aircraft_ID int ) CREATE TABLE airport ( Airport_ID int, ...
SELECT Description, COUNT(Description) FROM aircraft GROUP BY Description ORDER BY COUNT(Description)
### Instruction: CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) 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 r...
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 ORDER BY T4.Name DESC
### Instruction: CREATE TABLE customers ( customer_id number, payment_method text, customer_name text, date_became_customer time, other_customer_details text ) CREATE TABLE products ( product_id number, product_details text ) CREATE TABLE customer_contact_channels ( customer_id number,...
SELECT AVG(order_quantity) FROM order_items
### 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 ref_product_categories ( product_c...
SELECT COUNT(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN characteristics AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "laurel"
### 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 disorder = 1 AND immunological_dysfunction = 1
### Instruction: CREATE TABLE department ( dno number, division text, dname text, room text, building text, dphone number ) CREATE TABLE course ( cid text, cname text, credits number, instructor number, days text, hours text, dno number ) CREATE TABLE gradeconversio...
SELECT fname FROM student WHERE NOT stuid IN (SELECT stuid FROM enrolled_in)
### Instruction: CREATE TABLE table_train_27 ( "id" int, "bone_marrow_transplant" bool, "antimicrobial_therapy" bool, "immune_suppression" bool, "hiv_infection" bool, "autoimmune_disease" bool, "hepatitis_b_infection" bool, "renal_disease" bool, "total_parenteral_nutrition" bool, ...
SELECT * FROM table_train_27 WHERE invasive_candida_infection = 1 OR (CASE WHEN total_parenteral_nutrition = 1 THEN 1 ELSE 0 END + CASE WHEN surgery = 1 THEN 1 ELSE 0 END + CASE WHEN antimicrobial_therapy = 1 THEN 1 ELSE 0 END + CASE WHEN renal_disease = 1 THEN 1 ELSE 0 END) >= 1
### Instruction: 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, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Dorm_amenity ( amenid IN...
SELECT dorm_name, AVG(T1.Age) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name ORDER BY AVG(T1.Age)
### Instruction: CREATE TABLE tip ( tip_id int, business_id varchar, text longtext, user_id varchar, likes int, year int, month varchar ) CREATE TABLE checkin ( cid int, business_id varchar, count int, day varchar ) CREATE TABLE neighborhood ( id int, business_id va...
SELECT COUNT(DISTINCT (business_id)) FROM business WHERE city = 'Dallas' AND name = 'Starbucks' AND state = 'Texas'
### Instruction: CREATE TABLE dept_locations ( Dnumber INTEGER, Dlocation TEXT ) CREATE TABLE dependent ( Essn INTEGER, Dependent_name TEXT, Sex TEXT, Bdate TEXT, Relationship TEXT ) CREATE TABLE works_on ( Essn INTEGER, Pno INTEGER, Hours REAL ) CREATE TABLE employee ( Fn...
SELECT Sex, COUNT(*) FROM employee WHERE Salary < 50000 GROUP BY Sex ORDER BY Sex
### Instruction: CREATE TABLE departments ( department_id number, department_name text, manager_id number, location_id number ) CREATE TABLE jobs ( job_id text, job_title text, min_salary number, max_salary number ) CREATE TABLE regions ( region_id number, region_name text ) C...
SELECT MIN(salary), department_id FROM employees GROUP BY department_id
### Instruction: CREATE TABLE Purchases ( purchase_transaction_id INTEGER, purchase_details VARCHAR(255) ) CREATE TABLE Transactions ( transaction_id INTEGER, investor_id INTEGER, transaction_type_code VARCHAR(10), date_of_transaction DATETIME, amount_of_transaction DECIMAL(19,4), share...
SELECT transaction_type_code, AVG(amount_of_transaction) FROM Transactions GROUP BY transaction_type_code
### Instruction: CREATE TABLE product_characteristics ( product_id number, characteristic_id number, product_characteristic_value text ) CREATE TABLE characteristics ( characteristic_id number, characteristic_type_code text, characteristic_data_type text, characteristic_name text, other...
SELECT COUNT(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN characteristics AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "flax"
### Instruction: CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numcit...
SELECT DISTINCT COUNT(DISTINCT writes.paperid) FROM author, writes WHERE author.authorname = 'Andrew King' AND writes.authorid = author.authorid
### Instruction: CREATE TABLE locations ( location_id number, street_address text, postal_code text, city text, state_province text, country_id text ) CREATE TABLE countries ( country_id text, country_name text, region_id number ) CREATE TABLE departments ( department_id number...
SELECT country_id, COUNT(*) FROM locations GROUP BY country_id
### Instruction: CREATE TABLE table_dev_47 ( "id" int, "gender" string, "gestational_diabetes" bool, "systolic_blood_pressure_sbp" int, "leukopenia" int, "hemoglobin_a1c_hba1c" float, "cd4_count" int, "platelets" int, "diabetic" string, "elevated_blood_pressure" bool, "diasto...
SELECT * FROM table_dev_47 WHERE (serum_creatinine > 1.3 AND gender = 'female') OR (serum_creatinine > 1.5 AND gender = 'male')
### Instruction: CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE field ( fieldid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'daniel a. epstein' AND writes.authorid = author.authorid
### Instruction: 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, other_card_details text ) CREATE TABLE financial_transactions ( transaction_id number, previous_transaction_id number,...
SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM accounts AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = "162"
### 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 ABS("edmonton\nhundred" - "elthorne\nhundred") FROM table_204_938 WHERE "year" = 1801
### Instruction: CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE keyphrase ( keyphraseid i...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'adam chlipala' AND writes.authorid = author.authorid
### Instruction: CREATE TABLE table_dev_19 ( "id" int, "glucagon_stimulated_c_peptide" float, "c_peptide_level" float, "hemoglobin_a1c_hba1c" float, "diabetic" string, "hyperlipidemia" bool, "creatinine_clearance_cl" float, "total_cholesterol" int, "stimulated_c_peptide" float, "...
SELECT * FROM table_dev_19 WHERE insulin_requirement > 100 AND hemoglobin_a1c_hba1c > 9.5
### Instruction: CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE writes ( paperid int, ...
SELECT DISTINCT paper.paperid FROM paper, venue WHERE venue.venueid = paper.venueid AND venue.venuename = 'NIPS'
### Instruction: 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 Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEG...
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 ORDER BY COUNT(Fname)
### Instruction: CREATE TABLE employees ( employee_id number, first_name text, last_name text, email text, phone_number text, hire_date time, job_id text, salary number, commission_pct number, manager_id number, department_id number ) CREATE TABLE regions ( region_id num...
SELECT * FROM employees WHERE department_id = "null"
### Instruction: 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_product_details text ) CREATE TABLE ref_product_categories ( product_cat...
SELECT COUNT(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN characteristics AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t3.characteristic_name = "hot"
### Instruction: 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, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Dorm ( dormid INTEGER, ...
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 ORDER BY COUNT(*) DESC
### Instruction: CREATE TABLE Investors ( investor_id INTEGER, Investor_details VARCHAR(255) ) CREATE TABLE Purchases ( purchase_transaction_id INTEGER, purchase_details VARCHAR(255) ) CREATE TABLE Transactions_Lots ( transaction_id INTEGER, lot_id INTEGER ) CREATE TABLE Sales ( sales_tra...
SELECT investor_id, COUNT(*) FROM Transactions GROUP BY investor_id
### 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 artist ( artist_name var...
SELECT genre_is, MIN(T2.rating) FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY genre_is ORDER BY T2.genre_is
### Instruction: CREATE TABLE catalog_contents ( catalog_entry_id number, catalog_level_number number, parent_entry_id number, previous_entry_id number, next_entry_id number, catalog_entry_name text, product_stock_number text, price_in_dollars number, price_in_euros number, price...
SELECT catalog_entry_name FROM catalog_contents ORDER BY height DESC LIMIT 1
### Instruction: CREATE TABLE table_test_24 ( "id" int, "history_of_bleeding_diathesis" bool, "bleeding" int, "systolic_blood_pressure_sbp" int, "hemoglobin_a1c_hba1c" float, "blood_draw" bool, "renal_disease" bool, "allergy_to_aspirin" bool, "allergy_to_clopidogrel" bool, "cardi...
SELECT * FROM table_test_24 WHERE platelet_count < 100000 AND blood_draw = 1
### Instruction: CREATE TABLE table_29329 ( "Greek national account" text, "1970" text, "1980" text, "1990" text, "1995" text, "1996" text, "1997" text, "1998" text, "1999" text, "2000" text, "2001 1" text, "2002" text, "2003" text, "2004" text, "2005" text, ...
SELECT "2002" FROM table_29329 WHERE "2009" = '54.0'
### Instruction: CREATE TABLE table_18914 ( "Cost" text, "2400 kWh/kWp\u2022y" text, "2200 kWh/kWp\u2022y" text, "2000 kWh/kWp\u2022y" text, "1800 kWh/kWp\u2022y" text, "1600 kWh/kWp\u2022y" text, "1400 kWh/kWp\u2022y" text, "1200 kWh/kWp\u2022y" text, "1000 kWh/kWp\u2022y" text, ...
SELECT "2400 kWh/kWp\u2022y" FROM table_18914 WHERE "1800 kWh/kWp\u2022y" = '16.7'
### Instruction: CREATE TABLE customers ( customer_id number, customer_name text, customer_details text ) CREATE TABLE products ( product_id number, product_name text, product_details text ) CREATE TABLE order_items ( order_item_id number, product_id number, order_id number, or...
SELECT order_id FROM shipments WHERE shipment_date > "2000-01-01"
### Instruction: CREATE TABLE Ref_Transaction_Types ( transaction_type_code VARCHAR(10), transaction_type_description VARCHAR(80) ) CREATE TABLE Transactions ( transaction_id INTEGER, investor_id INTEGER, transaction_type_code VARCHAR(10), date_of_transaction DATETIME, amount_of_transaction...
SELECT date_of_transaction, SUM(share_count) FROM Transactions
### Instruction: CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE author ( authorid in...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'hal perkins' AND writes.authorid = author.authorid
### Instruction: CREATE TABLE airport_aircraft ( ID int, Airport_ID int, Aircraft_ID int ) CREATE TABLE airport ( Airport_ID int, Airport_Name text, Total_Passengers real, %_Change_2007 text, International_Passengers real, Domestic_Passengers real, Transit_Passengers real, A...
SELECT Description, COUNT(Description) FROM aircraft GROUP BY Description ORDER BY Description
### Instruction: CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) 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), Majo...
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 ORDER BY dorm_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 customers ( customer_id number, customer_details text ) CREATE TA...
SELECT T1.customer_details, T1.customer_id FROM customers AS T1 JOIN customer_policies AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) > 1
### Instruction: CREATE TABLE Investors ( investor_id INTEGER, Investor_details VARCHAR(255) ) CREATE TABLE Transactions_Lots ( transaction_id INTEGER, lot_id INTEGER ) CREATE TABLE Transactions ( transaction_id INTEGER, investor_id INTEGER, transaction_type_code VARCHAR(10), date_of_t...
SELECT investor_id, COUNT(*) FROM Transactions GROUP BY investor_id
### Instruction: CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number 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 TABL...
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 ORDER BY COUNT(Fname) DESC
### Instruction: CREATE TABLE table_67534 ( "Country" text, "2012" real, "2011" real, "2010" real, "2009" real, "2008" real, "2007" real, "2006" real, "2005" real, "2004" real, "2003" real, "2002" real, "2001" real, "2000" real, "1999" real, "1998" real, ...
SELECT SUM("2009") FROM table_67534 WHERE "1989" < '0'
### Instruction: CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE dataset ( dataseti...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'Adam B Smith' AND writes.authorid = author.authorid
### Instruction: CREATE TABLE Ref_Transaction_Types ( transaction_type_code VARCHAR(10), transaction_type_description VARCHAR(80) ) CREATE TABLE Investors ( investor_id INTEGER, Investor_details VARCHAR(255) ) CREATE TABLE Lots ( lot_id INTEGER, investor_id INTEGER, lot_details VARCHAR(255...
SELECT date_of_transaction, AVG(share_count) FROM Transactions
### Instruction: CREATE TABLE table_29328 ( "Greek national account" text, "1970" text, "1980" text, "1990" text, "1995" text, "1996" text, "1997" text, "1998" text, "1999" text, "2000" text, "2001 1" text, "2002" text, "2003" text, "2004" text, "2005" text, ...
SELECT "2006" FROM table_29328 WHERE "1997" = '6.8'
### 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 Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), ...
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 ORDER BY Fname DESC
### Instruction: CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE paperfield ( fieldid int...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'Dan Suciu' AND writes.authorid = author.authorid
### Instruction: CREATE TABLE department ( dno number, division text, dname text, room text, building text, dphone number ) CREATE TABLE enrolled_in ( stuid number, cid text, grade text ) CREATE TABLE gradeconversion ( lettergrade text, gradepoint number ) CREATE TABLE fac...
SELECT DISTINCT fname FROM student WHERE fname LIKE '%a%'
### Instruction: CREATE TABLE course_authors_and_tutors ( author_id number, author_tutor_atb text, login_name text, password text, personal_name text, middle_name text, family_name text, gender_mf text, address_line_1 text ) CREATE TABLE student_tests_taken ( registration_id num...
SELECT subject_name FROM subjects
### Instruction: CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE keyphrase ( keyphraseid i...
SELECT DISTINCT writes.authorid FROM paper, writes WHERE paper.year = 2015 AND writes.paperid = paper.paperid
### 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 Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABL...
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 ORDER BY COUNT(*)
### Instruction: CREATE TABLE table_75073 ( "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 COUNT("3rd runner-up") FROM table_75073 WHERE "10th runner-up" = '0' AND "8th runner-up" < '1' AND "7th runner-up" = '0' AND "Rank" > '12'
### Instruction: CREATE TABLE table_29324 ( "Greek national account" text, "1970" text, "1980" text, "1990" text, "1995" text, "1996" text, "1997" text, "1998" text, "1999" text, "2000" text, "2001 1" text, "2002" text, "2003" text, "2004" text, "2005" text, ...
SELECT "2003" FROM table_29324 WHERE "1999" = '2.1'
### Instruction: CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE paperdataset ( paperi...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'stefan savage' AND writes.authorid = author.authorid
### Instruction: CREATE TABLE order_items ( order_id number, product_id number, order_quantity text ) CREATE TABLE customer_contact_channels ( customer_id number, channel_code text, active_from_date time, active_to_date time, contact_number text ) CREATE TABLE customer_orders ( ord...
SELECT DISTINCT product_details FROM products
### Instruction: CREATE TABLE field ( fieldid int ) CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE venue ( venueid int, venuename varchar ) CREA...
SELECT DISTINCT paper.paperid FROM paper, venue WHERE venue.venueid = paper.venueid AND venue.venuename = 'neural networks'
### 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 dorm_name, AVG(T1.Age) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name ORDER BY AVG(T1.Age)
### Instruction: CREATE TABLE customer_contact_channels ( customer_id number, channel_code text, active_from_date time, active_to_date time, contact_number text ) CREATE TABLE customers ( customer_id number, payment_method text, customer_name text, date_became_customer time, oth...
SELECT DISTINCT payment_method FROM customers
### Instruction: CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Adviso...
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 ORDER BY COUNT(Fname) DESC
### Instruction: CREATE TABLE claims ( claim_id number, fnol_id number, effective_date time ) CREATE TABLE services ( service_id number, service_name text ) CREATE TABLE customers_policies ( customer_id number, policy_id number, date_opened time, date_closed time ) CREATE TABLE se...
SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = "Dayana Robel"
### Instruction: CREATE TABLE invoices ( invoice_number number, invoice_date time, invoice_details text ) CREATE TABLE orders ( order_id number, customer_id number, order_status text, date_order_placed time, order_details text ) CREATE TABLE order_items ( order_item_id number, ...
SELECT order_id FROM shipments WHERE shipment_tracking_number = "3452"
### Instruction: CREATE TABLE staff ( staff_id number, gender text, first_name text, last_name text, email_address text, phone_number text ) CREATE TABLE products ( product_id number, parent_product_id number, product_category_code text, date_product_first_available time, da...
SELECT product_name, product_category_code FROM products ORDER BY product_price DESC LIMIT 1
### Instruction: CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numc...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'steve seitz' AND writes.authorid = author.authorid
### Instruction: CREATE TABLE customer_contact_channels ( customer_id number, channel_code text, active_from_date time, active_to_date time, contact_number text ) CREATE TABLE customer_addresses ( customer_id number, address_id number, date_address_from time, address_type text, ...
SELECT DISTINCT city FROM addresses
### Instruction: CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE write...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'mayank goel' AND writes.authorid = author.authorid
### Instruction: CREATE TABLE field ( fieldid int ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE dataset ( datasetid int, dataset...
SELECT DISTINCT paper.paperid FROM paper, venue WHERE venue.venueid = paper.venueid AND venue.venuename = 'Brain research'
### Instruction: CREATE TABLE staff ( staff_id number, gender text, first_name text, last_name text, email_address text, phone_number text ) CREATE TABLE products ( product_id number, parent_product_id number, product_category_code text, date_product_first_available time, da...
SELECT last_name FROM staff WHERE email_address LIKE "%wrau%"
### 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 renal_disease = 1 OR creatinine_clearance_cl > 250
### 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 hypertension = 1
### Instruction: CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12),...
SELECT dorm_name, AVG(T1.Age) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name ORDER BY dorm_name
### Instruction: CREATE TABLE ref_characteristic_types ( characteristic_type_code text, characteristic_type_description text ) CREATE TABLE characteristics ( characteristic_id number, characteristic_type_code text, characteristic_data_type text, characteristic_name text, other_characteristi...
SELECT t1.color_code, t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = "chervil"
### Instruction: CREATE TABLE table_test_21 ( "id" int, "gender" string, "systolic_blood_pressure_sbp" int, "tachycardia" int, "body_weight" float, "renal_disease" bool, "anaemia" bool, "creatinine_clearance_cl" float, "estimated_glomerular_filtration_rate_egfr" int, "cardiogenic...
SELECT * FROM table_test_21 WHERE age >= 30 AND age <= 90 AND (gender = 'male' OR gender = 'female')
### Instruction: CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Student (...
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 ORDER BY Fname
### Instruction: CREATE TABLE table_77336 ( "C/W 15+" real, "Oblast\\Age" text, "15 to 17" real, "18 to 19" real, "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("55 to 59") FROM table_77336 WHERE "C/W 15+" > '2,385' AND "30 to 34" = '2,483' AND "35 to 39" > '3,315'
### Instruction: CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE member_of ( facid number, dno number, appt_type text ) CREATE TABLE minor_in ( stuid number, dno number ) ...
SELECT dphone FROM department WHERE room = 268
### Instruction: CREATE TABLE member ( member_id number, card_number text, name text, hometown text, level number ) CREATE TABLE branch ( branch_id number, name text, open_year text, address_road text, city text, membership_amount text ) CREATE TABLE membership_register_bra...
SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.hometown = 'Louisville , Kentucky' INTERSECT SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member ...
### Instruction: CREATE TABLE Services ( Service_ID INTEGER, Service_name VARCHAR(40) ) CREATE TABLE Customers_Policies ( Customer_ID INTEGER, Policy_ID INTEGER, Date_Opened DATE, Date_Closed DATE ) CREATE TABLE First_Notification_of_Loss ( FNOL_ID INTEGER, Customer_ID INTEGER, Pol...
SELECT Customer_name, Customer_ID FROM Customers ORDER BY Customer_ID
### Instruction: CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE paperkeyphrase ( ...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'sarah' AND writes.authorid = author.authorid
### Instruction: 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, Room VARCHAR(5), Building VARCHAR(13) ) CREATE TABLE Faculty_Participates_...
SELECT activity_name, COUNT(*) FROM Activity AS T1 JOIN Faculty_Participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid ORDER BY COUNT(*)
### Instruction: 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 VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advis...
SELECT activity_name, COUNT(*) FROM Activity AS T1 JOIN Faculty_Participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid ORDER BY activity_name DESC
### Instruction: CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numcitin...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'torlak' AND writes.authorid = author.authorid
### 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 cardiac = 1 OR pulmonary_disease = 1 OR vascular = 1 OR metabolic = 1 OR hematologic_disease = 1
### Instruction: CREATE TABLE table_test_27 ( "id" int, "anemia" bool, "bleeding" int, "left_ventricular_ejection_fraction_lvef" int, "intra_aortic_balloon_pump_iabp" bool, "systolic_blood_pressure_sbp" int, "left_main_stem_coronary_artery_stenosis" int, "haemoglobin" float, "renal_d...
SELECT * FROM table_test_27 WHERE renal_disease = 1 OR estimated_glomerular_filtration_rate_egfr < 25
### Instruction: CREATE TABLE department ( dno number, division text, dname text, room text, building text, dphone number ) CREATE TABLE minor_in ( stuid number, dno number ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, majo...
SELECT rank FROM faculty GROUP BY rank ORDER BY COUNT(*) LIMIT 1
### Instruction: CREATE TABLE products ( product_id number, product_details text ) CREATE TABLE customer_contact_channels ( customer_id number, channel_code text, active_from_date time, active_to_date time, contact_number text ) CREATE TABLE addresses ( address_id number, address_c...
SELECT COUNT(*) FROM customers
### Instruction: CREATE TABLE table_79328 ( "Country" text, "Human development (2012) HDI" real, "GDP (PPP) (2012) US$ per capita" text, "Real GDP growth (2011) %" text, "Income inequality (2011) Gini" text, "Poverty (2009) HPI-1 %" real, "Extreme poverty (2011) <1.25 US$ %" text, "Liter...
SELECT COUNT("Poverty (2009) HPI-1 %") FROM table_79328 WHERE "GDP (PPP) (2012) US$ per capita" = '11,284'
### Instruction: CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE paperfi...
SELECT DISTINCT paperid FROM paper WHERE title = 'impact of cellphone towers on birds'
### Instruction: CREATE TABLE pilot ( Pilot_Id int(11), Name varchar(50), Age int(11) ) 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...
SELECT Description, COUNT(Description) FROM aircraft GROUP BY Description
### Instruction: CREATE TABLE member_of ( facid number, dno number, appt_type text ) CREATE TABLE faculty ( facid number, lname text, fname text, rank text, sex text, phone number, room text, building text ) CREATE TABLE course ( cid text, cname text, credits nu...
SELECT COUNT(*) FROM course WHERE credits > 2
### Instruction: CREATE TABLE category ( id int, business_id varchar, category_name varchar ) CREATE TABLE checkin ( cid int, business_id varchar, count int, day varchar ) CREATE TABLE business ( bid int, business_id varchar, name varchar, full_address varchar, city var...
SELECT COUNT(DISTINCT (city)) FROM business WHERE name = 'Panda Express'