instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_26334 ( "Year" real, "Division" real, "League" text, "Regular Season" text, "Playoffs" text, "Open Cup" text, "Avg. Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was the average attendance 789?
SELECT MIN("Year") FROM table_26334 WHERE "Avg. Attendance" = '789'
wikisql
CREATE TABLE cinema ( Cinema_ID int, Name text, Openning_year int, Capacity int, Location text ) CREATE TABLE schedule ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_seaso...
SELECT Openning_year, AVG(Capacity) FROM cinema GROUP BY Openning_year ORDER BY Openning_year DESC
nvbench
CREATE TABLE table_46030 ( "Type" text, "Name" text, "Title" text, "Royal house" text, "From" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the ruler whose rule began in 1924 BC?
SELECT "Name" FROM table_46030 WHERE "From" = '1924 bc'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Government" AND procedures.long_title = "Incision of vessel, abdominal arteries"
mimicsql_data
CREATE TABLE table_name_86 ( year VARCHAR, works_no VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what Year is the Works no. 2040-2049?
SELECT year FROM table_name_86 WHERE works_no = "2040-2049"
sql_create_context
CREATE TABLE table_17257687_1 ( event_2 VARCHAR, event_1 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was event 2 when event 1 was Atlasphere?
SELECT event_2 FROM table_17257687_1 WHERE event_1 = "Atlasphere"
sql_create_context
CREATE TABLE table_name_29 ( home_team VARCHAR, away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which home team played the Away team from Richmond?
SELECT home_team FROM table_name_29 WHERE away_team = "richmond"
sql_create_context
CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name var...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND CIT...
atis
CREATE TABLE department ( dept_name varchar(20), building varchar(15), budget numeric(12,2) ) CREATE TABLE classroom ( building varchar(15), room_number varchar(7), capacity numeric(4,0) ) CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), tot_cred n...
SELECT COUNT(DISTINCT T2.ID), COUNT(DISTINCT T3.ID) FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name
nvbench
CREATE TABLE table_name_34 ( poll_year VARCHAR, third VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT IS THE POLL YEAR WITH A THIRD OF THE TING TINGS?
SELECT poll_year FROM table_name_34 WHERE third = "the ting tings"
sql_create_context
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE jyjgzbb ( BGDH text, BGRQ tim...
SELECT zyjybgb.JYSQJGMC, zyjybgb.JYJGMC FROM zyjybgb WHERE zyjybgb.BGDH = '35069117494' UNION SELECT mzjybgb.JYSQJGMC, mzjybgb.JYJGMC FROM mzjybgb WHERE mzjybgb.BGDH = '35069117494'
css
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following questions for the...
SELECT Price, Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter
nvbench
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.wardid = 1078 AND STRFTIME('%y', patient.unitadmittime) >= '2103'
eicu
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following questions for the...
SELECT T1.Name, MAX(T1.Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY MAX(T1.Price)
nvbench
CREATE TABLE table_14903491_1 ( mens_singles VARCHAR, mixed_doubles VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the mens singles for jeliazko valkov dobrinka peneva
SELECT mens_singles FROM table_14903491_1 WHERE mixed_doubles = "Jeliazko Valkov Dobrinka Peneva"
sql_create_context
CREATE TABLE table_29249 ( "District" text, "Incumbent" text, "Party" text, "Elected" real, "Status" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the district with the incumbent Charlie Norwood?
SELECT "District" FROM table_29249 WHERE "Incumbent" = 'Charlie Norwood'
wikisql
CREATE TABLE table_50628 ( "Team #1" text, "Agg." text, "Team #2" text, "1st leg" text, "2nd leg" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Team #1 had a 1st leg of 78-78?
SELECT "Team #1" FROM table_50628 WHERE "1st leg" = '78-78'
wikisql
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE patients ( row_id number, subject_id num...
SELECT MIN(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'benign neoplasm lg bowel') AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_T...
mimic_iii
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAno...
SELECT * FROM Posts WHERE NOT ClosedDate IS NULL AND Score >= 250 AND ViewCount >= 150000 AND CreationDate BETWEEN '2011-01-01' AND '2011-12-31' LIMIT 100
sede
CREATE TABLE table_204_544 ( id number, "rank" number, "name" text, "nationality" text, "time" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who was the last japanese player to finish ?
SELECT "name" FROM table_204_544 WHERE "nationality" = 'japan' ORDER BY "rank" DESC LIMIT 1
squall
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE jyjgzbb ( BGDH text, BGRQ tim...
SELECT * FROM person_info JOIN hz_info JOIN wdmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE person_info.XM = '陶惜雪' AND hz_info.YLJGDM = '9853107' AND NOT wdmzjzjlb.CYKSMC LIKE '%老年病%' UNION SELECT * FROM person_info J...
css
CREATE TABLE Tourist_Attraction_Features ( Tourist_Attraction_ID INTEGER, Feature_ID INTEGER ) CREATE TABLE Shops ( Shop_ID INTEGER, Shop_Details VARCHAR(255) ) CREATE TABLE Locations ( Location_ID INTEGER, Location_Name VARCHAR(255), Address VARCHAR(255), Other_Details VARCHAR(255) ) ...
SELECT T1.Name, T1.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN Visits AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID ORDER BY T1.Name DESC
nvbench
CREATE TABLE table_name_5 ( foundation VARCHAR, name_in_english VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the foundation for the institution whose name in English is tanjung puteri technical secondary school?
SELECT foundation FROM table_name_5 WHERE name_in_english = "tanjung puteri technical secondary school"
sql_create_context
CREATE TABLE table_56001 ( "Round" real, "Overall" text, "Player" text, "Position" text, "Nationality" text, "Club team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which player had an overall pick of 130?
SELECT "Player" FROM table_56001 WHERE "Overall" = '130'
wikisql
CREATE TABLE table_36227 ( "Date" text, "Race" text, "Race track" text, "Category" text, "Lap length" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Race on July 30, 1950 with a Formula 2 Fia, non-championship?
SELECT "Race" FROM table_36227 WHERE "Category" = 'formula 2 fia, non-championship' AND "Date" = 'july 30, 1950'
wikisql
CREATE TABLE table_69761 ( "Value" real, "Khmer" real, "Word Form" text, "UNGEGN" text, "ALA-LC" text, "Other" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the total value of ?
SELECT SUM("Value") FROM table_69761 WHERE "Word Form" = 'សាមសិប'
wikisql
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE cost ( row_id number, subject_...
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'cl fx reduc-int fix nec') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 433) AND DA...
mimic_iii
CREATE TABLE table_name_72 ( home_team VARCHAR, away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Home team score has an Away team of carlton?
SELECT home_team AS score FROM table_name_72 WHERE away_team = "carlton"
sql_create_context
CREATE TABLE table_train_267 ( "id" int, "pregnancy_or_lactation" bool, "smoking" bool, "allergy_to_nuts" bool, "body_mass_index_bmi" float, "age" float, "NOUSE" float ) -- Using valid SQLite, answer the following questions for the tables provided above. -- known allergy to nuts
SELECT * FROM table_train_267 WHERE allergy_to_nuts = 1
criteria2sql
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, ...
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-92657')) AND NOT vitalperiodic.heartrate IS NUL...
eicu
CREATE TABLE table_24496403_1 ( launched VARCHAR, ship VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was the Carysfort launched?
SELECT launched FROM table_24496403_1 WHERE ship = "Carysfort"
sql_create_context
CREATE TABLE table_23330 ( "(Virtual)" text, "Callsign" text, "Affiliation" text, "Branding" text, "Channel" text, "Programming" text, "Owner" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the name of the branding where the virtual ...
SELECT "Branding" FROM table_23330 WHERE "(Virtual)" = '13.1'
wikisql
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "1418" AND prescriptions.route = "INHALATION"
mimicsql_data
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.discharge_location = "SNF"
mimicsql_data
CREATE TABLE table_66759 ( "Rank" real, "Lane" real, "Name" text, "Nationality" text, "Time" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many lanes had a rank smaller than 4 and a time of 2:01.51?
SELECT COUNT("Lane") FROM table_66759 WHERE "Time" = '2:01.51' AND "Rank" < '4'
wikisql
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE ftxmzjzjlb ( HXPLC number, HZ...
SELECT txmzjzjlb.YLJGDM FROM person_info JOIN hz_info JOIN txmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX WHERE person_info.XM = '朱湛英' UNION SELECT ftxmzjzjlb.YLJGDM FROM person_info JOIN hz_info JOIN ftxmzjzjlb ON person_...
css
CREATE TABLE table_25286976_2 ( august_21_22 VARCHAR, march_27_29 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When 139 is on March 27th to 29th what is August 21st to 22nd?
SELECT august_21_22 FROM table_25286976_2 WHERE march_27_29 = "139"
sql_create_context
CREATE TABLE table_19270 ( "Player" text, "Touchdowns (5 points)" real, "Extra points 1 point" real, "Field goals (5 points)" real, "Safeties (2 points)" real, "Total Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many player with to...
SELECT COUNT("Player") FROM table_19270 WHERE "Total Points" = '75'
wikisql
CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TAB...
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number BETWEEN 500 AND 500 + 100 AND semester.semester IN ('FA', 'WN') AND semester.semester_id = course_of...
advising
CREATE TABLE table_203_664 ( id number, "club" text, "town" text, "founded" number, "nickname" text, "colours" text, "home ground" text, "titles" number, "website" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many titles does f...
SELECT "titles" FROM table_203_664 WHERE "club" = 'fortuna 60'
squall
CREATE TABLE order_items ( order_item_id number, order_id number, product_id number ) CREATE TABLE products ( product_id number, product_type_code text, product_name text, product_price number ) CREATE TABLE product_suppliers ( product_id number, supplier_id number, date_suppli...
SELECT customer_phone FROM customers UNION SELECT supplier_phone FROM suppliers
spider
CREATE TABLE table_26282750_1 ( date_of_ceremony VARCHAR, participants_recipients VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date was the participant/recipient takakazu watanabe?
SELECT date_of_ceremony FROM table_26282750_1 WHERE participants_recipients = "Takakazu Watanabe"
sql_create_context
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE labevents ( row...
SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 90663 AND admissions.dischtime IS NULL) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'phosphate') ORDER BY labevents.charttime LIMIT ...
mimic_iii
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" AND lab.fluid = "Blood"
mimicsql_data
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
SELECT COUNT(*) FROM t_kc21 WHERE MED_SER_ORG_NO = '4076214' AND IN_HOSP_DATE BETWEEN '2007-03-08' AND '2014-07-22' AND CLINIC_TYPE = '购药'
css
CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) CREATE T...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMO...
atis
CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE code_description ( code varchar, descript...
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'MILWAUKEE' AND ground_service.city_code = city.city_code
atis
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE lab ( labid numbe...
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-19622')) AND DATETIME(microlab.culturetakentime) <= DATETIME(...
eicu
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT demographic.admission_type FROM demographic WHERE demographic.name = "Jane Dillard"
mimicsql_data
CREATE TABLE table_31064 ( "Week of" text, "Tournament" text, "Champion" text, "Runner-up" text, "Semifinalists" text, "Quarterfinalists" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which tournament was the champion nick saviano florin seg rc...
SELECT "Tournament" FROM table_31064 WHERE "Champion" = 'Nick Saviano Florin Segărceanu 6–3, 6–4'
wikisql
CREATE TABLE table_name_71 ( pick VARCHAR, name VARCHAR, overall VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What pick did George Rosso get drafted when the overall was less than 296?
SELECT COUNT(pick) FROM table_name_71 WHERE name = "george rosso" AND overall < 296
sql_create_context
CREATE TABLE table_name_83 ( country VARCHAR, hanja VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which country has a city with a Hanja of ?
SELECT country FROM table_name_83 WHERE hanja = "平安北道"
sql_create_context
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
SELECT MED_ORG_DEPT_NM, IN_DIAG_DIS_CD, AVG(PERSON_AGE) FROM t_kc21 WHERE MED_SER_ORG_NO = '9492924' GROUP BY MED_ORG_DEPT_NM, IN_DIAG_DIS_CD
css
CREATE TABLE table_34292 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the game number with a score of 116 138?
SELECT COUNT("Game") FROM table_34292 WHERE "Score" = '116–138'
wikisql
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions...
SELECT prescriptions.drug, prescriptions.formulary_drug_cd FROM prescriptions WHERE prescriptions.subject_id = "76446"
mimicsql_data
CREATE TABLE player_coach ( Player_ID int, Coach_ID int, Starting_year int ) CREATE TABLE coach ( Coach_ID int, Coach_name text, Gender text, Club_ID int, Rank int ) CREATE TABLE match_result ( Rank int, Club_ID int, Gold int, Big_Silver int, Small_Silver int, B...
SELECT Gender, COUNT(Gender) FROM player GROUP BY Gender
nvbench
CREATE TABLE table_28673 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided a...
SELECT "Title" FROM table_28673 WHERE "Production code" = '6AJN08'
wikisql
CREATE TABLE table_name_25 ( partnering VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the partner with a score of 4 6, 7 5, [10 8]?
SELECT partnering FROM table_name_25 WHERE score = "4–6, 7–5, [10–8]"
sql_create_context
CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE time_zone ( time_zone_code t...
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, fare, fare_basis AS FARE_BASIS_0, fare_basis AS FARE_BASIS_1 WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.cit...
atis
CREATE TABLE customer ( cust_id text, cust_name text, acc_type text, acc_bal number, no_of_loans number, credit_score number, branch_id number, state text ) CREATE TABLE bank ( branch_id number, bname text, no_of_customers number, city text, state text ) CREATE TABL...
SELECT SUM(no_of_customers) FROM bank
spider
CREATE TABLE table_79177 ( "Rank" real, "Club" text, "Season" text, "Goals" real, "Apps" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the apps for less than 61 goals and before rank 6?
SELECT SUM("Apps") FROM table_79177 WHERE "Rank" < '6' AND "Goals" < '61'
wikisql
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, "estimated_...
SELECT * FROM table_test_9 WHERE thrombocytopenia = 1 OR plt < 50000
criteria2sql
CREATE TABLE inst ( instid number, name text, country text ) CREATE TABLE authorship ( authid number, instid number, paperid number, authorder number ) CREATE TABLE authors ( authid number, lname text, fname text ) CREATE TABLE papers ( paperid number, title text ) -...
SELECT COUNT(*) FROM papers
spider
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM mzjzjlb JOIN jyjgzbb ON mzjzjlb.YLJGDM = jyjgzbb.jybgb_YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jyjgzbb.jybgb_JZLSH_MZJZJLB WHERE mzjzjlb.JZZDBM = 'N61.918' AND jyjgzbb.JCZBMC = '叶酸'
css
CREATE TABLE table_train_148 ( "id" int, "hemoglobin_a1c_hba1c" float, "renal_disease" bool, "hematocrit_hct" float, "serum_creatinine" float, "albumin" float, "body_mass_index_bmi" float, "NOUSE" float ) -- Using valid SQLite, answer the following questions for the tables provided abo...
SELECT * FROM table_train_148 WHERE body_mass_index_bmi >= 30
criteria2sql
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, ...
SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'single lb in-hosp w/o cs') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 68280 AND admissions.dischti...
mimic_iii
CREATE TABLE table_46114 ( "Model" text, "1998" text, "1999" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text ) -- Using valid SQLite, answer the ...
SELECT "2004" FROM table_46114 WHERE "2003" = '36,026'
wikisql
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT SUM(t_kc22.AMOUNT) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '褚欣合' AND t_kc21.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2005-12-03' AND '2016-10-19' AND t_kc22.MED_INV_ITEM_TYPE = '手术费'
css
CREATE TABLE table_name_8 ( pick__number VARCHAR, position VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What numbered pick was dominic picard, ol, selected?
SELECT pick__number FROM table_name_8 WHERE position = "ol" AND player = "dominic picard"
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2195" AND procedures.short_title = "Pulsation balloon implan"
mimicsql_data
CREATE TABLE table_name_86 ( finalist VARCHAR, winner_and_score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Finalist has a Winner and score of boris becker 7 6(3), 6 3, 3 6, 6 3?
SELECT finalist FROM table_name_86 WHERE winner_and_score = "boris becker 7–6(3), 6–3, 3–6, 6–3"
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2122.0" AND prescriptions.formulary_drug_cd = "LINEBASE"
mimicsql_data
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "1837" AND lab.itemid = "51447"
mimicsql_data
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND lab.itemid = "51275"
mimicsql_data
CREATE TABLE table_56147 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the 1st leg when team 1 is Chelsea?
SELECT "1st leg" FROM table_56147 WHERE "Team 1" = 'chelsea'
wikisql
CREATE TABLE table_name_22 ( place INTEGER, points VARCHAR, draw VARCHAR, english_translation VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total ranking when there are less than 16 draws, less than 1 point, and the English translation i...
SELECT SUM(place) FROM table_name_22 WHERE draw < 16 AND english_translation = "in love with you" AND points < 1
sql_create_context
CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, ...
SELECT DISTINCT flight.flight_id FROM airport, airport_service, city, flight WHERE ((airport.airport_code = 'ORD' AND flight.departure_time > 718 AND flight.to_airport = airport.airport_code) AND city.city_code = airport_service.city_code AND city.city_name = 'CINCINNATI' AND flight.from_airport = airport_service.airpo...
atis
CREATE TABLE table_name_18 ( winner VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who won the race on wednesday, august 27?
SELECT winner FROM table_name_18 WHERE date = "wednesday, august 27"
sql_create_context
CREATE TABLE table_name_83 ( no_4 VARCHAR, no_5 VARCHAR, no_9 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the No. 4 name when Madison was No. 5 and Abigail was No. 9?
SELECT no_4 FROM table_name_83 WHERE no_5 = "madison" AND no_9 = "abigail"
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND diagnoses.short_title = "Sec neuroend tumor-liver"
mimicsql_data
CREATE TABLE region ( Region_ID int, Region_name text, Date text, Label text, Format text, Catalogue text ) CREATE TABLE party ( Party_ID int, Minister text, Took_office text, Left_office text, Region_ID int, Party_name text ) CREATE TABLE member ( Member_ID int, ...
SELECT Minister, COUNT(Minister) FROM party GROUP BY Minister ORDER BY Minister
nvbench
CREATE TABLE table_name_66 ( date VARCHAR, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On what date was the Essendon home match?
SELECT date FROM table_name_66 WHERE home_team = "essendon"
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "DIVORCED" AND diagnoses.short_title = "Abrasion trunk"
mimicsql_data
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND procedures.short_title = "Venous cath NEC"
mimicsql_data
CREATE TABLE table_31557 ( "Year" real, "Tournament" text, "Venue" text, "Result" text, "Extra" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Tournament did he place 12th in?
SELECT "Tournament" FROM table_31557 WHERE "Result" = '12th'
wikisql
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-87465') AND patient.unitdischargetime IS NULL) AND intakeoutput.ce...
eicu
CREATE TABLE table_61412 ( "Letter" text, "American" text, "British" text, "Australian" text, "Examples" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the British letter if American is ?
SELECT "British" FROM table_61412 WHERE "American" = 'ə'
wikisql
CREATE TABLE table_29785324_5 ( district VARCHAR, constituency_no VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What district has 213 constituents?
SELECT COUNT(district) FROM table_29785324_5 WHERE constituency_no = 213
sql_create_context
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "481" AND prescriptions.route = "PB"
mimicsql_data
CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE Comments ( Id number, PostId number, Score numb...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE LOWER('%##CountryName##%') AND Reputation < '##Reputation##' ORDER BY Reputation DESC
sede
CREATE TABLE table_14211 ( "Title" text, "Series" text, "Director" text, "Production Number" text, "Release date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Series of the Filmography by Directory Friz Freleng?
SELECT "Series" FROM table_14211 WHERE "Director" = 'friz freleng'
wikisql
CREATE TABLE Has_Allergy ( StuID INTEGER, Allergy VARCHAR(20) ) CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), AllergyType VARCHAR(20) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER...
SELECT city_code, COUNT(*) FROM Student GROUP BY city_code ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
SELECT All_Road, All_Games_Percent FROM basketball_match ORDER BY All_Road
nvbench
CREATE TABLE table_name_46 ( party VARCHAR, governments VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which party has 24 governments?
SELECT party FROM table_name_46 WHERE governments = "24"
sql_create_context
CREATE TABLE table_45090 ( "Position" real, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the ...
SELECT MAX("Goals for") FROM table_45090 WHERE "Position" > '8' AND "Losses" = '12' AND "Played" < '30'
wikisql
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE compartment_cla...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight WHERE ((flight.from_airport = AIRPORT_SERVICE_0.airport_code AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code A...
atis
CREATE TABLE zyjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, ...
SELECT zyjybgb.BGRGH, zyjybgb.BGRXM FROM zyjybgb WHERE zyjybgb.JZLSH = '04623192773' GROUP BY zyjybgb.BGRGH HAVING COUNT(*) > 6 UNION SELECT mzjybgb.BGRGH, mzjybgb.BGRXM FROM mzjybgb WHERE mzjybgb.JZLSH = '04623192773' GROUP BY mzjybgb.BGRGH HAVING COUNT(*) > 6
css
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.days_stay > "6"
mimicsql_data
CREATE TABLE table_39575 ( "Score" text, "Opposition" text, "Venue" text, "City" text, "Year" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which venue had a score of 734-5d?
SELECT "Venue" FROM table_39575 WHERE "Score" = '734-5d'
wikisql
CREATE TABLE table_11274401_2 ( rank___number_ VARCHAR, viewers__m_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How did the episode rank that had 2.65 million viewers?
SELECT rank___number_ FROM table_11274401_2 WHERE viewers__m_ = "2.65"
sql_create_context