instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), ...
SELECT HIRE_DATE, SALARY FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY HIRE_DATE
nvbench
CREATE TABLE table_35506 ( "County" text, "Population" real, "Per capita income" text, "Median household income" text, "Median family income" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the median income for a family whose per capita inco...
SELECT "Median family income" FROM table_35506 WHERE "Per capita income" = '$18,296'
wikisql
CREATE TABLE table_63799 ( "Draw" real, "Televote Points" text, "Jury Points" text, "Total" text, "Final Points" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Televote Points had a Final Points score of 2?
SELECT "Televote Points" FROM table_63799 WHERE "Final Points" = '2'
wikisql
CREATE TABLE table_78720 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Score, when Date is 'June 8, 1996'?
SELECT "Score" FROM table_78720 WHERE "Date" = 'june 8, 1996'
wikisql
CREATE TABLE table_9161 ( "Rank" real, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many medals under total when silver is less than 2, gold is 3, and bronze is less than 0?
SELECT SUM("Total") FROM table_9161 WHERE "Silver" < '2' AND "Gold" = '3' AND "Bronze" < '0'
wikisql
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 procedures.short_title, prescriptions.drug_type FROM procedures INNER JOIN prescriptions ON procedures.hadm_id = prescriptions.hadm_id WHERE procedures.subject_id = "2560"
mimicsql_data
CREATE TABLE table_11681 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who drove the maserati under 18 laps with an oil leak that had a grid of under 14?
SELECT "Driver" FROM table_11681 WHERE "Constructor" = 'maserati' AND "Laps" < '18' AND "Grid" < '14' AND "Time/Retired" = 'oil leak'
wikisql
CREATE TABLE table_56174 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- If the home team scored 6.7 (43), what was the a...
SELECT "Away team score" FROM table_56174 WHERE "Home team score" = '6.7 (43)'
wikisql
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE cost ( costid number, uniquepid text,...
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-172277' AND patient.hospitaldischargetime IS NULL)) AND me...
eicu
CREATE TABLE table_14058433_3 ( points_for VARCHAR, lost VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many points are there when the lost is 7?
SELECT points_for FROM table_14058433_3 WHERE lost = "7"
sql_create_context
CREATE TABLE table_76207 ( "Region" text, "Date" text, "Label" text, "Format" text, "Catalog" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Date has the Region Europe and a Catalog of 74321 45851 2?
SELECT "Date" FROM table_76207 WHERE "Region" = 'europe' AND "Catalog" = '74321 45851 2'
wikisql
CREATE TABLE table_name_53 ( decision VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the decision of the Red Wings game when they had a record of 45 18 6?
SELECT decision FROM table_name_53 WHERE record = "45–18–6"
sql_create_context
CREATE TABLE table_23187 ( "Rank" real, "Mountain Peak" text, "Mountain Range" text, "Elevation" text, "Prominence" text, "Isolation" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many different isolation numbers does the peak with an eleva...
SELECT COUNT("Isolation") FROM table_23187 WHERE "Elevation" = '2782.622 = 9,127feet 2782m'
wikisql
CREATE TABLE member_of_club ( stuid number, clubid number, position text ) CREATE TABLE club ( clubid number, clubname text, clubdesc text, clublocation text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advis...
SELECT COUNT(DISTINCT t1.clubname) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = "Eric" AND t3.lname = "Tai"
spider
CREATE TABLE table_name_17 ( castilian VARCHAR, italian VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What word would a Castilian speaker use for the Italian word auto(mobile)?
SELECT castilian FROM table_name_17 WHERE italian = "auto(mobile)"
sql_create_context
CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE ground_service ( ...
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, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND date_day.day_number = 21 AND date_day.month_number = 2...
atis
CREATE TABLE table_name_81 ( county VARCHAR, mascot VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which county has the mascot of Bruins?
SELECT county FROM table_name_81 WHERE mascot = "bruins"
sql_create_context
CREATE TABLE Employees ( Id VARCHAR ) CREATE TABLE ROLES ( Id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- List roles that have more than one employee. List the role description and number of employees.
SELECT ROLES.role_description, COUNT(Employees.employee_id) FROM ROLES JOIN Employees ON Employees.role_code = ROLES.role_code GROUP BY Employees.role_code HAVING COUNT(Employees.employee_id) > 1
sql_create_context
CREATE TABLE table_name_77 ( tournament VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the value in 2008 when the value for Tournament is year?
SELECT 2008 FROM table_name_77 WHERE tournament = "year"
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 WHERE demographic.insurance = "Self Pay" AND demographic.days_stay > "29"
mimicsql_data
CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) CREATE TABLE date_day ( ...
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND flight.arrival_time > 2000 AND flight.to_airport = AIRPORT_SERVICE_1.airport...
atis
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Descrip...
SELECT t.TagName AS "Tag Name", p.Body AS "Wiki Excerpt" FROM Tags AS t JOIN Posts AS p ON t.ExcerptPostId = p.Id WHERE p.Body != '' ORDER BY t.TagName
sede
CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight te...
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, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND date_day.day_number = 21 AND date_day.month_number = 2 AND d...
atis
CREATE TABLE table_13143 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" text, "Finish" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which country has a Year(s) won in 1964?
SELECT "Country" FROM table_13143 WHERE "Year(s) won" = '1964'
wikisql
CREATE TABLE table_73311 ( "Regional County Municipality (RCM)" text, "Population Canada 2011 Census" real, "Land Area" text, "Density (pop. per km2)" text, "Seat of RCM" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the RCM that has a dens...
SELECT "Regional County Municipality (RCM)" FROM table_73311 WHERE "Density (pop. per km2)" = '9.7'
wikisql
CREATE TABLE table_48079 ( "Total Points" real, "Name" text, "Career Games" text, "Position" text, "Years Played" text, "Scored 1,500 Points" text, "Date and Opponent" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Career Games has a D...
SELECT "Career Games" FROM table_48079 WHERE "Date and Opponent" = '12/15/92 vs. uw–milwaukee'
wikisql
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE m...
SELECT lab.labname FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-202970' AND patient.hospitaldischargetime IS NULL)) ORDER BY lab.labresulttime DESC L...
eicu
CREATE TABLE table_56306 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the loss of the Mariners game that had an attendance of 9,065?
SELECT "Loss" FROM table_56306 WHERE "Attendance" = '9,065'
wikisql
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD ...
SELECT AVG(t_kc21.IN_HOSP_DAYS) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '7349327' AND t_kc21.IN_HOSP_DATE BETWEEN '2006-06-14' AND '2007-03-09'
css
CREATE TABLE table_52120 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What did the home team score when the away team ...
SELECT "Home team score" FROM table_52120 WHERE "Away team score" = '6.8 (44)'
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 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 WHERE demographic.diagnosis = "BOWEL OBSTRUCTION"
mimicsql_data
CREATE TABLE table_18590048_1 ( platform VARCHAR, units_sold__in_millions_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What platform sold 11.18 million units?
SELECT platform FROM table_18590048_1 WHERE units_sold__in_millions_ = "11.18"
sql_create_context
CREATE TABLE table_27294107_11 ( semifinals VARCHAR, event VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the semifinals for the light flyweight event?
SELECT semifinals FROM table_27294107_11 WHERE event = "Light flyweight"
sql_create_context
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_ID = '74833853' AND t_kc21.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2010-01-28' AND '2018-12-30' AND t_kc22.MED_INV_ITEM_TYPE = '西药费'
css
CREATE TABLE table_1341973_3 ( candidates VARCHAR, district VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which candidates ran in the Alabama 6 district?
SELECT candidates FROM table_1341973_3 WHERE district = "Alabama 6"
sql_create_context
CREATE TABLE table_17705 ( "Year" real, "Total Region" real, "Biggenden" real, "Eidsvold" real, "Gayndah" real, "Monto" real, "Mundubbera" real, "Perry" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the monto where the total reg...
SELECT COUNT("Monto") FROM table_17705 WHERE "Total Region" = '11230'
wikisql
CREATE TABLE table_6330 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On what Surface was the match with a Score of 3-6, 1-6 played?...
SELECT "Surface" FROM table_6330 WHERE "Score" = '3-6, 1-6'
wikisql
CREATE TABLE table_202_253 ( id number, "team" text, "titles" text, "runners-up" text, "third place" text, "fourth place" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- name all winners of the caribbean cup
SELECT "team" FROM table_202_253 WHERE "titles" > 0
squall
CREATE TABLE vehicles ( vehicle_id number, vehicle_details text ) CREATE TABLE staff ( staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time ) CREATE TABLE...
SELECT COUNT(*) FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM customer_payments)
spider
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, ...
SELECT MIN(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 31880)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.lab...
mimic_iii
CREATE TABLE table_204_799 ( id number, "name" text, "built" text, "listed" text, "location" text, "county" text, "type" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- fairground street bridge and confederate avenue brick arch bridge were bo...
SELECT "county" FROM table_204_799 WHERE "name" = 'fairground street bridge'
squall
CREATE TABLE table_46316 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result of the match that went to round ...
SELECT "Res." FROM table_46316 WHERE "Round" = '1' AND "Time" = '2:48'
wikisql
CREATE TABLE table_8740 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Partner" text, "Opponents in final" text, "Score in final" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Outcome, when Championship is Aust...
SELECT "Outcome" FROM table_8740 WHERE "Championship" = 'australian open' AND "Year" < '1994'
wikisql
CREATE TABLE table_name_99 ( laps VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Laps has a Points of lead changes: 13 between 8 drivers?
SELECT laps FROM table_name_99 WHERE points = "lead changes: 13 between 8 drivers"
sql_create_context
CREATE TABLE table_1304443_2 ( county VARCHAR, bush_percentage VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the name of the county where 48.3% voted for Bush?
SELECT county FROM table_1304443_2 WHERE bush_percentage = "48.3%"
sql_create_context
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
SELECT SUM(MED_AMOUT) FROM t_kc24 WHERE MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc21 WHERE MED_SER_ORG_NO = '5633728' AND MED_ORG_DEPT_NM = '检验科') AND CLINIC_SLT_DATE BETWEEN '2000-04-22' AND '2014-02-02'
css
CREATE TABLE table_name_62 ( flt_apps VARCHAR, league_goals VARCHAR, position VARCHAR, total_goals VARCHAR, fa_cup_apps VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many FLT appearances for the player with less than 5 total goals, and 3 FA ...
SELECT flt_apps FROM table_name_62 WHERE total_goals < 5 AND fa_cup_apps = "3" AND position = "mf" AND league_goals = 4
sql_create_context
CREATE TABLE table_21294 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name t...
SELECT "High points" FROM table_21294 WHERE "Score" = 'L 92–100 (OT)'
wikisql
CREATE TABLE table_32448 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which venue hosted an away team with a score of ...
SELECT "Venue" FROM table_32448 WHERE "Away team score" = '9.12 (66)'
wikisql
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JO...
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID
nvbench
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE admissions ( ...
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 48706) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
mimic_iii
CREATE TABLE table_204_328 ( id number, "no." number, "date" text, "tournament" text, "winning score" text, "margin of\nvictory" text, "runner(s)-up" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the number of tournaments listed on ...
SELECT COUNT("tournament") FROM table_204_328
squall
CREATE TABLE table_79773 ( "Region/Country" text, "Local name" text, "Network" text, "Dates aired" text, "Starring" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the star for the Vara network?
SELECT "Starring" FROM table_79773 WHERE "Network" = 'vara'
wikisql
CREATE TABLE table_11964154_11 ( high_assists VARCHAR, high_rebounds VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who had the high assists when the high rebounds were from Nick Collison (15)?
SELECT high_assists FROM table_11964154_11 WHERE high_rebounds = "Nick Collison (15)"
sql_create_context
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 microlab ( microl...
SELECT MIN(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-26011')) AND lab.labname = 'total bilirubin' AND DATETIME(lab.labresulttime, '...
eicu
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE bdmzjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH number, KH text, KLX num...
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 = '6222694' AND NOT wdmzjzjlb.CYKSMC LIKE '%整形外科%' UNION SELECT * FROM person_info ...
css
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '5434543' AND t_kc21.IN_HOSP_DATE BETWEEN '2002-03-09' AND '2009-04-14' AND t_kc21.INSU_TYPE = '儿童'
css
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime t...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', admissions.admittime)) FROM admissions WHERE admissions.subject_id = 92846 AND admissions.dischtime IS NULL
mimic_iii
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 diagnosis ( diagn...
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'neurogenic shock')) AND DATETIME(cost.charge...
eicu
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 COUNT(*) FROM (SELECT gwyjzb.MED_ORG_DEPT_CD FROM gwyjzb JOIN t_kc24 ON gwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE gwyjzb.MED_SER_ORG_NO = '4045580' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2011-07-15' AND '2011-09-29' GROUP BY gwyjzb.MED_ORG_DEPT_CD HAVING SUM(t_kc24.MED_AMOUT) <= 7992.28 UNION SELECT fgwyjzb...
css
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "6826" AND lab.flag = "abnormal"
mimicsql_data
CREATE TABLE table_name_17 ( chart_no INTEGER, title VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest chart number for the song Yardbirds aka Roger the Engineer?
SELECT MAX(chart_no) FROM table_name_17 WHERE title = "yardbirds aka roger the engineer"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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...
SELECT jybgb.KSBM, jybgb.KSMC FROM hz_info JOIN mzjzjlb JOIN jybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '78828339' AND jybgb.BGRQ BETWEEN '2004-07-28' AND '2006-...
css
CREATE TABLE table_204_423 ( id number, "name" text, "location" text, "city" text, "listing date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many historic sites were listed before 1965 ?
SELECT COUNT("name") FROM table_204_423 WHERE "listing date" < 1965
squall
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, 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, JY...
SELECT mzjzjlb.KH, mzjzjlb.KLX FROM mzjzjlb WHERE mzjzjlb.JZLSH = '55379841354'
css
CREATE TABLE diagnoses ( 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 demographic.admittime FROM demographic WHERE demographic.name = "Kelly Gallardo"
mimicsql_data
CREATE TABLE table_74037 ( "Player" text, "Position" text, "Starting No.#" real, "D.O.B" text, "Club" text, "Height" text, "Weight" text, "Games" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which player weighs 76kg?
SELECT "Player" FROM table_74037 WHERE "Weight" = '76kg'
wikisql
CREATE TABLE table_41384 ( "Publication" text, "Country" text, "Accolade" text, "Year" real, "Rank" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which accolade has USA as the country, with a year less than 2009?
SELECT "Accolade" FROM table_41384 WHERE "Country" = 'usa' AND "Year" < '2009'
wikisql
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID
nvbench
CREATE TABLE table_12134 ( "Tournament" text, "2006" text, "2007" text, "2008" text, "2009" text, "2011" text, "2012" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For the Australian Open, in 2007 the result was A, but what was the result i...
SELECT "2012" FROM table_12134 WHERE "2007" = 'a' AND "Tournament" = 'australian open'
wikisql
CREATE TABLE table_53888 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the least number of people to attend a game when Los Angel...
SELECT MIN("Attendance") FROM table_53888 WHERE "Home" = 'los angeles'
wikisql
CREATE TABLE table_name_12 ( total INTEGER, gold INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average Total, when Gold is less than 0?
SELECT AVG(total) FROM table_name_12 WHERE gold < 0
sql_create_context
CREATE TABLE table_35781 ( "Rank" real, "Airport" text, "Metropolitan area" text, "Passengers" real, "Carriers" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Passengers have Carriers of air canada?
SELECT "Passengers" FROM table_35781 WHERE "Carriers" = 'air canada'
wikisql
CREATE TABLE table_70300 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponents in the final" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the surface for the game that was playe...
SELECT "Surface" FROM table_70300 WHERE "Partner" = 'tiya rolle'
wikisql
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "M" AND procedures.icd9_code = "9755"
mimicsql_data
CREATE TABLE table_8611 ( "Peak" text, "Location" text, "Height (m)" real, "Prominence (m)" real, "Col (m)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the smallest height with a prominence of 2,349?
SELECT MIN("Height (m)") FROM table_8611 WHERE "Prominence (m)" = '2,349'
wikisql
CREATE TABLE table_name_34 ( result VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result on 16 November 2003?
SELECT result FROM table_name_34 WHERE date = "16 november 2003"
sql_create_context
CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, ...
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT...
advising
CREATE TABLE mzjzjlb ( YLJGDM text, JZLSH text, KH text, KLX number, MJZH text, HZXM text, NLS number, NLY number, ZSEBZ number, JZZTDM number, JZZTMC text, JZJSSJ time, TXBZ number, ZZBZ number, WDBZ number, JZKSBM text, JZKSMC text, JZKSRQ time, ...
(SELECT jyjgzbb.JCFF FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_i...
css
CREATE TABLE train ( name VARCHAR, train_id VARCHAR ) CREATE TABLE station ( name VARCHAR, station_id VARCHAR ) CREATE TABLE train_station ( station_id VARCHAR, train_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- show the train name and...
SELECT T2.name, T3.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id
sql_create_context
CREATE TABLE table_name_47 ( engine VARCHAR, entrant VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which engine has an Entrant of team lotus, and a Year larger than 1962?
SELECT engine FROM table_name_47 WHERE entrant = "team lotus" AND year > 1962
sql_create_context
CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE flight_far...
SELECT COUNT(DISTINCT flight_id) FROM flight WHERE airline_code = 'DL'
atis
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE...
SELECT * FROM sys.servers
sede
CREATE TABLE country ( country VARCHAR, country_id VARCHAR ) CREATE TABLE city ( country_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which countries have at least 3 cities?
SELECT T2.country FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id GROUP BY T2.country_id HAVING COUNT(*) >= 3
sql_create_context
CREATE TABLE table_test_8 ( "id" int, "anemia" bool, "intra_aortic_balloon_pump_iabp" bool, "systolic_blood_pressure_sbp" int, "intravenous_pressors" bool, "fever" bool, "hemoglobin_a1c_hba1c" float, "heart_disease" bool, "vasopressors" bool, "renal_disease" bool, "temperatur...
SELECT * FROM table_test_8 WHERE unprotected_left_main_stenosis >= 50 OR planned_left_main_intervention = 1
criteria2sql
CREATE TABLE table_name_58 ( catalog VARCHAR, country VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What catalog has Australia as the country?
SELECT catalog FROM table_name_58 WHERE country = "australia"
sql_create_context
CREATE TABLE table_75693 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average silver for golds over 2, ranks of 1, and bronzes over 0?
SELECT AVG("Silver") FROM table_75693 WHERE "Gold" > '2' AND "Rank" = '1' AND "Bronze" > '0'
wikisql
CREATE TABLE table_20096 ( "Name" text, "Position" text, "Number" real, "School/Club Team" text, "Season" real, "Acquisition via" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the school/club for guard
SELECT "School/Club Team" FROM table_20096 WHERE "Position" = 'Guard'
wikisql
CREATE TABLE table_25515 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who directed the episode that originally aired on Febr...
SELECT "Directed by" FROM table_25515 WHERE "Original air date" = 'February 16, 1999'
wikisql
CREATE TABLE exhibition_record ( Exhibition_ID int, Date text, Attendance int ) CREATE TABLE exhibition ( Exhibition_ID int, Year int, Theme text, Artist_ID int, Ticket_Price real ) CREATE TABLE artist ( Artist_ID int, Name text, Country text, Year_Join int, Age int...
SELECT Name, COUNT(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.Artist_ID = T2.Artist_ID GROUP BY T1.Artist_ID ORDER BY COUNT(*)
nvbench
CREATE TABLE table_13425 ( "Name" text, "Type" text, "Relation" text, "Length" text, "Year" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Name has a Year larger than 2001, and a Length of 52 x 20 mins?
SELECT "Name" FROM table_13425 WHERE "Year" > '2001' AND "Length" = '52 x 20 mins'
wikisql
CREATE TABLE table_2349 ( "Recipient" text, "First place(s)" real, "Second place(s)" real, "Third place(s)" real, "Total placings(s)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the minimum number of total placings?
SELECT MIN("Total placings(s)") FROM table_2349
wikisql
CREATE TABLE camera_lens ( name VARCHAR, id VARCHAR ) CREATE TABLE photos ( camera_lens_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the names of the cameras that have taken picture of the most mountains?
SELECT T2.name FROM photos AS T1 JOIN camera_lens AS T2 ON T1.camera_lens_id = T2.id GROUP BY T2.id ORDER BY COUNT(*) DESC LIMIT 1
sql_create_context
CREATE TABLE table_40482 ( "Name" text, "Rank" real, "Out of" text, "Source" text, "Year" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Can you tell me the lowest Year that has the Rank smaller the 132, and the Name of biodiversity richness?
SELECT MIN("Year") FROM table_40482 WHERE "Rank" < '132' AND "Name" = 'biodiversity richness'
wikisql
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 lab ( subject_id text, hadm_id text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "OVERDOSE" AND prescriptions.route = "TP"
mimicsql_data
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Badges ( Id...
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 LIMIT 5000
sede
CREATE TABLE table_name_64 ( total VARCHAR, concacaf VARCHAR, mls_cup VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many Totals have a CONCACAF of 0, and an MLS Cup smaller than 6?
SELECT COUNT(total) FROM table_name_64 WHERE concacaf = 0 AND mls_cup < 6
sql_create_context
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId ...
SELECT p.Id AS "post_link", p.Score, p.ViewCount, p.OwnerUserId AS "user_link", p.CreationDate FROM Posts AS p LEFT JOIN PostTags AS pt ON p.Id = pt.PostId LEFT JOIN Tags AS t ON pt.TagId = t.Id WHERE PostTypeId = 1 AND Tags LIKE '##Tag##' AND ClosedDate IS NULL ORDER BY Score DESC
sede
CREATE TABLE table_60860 ( "Year" real, "Award" text, "Category" text, "Nominated Work" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the nominated work after 2006, that was awarded the Drama Desk award and the Outstanding f...
SELECT "Nominated Work" FROM table_60860 WHERE "Year" > '2006' AND "Award" = 'drama desk award' AND "Category" = 'outstanding featured actor in a musical'
wikisql
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE Comments ( Id number,...
SELECT p.Id AS "post_link", v.CreationDate FROM Votes AS v INNER JOIN Posts AS p ON v.PostId = p.ParentId WHERE v.VoteTypeId = 12 ORDER BY v.CreationDate DESC LIMIT 100
sede