instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
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 t_kc21.MED_ORG_DEPT_CD, t_kc21.OUT_DIAG_DIS_CD, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '5248115' GROUP BY t_kc21.MED_ORG_DEPT_CD, t_kc21.OUT_DIAG_DIS_CD
css
CREATE TABLE table_68252 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which opponent was faced before week 2?
SELECT "Opponent" FROM table_68252 WHERE "Week" < '2'
wikisql
CREATE TABLE table_21636599_1 ( security_forces INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many security forces?
SELECT MAX(security_forces) FROM table_21636599_1
sql_create_context
CREATE TABLE table_204_513 ( id number, "date" text, "time" text, "opponent#" text, "site" text, "tv" text, "result" text, "attendance" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many times is attendance over 30,000 ?
SELECT COUNT(*) FROM table_204_513 WHERE "attendance" > 30000
squall
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.long_title = "Constipation, unspecified"
mimicsql_data
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 prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND prescriptions.drug_type = "ADDITIVE"
mimicsql_data
CREATE TABLE table_14000 ( "City" text, "System" text, "Category" text, "Daily ridership" real, "As of" text, "Opened" real, "Stations" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Stations are in vancouver, bc?
SELECT "Stations" FROM table_14000 WHERE "City" = 'vancouver, bc'
wikisql
CREATE TABLE table_name_58 ( venue VARCHAR, against VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Venue, when Against is greater than 9, and when Date is '03/02/1996'?
SELECT venue FROM table_name_58 WHERE against > 9 AND date = "03/02/1996"
sql_create_context
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 SUM(t_kc24.OVE_PAY) FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '5503215' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2001-03-19' AND '2014-04-30'
css
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 Has_Allergy ( StuID INTEGER, Allergy VARCHAR(20) ) CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), ...
SELECT T1.Allergy, COUNT(T1.Allergy) FROM Allergy_Type AS T1 JOIN Has_Allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = "Lisa" GROUP BY T1.Allergy
nvbench
CREATE TABLE scientists ( ssn number, name text ) CREATE TABLE projects ( code text, name text, hours number ) CREATE TABLE assignedto ( scientist number, project text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the name of the scientis...
SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.ssn WHERE T2.name = 'Matter of Time' INTERSECT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.ssn WHERE T2.name = 'A Pu...
spider
CREATE TABLE mzjzjlb_jybgb ( YLJGDM_MZJZJLB text, BGDH number, YLJGDM number ) 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, X...
SELECT jyjgzbb.YQBH, jyjgzbb.YQMC FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM ...
css
CREATE TABLE table_48121 ( "Date" text, "Opponent" text, "Venue" text, "Score" text, "Attendance" text, "Scorers" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score when Bornor Regis Town was the opponent?
SELECT "Score" FROM table_48121 WHERE "Opponent" = 'bornor regis town'
wikisql
CREATE TABLE table_59889 ( "Shooter" text, "Event" text, "Rank points" text, "Score points" text, "Total" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the total when the score points was 12 and the rank points was 15?
SELECT "Total" FROM table_59889 WHERE "Score points" = '12' AND "Rank points" = '15'
wikisql
CREATE TABLE table_name_26 ( tie_no VARCHAR, away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Tie no for Away Team Ipswich Town?
SELECT tie_no FROM table_name_26 WHERE away_team = "ipswich town"
sql_create_context
CREATE TABLE table_73717 ( "Year" text, "Superintendent" text, "Middlesex Principal" text, "Gorham Principal" text, "Middle School Principal" text, "High School Principal" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who were the superintenden...
SELECT "Superintendent" FROM table_73717 WHERE "Middle School Principal" = 'Alan Degroote' AND "Gorham Principal" = 'Paul Lahue' AND "Year" = '2006-2007'
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_DIRE_CD text, MED_DIRE_NM text,...
SELECT AVG(t_kc21.MED_AMOUT) FROM t_kc21 WHERE t_kc21.MED_ORG_DEPT_CD = '6118' AND t_kc21.IN_HOSP_DATE BETWEEN '2010-02-05' AND '2019-12-03' AND t_kc21.IN_DIAG_DIS_CD = 'W66.043' AND t_kc21.CLINIC_TYPE = '住院'
css
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 WHERE demographic.admityear < "2156" AND diagnoses.long_title = "Personal history of tobacco use"
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(DISTINCT IN_DIAG_DIS_CD) FROM t_kc21 WHERE PERSON_ID = '66184630' AND IN_HOSP_DATE BETWEEN '2008-11-08' AND '2014-05-15'
css
CREATE TABLE table_9976 ( "Game" text, "Date" text, "Home Team" text, "Result" text, "Road Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result of Game 3 of this searson?
SELECT "Result" FROM table_9976 WHERE "Game" = 'game 3'
wikisql
CREATE TABLE table_2668329_18 ( party VARCHAR, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the party for hutchins g. burton
SELECT party FROM table_2668329_18 WHERE incumbent = "Hutchins G. Burton"
sql_create_context
CREATE TABLE table_name_76 ( winner VARCHAR, win__number VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Winner, when Win # is greater than 1, and when Points is less than 94?
SELECT winner FROM table_name_76 WHERE win__number > 1 AND points < 94
sql_create_context
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND lab.itemid = "51044"
mimicsql_data
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 t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '65610643384' AND t_kc22.HOSP_DOC_NM LIKE '姜%'
css
CREATE TABLE Events ( Event_ID INTEGER, Service_ID INTEGER, Event_Details VARCHAR(255) ) CREATE TABLE Participants ( Participant_ID INTEGER, Participant_Type_Code CHAR(15), Participant_Details VARCHAR(255) ) CREATE TABLE Services ( Service_ID INTEGER, Service_Type_Code CHAR(15) ) CREA...
SELECT Event_Details, COUNT(Event_Details) FROM Events GROUP BY Event_Details ORDER BY Event_Details
nvbench
CREATE TABLE table_name_27 ( gold_medals VARCHAR, total_medals VARCHAR, bronze_medals VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many gold medals for the school with 2 total medals and under 0 bronzes?
SELECT COUNT(gold_medals) FROM table_name_27 WHERE total_medals = 2 AND bronze_medals < 0
sql_create_context
CREATE TABLE table_25355392_2 ( november_3 VARCHAR, march_27_29 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many times is march 27-29 is 129?
SELECT COUNT(november_3) FROM table_25355392_2 WHERE march_27_29 = "129"
sql_create_context
CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE ground_service ( city_code text, airport...
SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE ((flight.airline_code = 'NW') OR (flight.airline_code = 'UA')) AND city.city_code = airport_service.city_code AND city.city_name = 'DENVER' AND flight.to_airport = airport_service.airport_code
atis
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
SELECT All_Road, All_Games_Percent FROM basketball_match
nvbench
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE intakeoutput ( intakeoutpu...
SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '009-5001' AND patient.hospitaladmitsource = 'emergency department' AND patient.hospitaldischargetime IS NULL
eicu
CREATE TABLE table_3422 ( "Player" text, "G" real, "Solo TK" real, "Asst. TK" real, "Total TK" real, "Sack" text, "YdL" real, "INT" real, "Yards" real, "ForFum" real, "FumRec" real, "TD" real ) -- Using valid SQLite, answer the following questions for the tables provide...
SELECT MIN("FumRec") FROM table_3422
wikisql
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.icd9_code = "E8889"
mimicsql_data
CREATE TABLE table_60620 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the visitor on March 27?
SELECT "Visitor" FROM table_60620 WHERE "Date" = 'march 27'
wikisql
CREATE TABLE table_name_56 ( time VARCHAR, grid VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is time of manufacturer with grid 21?
SELECT time FROM table_name_56 WHERE grid = 21
sql_create_context
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 text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_DIAG_DIS_NM, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '9028795' GROUP BY t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_DIAG_DIS_NM
css
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code tex...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'antiplatelet agent - aspirin' AND STRFTIME('%y', t...
eicu
CREATE TABLE financial_transactions ( transaction_id number, previous_transaction_id number, account_id number, card_id number, transaction_type text, transaction_date time, transaction_amount number, transaction_comment text, other_transaction_details text ) CREATE TABLE customers_...
SELECT transaction_type, COUNT(*) FROM financial_transactions GROUP BY transaction_type
spider
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 IN_DIAG_DIS_CD, IN_DIAG_DIS_NM FROM t_kc21 WHERE PERSON_ID = '32680024'
css
CREATE TABLE fzzmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZD...
SELECT * FROM person_info JOIN hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jy...
css
CREATE TABLE aircraft ( aid number, name text, distance number ) CREATE TABLE flight ( flno number, origin text, destination text, distance number, departure_date time, arrival_date time, price number, aid number ) CREATE TABLE employee ( eid number, name text, ...
SELECT name FROM employee EXCEPT SELECT T1.name FROM employee AS T1 JOIN certificate AS T2 ON T1.eid = T2.eid JOIN aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800"
spider
CREATE TABLE table_11845 ( "Draw" real, "Artist" text, "Song" text, "Points" real, "Place" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the number of points when the place is less than 7, the draw is more than 2 and the artist is piece of ...
SELECT COUNT("Points") FROM table_11845 WHERE "Place" < '7' AND "Draw" > '2' AND "Artist" = 'piece of cake'
wikisql
CREATE TABLE table_name_8 ( location VARCHAR, tournament VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where was the Singapore Charity Shield tournament played?
SELECT location FROM table_name_8 WHERE tournament = "singapore charity shield"
sql_create_context
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE LOWER('%Sri Lanka%') ORDER BY Reputation DESC
sede
CREATE TABLE table_204_621 ( id number, "no." number, "date" text, "tournament" text, "winning score" text, "margin\nof victory" text, "runner(s)-up" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many runners up were there on july 24 , ...
SELECT "runner(s)-up" FROM table_204_621 WHERE "date" = 'jul 24, 1967'
squall
CREATE TABLE table_71489 ( "Name" text, "Years" text, "Gender" text, "Area" text, "Authority" text, "Decile" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What years is the private school in upper hutt?
SELECT "Years" FROM table_71489 WHERE "Area" = 'upper hutt' AND "Authority" = 'private'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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, ...
SELECT wdmzjzjlb.JZZDBM, wdmzjzjlb.JZZDSM FROM wdmzjzjlb WHERE wdmzjzjlb.JZLSH = '96534570351' UNION SELECT bdmzjzjlb.JZZDBM, bdmzjzjlb.JZZDSM FROM bdmzjzjlb WHERE bdmzjzjlb.JZLSH = '96534570351'
css
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 WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.icd9_code = "2763"
mimicsql_data
CREATE TABLE table_name_78 ( episode VARCHAR, performer_1 VARCHAR, performer_2 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of episodes where jim sweeney was the 1st performer and steve steen was the 2nd performer?
SELECT COUNT(episode) FROM table_name_78 WHERE performer_1 = "jim sweeney" AND performer_2 = "steve steen"
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 COUNT(*) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '吕睿明' AND t_kc22.STA_DATE BETWEEN '2010-03-18' AND '2020-08-21' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC LIMIT 1
css
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime ...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnoses_icd.charttime)) FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'iliac artery aneurysm') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admiss...
mimic_iii
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetake...
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 = '005-46456')) AND DATETIME(lab.labresulttime, 'start of month') = DATETIME(CURRENT_TIME(),...
eicu
CREATE TABLE files ( duration VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many songs have 4 minute duration?
SELECT COUNT(*) FROM files WHERE duration LIKE "4:%"
sql_create_context
CREATE TABLE table_270 ( "Series no." real, "Season no." real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production Code" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many air dates are there for p...
SELECT COUNT("Original air date") FROM table_270 WHERE "Production Code" = '206'
wikisql
CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE ta ( campus_job_id int, ...
SELECT (SELECT SUM(CASE WHEN DERIVED_TABLEalias0.FRIDAY = 'Y' THEN 1 ELSE 0 END) + SUM(CASE WHEN DERIVED_TABLEalias0.MONDAY = 'Y' THEN 1 ELSE 0 END) + SUM(CASE WHEN DERIVED_TABLEalias0.SATURDAY = 'Y' THEN 1 ELSE 0 END) + SUM(CASE WHEN DERIVED_TABLEalias0.SUNDAY = 'Y' THEN 1 ELSE 0 END) + SUM(CASE WHEN DERIVED_TABLEalia...
advising
CREATE TABLE table_name_36 ( years VARCHAR, decile VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tkkm o te ara rima has a decile less than 4 in what years?
SELECT years FROM table_name_36 WHERE decile < 4 AND name = "tkkm o te ara rima"
sql_create_context
CREATE TABLE table_44734 ( "Round" real, "Pick" text, "Player" text, "Position" text, "Nationality" text, "Club Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the club team for Kyle de Coste?
SELECT "Club Team" FROM table_44734 WHERE "Player" = 'kyle de coste'
wikisql
CREATE TABLE table_1342198_25 ( first_elected VARCHAR, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what year was Phil J. Welch first elected?
SELECT first_elected FROM table_1342198_25 WHERE incumbent = "Phil J. Welch"
sql_create_context
CREATE TABLE table_name_69 ( bronze INTEGER, silver VARCHAR, gold VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Bronze has a Silver of 15, and a Gold smaller than 20?
SELECT SUM(bronze) FROM table_name_69 WHERE silver = 15 AND gold < 20
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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, ...
SELECT mzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE person_info.XM = '鲁俊健' AND hz_info.YLJGDM = '5241360' AND mzjzjlb.JZKSMC LIKE '%肾内%'
css
CREATE TABLE table_24786958_2 ( opponent VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who did Rhein Fire play Against where 30701 people attended?
SELECT opponent FROM table_24786958_2 WHERE attendance = 30701
sql_create_context
CREATE TABLE farm ( farm_id number, year number, total_horses number, working_horses number, total_cattle number, oxen number, bulls number, cows number, pigs number, sheep_and_goats number ) CREATE TABLE farm_competition ( competition_id number, year number, theme t...
SELECT hosts FROM farm_competition WHERE theme <> 'Aliens'
spider
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 t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_NM, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '9579618' GROUP BY t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_NM
css
CREATE TABLE table_74734 ( "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 home team competed against the away team G...
SELECT "Home team" FROM table_74734 WHERE "Away team" = 'geelong'
wikisql
CREATE TABLE table_69223 ( "Edition" text, "Round" text, "Date" text, "Partnering" text, "Against" text, "Surface" text, "Opponents" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was played against with a result of 3 ...
SELECT "Against" FROM table_69223 WHERE "Result" = '3–6, 2–6'
wikisql
CREATE TABLE table_203_672 ( id number, "week" number, "date" text, "opponent" text, "result" text, "venue" text, "attendance" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- at what venue did the first game take place ?
SELECT "venue" FROM table_203_672 ORDER BY "date" LIMIT 1
squall
CREATE TABLE table_6380 ( "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which tournament had a score of 6 3, 7 6?
SELECT "Tournament" FROM table_6380 WHERE "Score" = '6–3, 7–6'
wikisql
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, Owner...
SELECT U.DisplayName FROM Votes AS V INNER JOIN Users AS U ON V.UserId = U.Id WHERE V.PostId = 9395 AND V.VoteTypeId = 5
sede
CREATE TABLE table_39119 ( "Country" text, "Skip" text, "Third" text, "Second" text, "Lead" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who has the role of skip when the lead is Dominik Greindl?
SELECT "Skip" FROM table_39119 WHERE "Lead" = 'dominik greindl'
wikisql
CREATE TABLE table_32357 ( "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. -- How many people watched the away team of Geelong...
SELECT "Crowd" FROM table_32357 WHERE "Away team" = 'geelong'
wikisql
CREATE TABLE table_name_43 ( region INTEGER, name VARCHAR, area__km_2__ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest region of Saint-Flavien with an area larger than 67.56?
SELECT MAX(region) FROM table_name_43 WHERE name = "saint-flavien" AND area__km_2__ > 67.56
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CRE...
SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '031-22988' AND patient.hospitaladmitsource = 'emergency department' AND DATETIME(patient.unitadmittime) <= DATETIME(CURRENT_TIME(), '-2 year')
eicu
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 text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT t_kc22.MED_ORG_DEPT_CD, t_kc22.MED_ORG_DEPT_NM FROM t_kc22 WHERE t_kc22.STA_DATE BETWEEN '2011-03-15' AND '2018-04-18' AND t_kc22.MED_INV_ITEM_TYPE = '手术费' GROUP BY t_kc22.MED_ORG_DEPT_CD ORDER BY COUNT(*) DESC LIMIT 2
css
CREATE TABLE table_53103 ( "Race" text, "Circuit" text, "Date" text, "Pole position" text, "Fastest lap" text, "Winning driver" text, "Constructor" text, "Tyre" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was t...
SELECT "Constructor" FROM table_53103 WHERE "Winning driver" = 'jack brabham' AND "Race" = 'monaco grand prix'
wikisql
CREATE TABLE table_15829930_5 ( tied INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the least tied
SELECT MIN(tied) FROM table_15829930_5
sql_create_context
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospita...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hyperglycemia - stress related') AS t1 JOIN (SELEC...
eicu
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28966)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit ht'...
mimic_iii
CREATE TABLE table_name_35 ( week INTEGER, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the earliest week with a game attended by 60,233?
SELECT MIN(week) FROM table_name_35 WHERE attendance = "60,233"
sql_create_context
CREATE TABLE manager ( manager_id number, name text, country text, working_year_starts text, age number, level number ) CREATE TABLE railway_manage ( railway_id number, manager_id number, from_year text ) CREATE TABLE railway ( railway_id number, railway text, builder t...
SELECT name FROM manager ORDER BY level
spider
CREATE TABLE table_name_10 ( place VARCHAR, to_par VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What place was Dave Stockton when he had a to par of +1?
SELECT place FROM table_name_10 WHERE to_par = "+1" AND player = "dave stockton"
sql_create_context
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 text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT MIN(demographic.days_stay) FROM demographic WHERE demographic.admityear >= "2179"
mimicsql_data
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 real, meter_20...
SELECT Nationality, SUM(meter_100) FROM swimmer GROUP BY Nationality ORDER BY Nationality
nvbench
CREATE TABLE table_54771 ( "Rd #" real, "Pick #" real, "Player" text, "Team (League)" text, "Reg GP" real, "Pl GP" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of every REG GP that Peter Andersson played as a pick# less than 14...
SELECT SUM("Reg GP") FROM table_54771 WHERE "Player" = 'peter andersson' AND "Pick #" < '143'
wikisql
CREATE TABLE table_27254 ( "Rank" real, "WS Points" real, "Name" text, "Country" text, "09-10 I/O best" real, "09-10 GP/JGP best" real, "09-10 GP/JGP 2nd" real, "09-10 OI best" real, "09-10 OI 2nd" real, "08-09 I/O best" real, "08-09 GP/JGP best" real, "08-09 GP/JGP 2nd" ...
SELECT "Name" FROM table_27254 WHERE "Rank" = '17'
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 COUNT(gwyjzb.PERSON_ID) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '6747187' AND gwyjzb.REMOTE_SETTLE_FLG = '异地1' OR gwyjzb.REMOTE_SETTLE_FLG = '异地2' UNION SELECT COUNT(fgwyjzb.PERSON_ID) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '6747187' AND fgwyjzb.REMOTE_SETTLE_FLG = '异地1' OR fgwyjzb.REMOTE_SETTLE_FLG = '异地...
css
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TA...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course_offering.semester < (SELECT SEMESTERalias0.semester_id FROM semester AS SEMESTERalias0 WHERE SEMESTERalias0.semester = 'WN' AND SEMESTERalias0.year = 2016) AND course.course_id = cour...
advising
CREATE TABLE table_39308 ( "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 that has hapoel jerusalem?
SELECT "1st leg" FROM table_39308 WHERE "Team #1" = 'hapoel jerusalem'
wikisql
CREATE TABLE table_19266557_1 ( original_air_date VARCHAR, _number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For episode number 7, what was the numbers of original air dates?
SELECT COUNT(original_air_date) FROM table_19266557_1 WHERE _number = 7
sql_create_context
CREATE TABLE table_69443 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What week 14 has the lowest attendance?
SELECT MIN("Attendance") FROM table_69443 WHERE "Week" = '14'
wikisql
CREATE TABLE table_1137707_2 ( pole_position VARCHAR, round VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of pole position with a round of 15?
SELECT COUNT(pole_position) FROM table_1137707_2 WHERE round = 15
sql_create_context
CREATE TABLE table_name_45 ( year VARCHAR, runs VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For what year was 100* runs happen?
SELECT year FROM table_name_45 WHERE runs = "100*"
sql_create_context
CREATE TABLE Customer_Addresses ( customer_id INTEGER, address_id INTEGER, date_from DATETIME, date_to DATETIME ) CREATE TABLE Departments ( department_id INTEGER, dept_store_id INTEGER, department_name VARCHAR(80) ) CREATE TABLE Product_Suppliers ( product_id INTEGER, supplier_id ...
SELECT product_type_code, MAX(product_price) FROM Products GROUP BY product_type_code
nvbench
CREATE TABLE table_name_71 ( venue VARCHAR, club VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Venue has Spartak St. Petersburg Club?
SELECT venue FROM table_name_71 WHERE club = "spartak st. petersburg"
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 t_kc24.t_kc21_OUT_DIAG_DIS_CD, t_kc24.t_kc21_OUT_DIAG_DIS_NM FROM t_kc24 WHERE t_kc24.t_kc21_PERSON_NM = '周锐志' AND t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 6373.39)
css
CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE dual_carrier ( main_airline varchar,...
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, state WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'LONG BEACH' AND date_day.day_number = 23 AND date_day.month_number...
atis
CREATE TABLE table_24180 ( "Model" text, "Years" text, "Type/code" text, "Transmission" text, "max. power" text, "Torque" text, "0-km/h (mph) (sec)" text, "top speed" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Petrol engine has ...
SELECT "Model" FROM table_24180 WHERE "max. power" = 'PS (kW; bhp)@5400-6500'
wikisql
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost numb...
SELECT COUNT(*) 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 = 17638)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'rescue flush...
mimic_iii
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 PostsWithDeleted ( Id number, PostTypeId number, ...
SELECT COUNT(Id) FROM Users
sede
CREATE TABLE table_61060 ( "Season" text, "Date" text, "Winners" text, "Finalists" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score on 14 march 2004?
SELECT "Score" FROM table_61060 WHERE "Date" = '14 march 2004'
wikisql
CREATE TABLE table_16573 ( "Character" text, "Portrayed by" text, "First appearance" text, "Last appearance" text, "Duration" text, "Episodes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the duration of Robert Joy's portrayal?
SELECT COUNT("Duration") FROM table_16573 WHERE "Portrayed by" = 'Robert Joy'
wikisql
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_Home, Team_ID FROM basketball_match GROUP BY ACC_Road, All_Home ORDER BY All_Home DESC
nvbench