instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
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 procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19040 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) ORDER BY procedures_icd.charttime LIMIT 1
mimic_iii
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 4
eicu
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 WHERE demographic.gender = "F" AND demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH"
mimicsql_data
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Enterococcus group d"
mimicsql_data
CREATE TABLE table_name_27 ( district VARCHAR, constituency_number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What district has a constituency of 60?
SELECT district FROM table_name_27 WHERE constituency_number = "60"
sql_create_context
CREATE TABLE table_14553 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When were there less than 1 point with a cosworth v8 engine in jolly club switzerland?
SELECT "Year" FROM table_14553 WHERE "Points" < '1' AND "Engine" = 'cosworth v8' AND "Entrant" = 'jolly club switzerland'
wikisql
CREATE TABLE table_20718 ( "Institution" text, "Location" text, "Team Nickname" text, "Joined TSCHL" real, "Home Arena" text, "Capacity" real, "Team Website" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For the flyers, what's the minimum c...
SELECT MIN("Capacity") FROM table_20718 WHERE "Team Nickname" = 'Flyers'
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.dob_year < "2180" AND prescriptions.route = "IVPCA"
mimicsql_data
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,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, JOB_ID varchar(10), ...
SELECT FIRST_NAME, SALARY FROM employees ORDER BY SALARY DESC
nvbench
CREATE TABLE table_23292220_17 ( scores VARCHAR, seans_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the scores for chris ramsey and carol vorderman
SELECT scores FROM table_23292220_17 WHERE seans_team = "Chris Ramsey and Carol Vorderman"
sql_create_context
CREATE TABLE table_name_86 ( games VARCHAR, tied VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of games for the season with 10 ties?
SELECT games FROM table_name_86 WHERE tied = 10
sql_create_context
CREATE TABLE table_name_9 ( year VARCHAR, event VARCHAR, position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year did she place 8th in the junior race?
SELECT year FROM table_name_9 WHERE event = "junior race" AND position = "8th"
sql_create_context
CREATE TABLE Ref_Characteristic_Types ( characteristic_type_code VARCHAR(15), characteristic_type_description VARCHAR(80) ) CREATE TABLE Products ( product_id INTEGER, color_code VARCHAR(15), product_category_code VARCHAR(15), product_name VARCHAR(80), typical_buying_price VARCHAR(20), ...
SELECT product_category_description, COUNT(product_category_description) FROM Ref_Product_Categories AS T1 JOIN Products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%' GROUP BY product_category_description ORDER BY COUNT(product_category_description)
nvbench
CREATE TABLE table_56530 ( "Year" text, "Starts" real, "Cuts made" real, "Wins" real, "Top 10" real, "Top 25" real, "Earnings ($)" real, "Money list rank" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the smallest Earnings that ...
SELECT MIN("Earnings ($)") FROM table_56530 WHERE "Money list rank" = '6' AND "Starts" < '22'
wikisql
CREATE TABLE table_8509 ( "White" text, "Black" text, "Year" real, "Result" text, "Moves" real, "Tournament" text, "Opening" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year had 32 moves?
SELECT SUM("Year") FROM table_8509 WHERE "Moves" = '32'
wikisql
CREATE TABLE table_204_343 ( id number, "nation" text, "model" text, "length" text, "barrel length" text, "weight" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how long was the m1894 rifle 's barrel ?
SELECT "barrel length" FROM table_204_343 WHERE "model" = 'm1894 rifle'
squall
CREATE TABLE table_name_65 ( att INTEGER, yards VARCHAR, long VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many Atts that have Yards of 43 and a Long larger than 43?
SELECT SUM(att) FROM table_name_65 WHERE yards = 43 AND long > 43
sql_create_context
CREATE TABLE table_25220821_4 ( mon_31_may VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many times are listed for 31 May for the rider ranked 5?
SELECT COUNT(mon_31_may) FROM table_25220821_4 WHERE rank = 5
sql_create_context
CREATE TABLE train ( id int, train_number int, name text, origin text, destination text, time text, interval text ) CREATE TABLE weekly_weather ( station_id int, day_of_week text, high_temperature int, low_temperature int, precipitation real, wind_speed_mph int ) CR...
SELECT name, COUNT(name) FROM train GROUP BY name ORDER BY COUNT(name) DESC
nvbench
CREATE TABLE table_56316 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which constructor has a Time/Retired of +37.311?
SELECT "Constructor" FROM table_56316 WHERE "Time/Retired" = '+37.311'
wikisql
CREATE TABLE table_name_91 ( tournament VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the 2007 result when the 2010 result was 2r, at the US Open?
SELECT 2007 FROM table_name_91 WHERE 2010 = "2r" AND tournament = "us open"
sql_create_context
CREATE TABLE table_22277 ( "Departure" text, "Going to" text, "Calling at" text, "Arrival" text, "Operator" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- when does the train arriving at bourne at 11.45 departure
SELECT "Departure" FROM table_22277 WHERE "Going to" = 'Bourne' AND "Arrival" = '11.45'
wikisql
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDat...
SELECT ROW_NUMBER() OVER (ORDER BY LastAccessDate DESC) AS " ", Id AS "user_link", LastAccessDate FROM Users WHERE Reputation > 3000 ORDER BY LastAccessDate DESC
sede
CREATE TABLE table_name_58 ( time_retired VARCHAR, grid VARCHAR, driver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Time/Retired has a Grid smaller than 3, and a Driver of mika h kkinen?
SELECT time_retired FROM table_name_58 WHERE grid < 3 AND driver = "mika häkkinen"
sql_create_context
CREATE TABLE table_name_4 ( attendance INTEGER, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the higest attendance on November 9, 1958?
SELECT MAX(attendance) FROM table_name_4 WHERE date = "november 9, 1958"
sql_create_context
CREATE TABLE table_78521 ( "Team" text, "Games Played" real, "Wins" real, "Losses" real, "Ties" real, "Goals For" real, "Goals Against" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many losses did the team with 22 goals for andmore tha...
SELECT COUNT("Losses") FROM table_78521 WHERE "Goals For" = '22' AND "Games Played" > '8'
wikisql
CREATE TABLE table_2930244_3 ( number_of_major_hurricanes INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the largest overall number of major hurricanes?
SELECT MAX(number_of_major_hurricanes) FROM table_2930244_3
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "MORBID OBESITY/SDA" AND prescriptions.drug = "Soln."
mimicsql_data
CREATE TABLE table_41531 ( "Player" text, "Position" text, "Date of Birth (Age)" text, "Caps" text, "Province / Club" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Position, when Caps is Example, and When Player is Shane Kelly?
SELECT "Position" FROM table_41531 WHERE "Caps" = 'example' AND "Player" = 'shane kelly'
wikisql
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
SELECT COUNT(mzjzjlb.ZZYSGH) FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.person_info_XM = '水葛菲' AND mzjzjlb.JZKSRQ BETWEEN '2016-04-26' AND '2019-12-28'
css
CREATE TABLE table_name_97 ( proto_austronesian VARCHAR, proto_oceanic VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Proto-Austronesian has a Proto-Oceanic of *lima?
SELECT proto_austronesian FROM table_name_97 WHERE proto_oceanic = "*lima"
sql_create_context
CREATE TABLE table_60349 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Away team at the Wolverhampton Wanderers Home game with a Score of 2 0?
SELECT "Away team" FROM table_60349 WHERE "Score" = '2–0' AND "Home team" = 'wolverhampton wanderers'
wikisql
CREATE TABLE table_name_19 ( res VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- The match against Oleg Taktarov had what result?
SELECT res FROM table_name_19 WHERE opponent = "oleg taktarov"
sql_create_context
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtim...
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 40 AND 49) GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 4
eicu
CREATE TABLE jybgb_jyjgzbb ( JYZBLSH number, YLJGDM text, jyjgzbb_id number ) 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, ...
SELECT jyjgzbb.JCZBMC, jyjgzbb.JCZBJGDW, AVG(jyjgzbb.JCZBJGDL) FROM jyjgzbb JOIN jybgb_jyjgzbb JOIN jybgb ON jybgb_jyjgzbb.JYZBLSH = jyjgzbb.JYZBLSH AND jybgb_jyjgzbb.jyjgzbb_id = jyjgzbb.jyjgzbb_id AND jybgb_jyjgzbb.YLJGDM = jybgb.YLJGDM WHERE jybgb.YLJGDM = '5086789' AND jyjgzbb.BGRQ BETWEEN '2013-02-09' AND '2015-06...
css
CREATE TABLE table_55779 ( "Entrant" text, "Constructor" text, "Chassis" text, "Engine" text, "Tyres" text, "Driver" text, "Rounds" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the featured in Engine through rounds 10-13?
SELECT "Engine" FROM table_55779 WHERE "Rounds" = '10-13'
wikisql
CREATE TABLE table_67113 ( "School" text, "Team" text, "Division Record" text, "Overall Record" text, "Season Outcome" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was Laurel's division record?
SELECT "Division Record" FROM table_67113 WHERE "School" = 'laurel'
wikisql
CREATE TABLE table_name_91 ( games INTEGER, name VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest Games, when Name is Jeremiah Massey, and when Points is less than 340?
SELECT MIN(games) FROM table_name_91 WHERE name = "jeremiah massey" AND points < 340
sql_create_context
CREATE TABLE table_30030227_1 ( written_by VARCHAR, directed_by VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many people wrote the episode directed by Arvin Brown?
SELECT COUNT(written_by) FROM table_30030227_1 WHERE directed_by = "Arvin Brown"
sql_create_context
CREATE TABLE table_70406 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many years was ensign n180b a Chassis with 4 points?
SELECT SUM("Year") FROM table_70406 WHERE "Points" = '4' AND "Chassis" = 'ensign n180b'
wikisql
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, d...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissi...
mimic_iii
CREATE TABLE table_75827 ( "Season" text, "Competition" text, "Round" text, "Opponent" text, "Home" text, "Away" text, "Series" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Opponent has an Away of 1 1, and a Home of 3 3?
SELECT "Opponent" FROM table_75827 WHERE "Away" = '1–1' AND "Home" = '3–3'
wikisql
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT demographic.marital_status, demographic.diagnosis FROM demographic WHERE demographic.subject_id = "74032"
mimicsql_data
CREATE TABLE table_name_49 ( venue VARCHAR, competition VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the venue that had a friendly match competition?
SELECT venue FROM table_name_49 WHERE competition = "friendly match"
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate n...
SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'acute respiratory failure') AS t1) - (SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT patient.uniqu...
eicu
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 COUNT(*) FROM zzmzjzjlb WHERE zzmzjzjlb.YLJGDM = '3982610' AND zzmzjzjlb.JZKSRQ BETWEEN '2016-01-19' AND '2018-02-22' AND zzmzjzjlb.ZSEBZ > 0 UNION SELECT COUNT(*) FROM fzzmzjzjlb WHERE fzzmzjzjlb.YLJGDM = '3982610' AND fzzmzjzjlb.JZKSRQ BETWEEN '2016-01-19' AND '2018-02-22' AND fzzmzjzjlb.ZSEBZ > 0
css
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_Games, School_ID FROM basketball_match ORDER BY All_Games DESC
nvbench
CREATE TABLE Faculty_Participates_in ( FacID INTEGER, actid INTEGER ) CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ) CREATE TABLE Student ( StuID INTEGER, ...
SELECT activity_name, COUNT(*) FROM Activity AS T1 JOIN Faculty_Participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid ORDER BY COUNT(*)
nvbench
CREATE TABLE table_1691800_2 ( population__2010_ VARCHAR, municipality VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the population where municipality is san jacinto?
SELECT population__2010_ FROM table_1691800_2 WHERE municipality = "San Jacinto"
sql_create_context
CREATE TABLE table_name_10 ( nba_draft VARCHAR, school VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the NBA Draft for the School Bishop O'Connell High School?
SELECT nba_draft FROM table_name_10 WHERE school = "bishop o'connell high school"
sql_create_context
CREATE TABLE table_33305 ( "Round" real, "Overall" real, "Player" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average round in which a Safety with an overall rank higher than 89 was drafted?
SELECT AVG("Round") FROM table_33305 WHERE "Position" = 'safety' AND "Overall" > '89'
wikisql
CREATE TABLE table_33270 ( "Dance" text, "Best dancer" text, "Best score" real, "Worst dancer" text, "Worst score" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average Worst score for Mario Lopez as the Best dancer and Tango as the Dan...
SELECT AVG("Worst score") FROM table_33270 WHERE "Best dancer" = 'mario lopez' AND "Dance" = 'tango'
wikisql
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodici...
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-207754')) AND DATETIME(lab.labresulttime) >= DATETIME(CURRENT_TIME(), '-97 month') OR...
eicu
CREATE TABLE roller_coaster ( Status VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show the different statuses and the numbers of roller coasters for each status.
SELECT Status, COUNT(*) FROM roller_coaster GROUP BY Status
sql_create_context
CREATE TABLE table_name_1 ( character VARCHAR, year VARCHAR, award_ceremony VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which character was nominated in the 2010 Indian Television Academy Awards?
SELECT character FROM table_name_1 WHERE year = 2010 AND award_ceremony = "indian television academy awards"
sql_create_context
CREATE TABLE table_name_35 ( score VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score on May 3?
SELECT score FROM table_name_35 WHERE date = "may 3"
sql_create_context
CREATE TABLE fgwyjzb ( 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 COUNT(*) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_NM = '戚星剑' AND t_kc22.STA_DATE BETWEEN '2006-01-02' AND '2014-06-21' AND t_kc22.SOC_SRT_DIRE_CD = '304714-w' UNION SELECT COUNT(*) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE fgw...
css
CREATE TABLE table_203_166 ( id number, "pos" text, "no" number, "rider" text, "manufacturer" text, "laps" number, "time" text, "grid" number, "points" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which rider completed all 21 lap...
SELECT "rider" FROM table_203_166 WHERE "laps" = 21 ORDER BY "pos" DESC LIMIT 1
squall
CREATE TABLE table_19654 ( "No. in series" real, "No. in season" 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. -- Who directed the episode w...
SELECT "Directed by" FROM table_19654 WHERE "Production code" = '176252'
wikisql
CREATE TABLE table_203_630 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who won more gold medals , brazil or china ?
SELECT "nation" FROM table_203_630 WHERE "nation" IN ('brazil', 'china') ORDER BY "gold" DESC LIMIT 1
squall
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId num...
SELECT Q.Id AS "post_link", Q.LastActivityDate FROM Posts AS Q WHERE Q.PostTypeId = 1 AND NOT Q.Tags LIKE @Pattern AND Q.LastActivityDate BETWEEN @SubFrom AND @SubTo AND (Q.CreationDate BETWEEN @From AND @To OR EXISTS(SELECT * FROM Posts AS A WHERE A.PostTypeId = 2 AND A.ParentId = Q.Id AND A.CreationDate BETWEEN @From...
sede
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 prescription...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.gender = "F" AND lab.label = "Granular Casts"
mimicsql_data
CREATE TABLE table_53058 ( "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 date was the game played at Punt Road Oval?...
SELECT "Date" FROM table_53058 WHERE "Venue" = 'punt road oval'
wikisql
CREATE TABLE table_3873 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Series" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is...
SELECT "Series" FROM table_3873 WHERE "High rebounds" = 'Al Horford (10)'
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 prescription...
SELECT demographic.ethnicity FROM demographic WHERE demographic.subject_id = "16438"
mimicsql_data
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime...
SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-29334')) AND STRFTIME('%y-%m', allergy.allergytime) >= '2104-03'
eicu
CREATE TABLE zyjzjlb ( YLJGDM text, JZLSH text, MZJZLSH text, KH text, KLX number, HZXM text, WDBZ number, RYDJSJ time, RYTJDM number, RYTJMC text, JZKSDM text, JZKSMC text, RZBQDM text, RZBQMC text, RYCWH text, CYKSDM text, CYKSMC text, CYBQDM tex...
SELECT JCZBMC, JCZBJGDW, AVG(JCZBJGDL) FROM jyjgzbb WHERE YLJGDM = '7089893' AND BGRQ BETWEEN '2007-02-02' AND '2014-12-08' GROUP BY JCZBMC, JCZBJGDW
css
CREATE TABLE table_26914759_3 ( manner_of_departure VARCHAR, team VARCHAR, incoming_manager VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the manner of departure for notts county with an incoming manager of martin allen
SELECT manner_of_departure FROM table_26914759_3 WHERE team = "Notts County" AND incoming_manager = "Martin Allen"
sql_create_context
CREATE TABLE table_29572583_20 ( player VARCHAR, status VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which player had the status to the fourth round lost to tsvetana pironkova [32] Answers:
SELECT player FROM table_29572583_20 WHERE status = "Fourth round lost to Tsvetana Pironkova [32]"
sql_create_context
CREATE TABLE table_name_44 ( home VARCHAR, visitor VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Home team of the event on Thursday, December 11 with Visitor Modo Hockey?
SELECT home FROM table_name_44 WHERE visitor = "modo hockey" AND date = "thursday, december 11"
sql_create_context
CREATE TABLE table_76383 ( "Round" real, "Pick" real, "Overall" real, "Name" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest round for an overall pick of 349 with a pick number in the round over...
SELECT MIN("Round") FROM table_76383 WHERE "Overall" = '349' AND "Pick" > '11'
wikisql
CREATE TABLE table_38485 ( "Name" text, "Team" text, "Qual 1" text, "Qual 2" real, "Best" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which team has a qualifying 2 time under 59.612 and a best of 59.14?
SELECT "Team" FROM table_38485 WHERE "Qual 2" < '59.612' AND "Best" = '59.14'
wikisql
CREATE TABLE table_18734298_1 ( title VARCHAR, production_code VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the title of the production code 1acx09?
SELECT title FROM table_18734298_1 WHERE production_code = "1ACX09"
sql_create_context
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 month ( ...
SELECT DISTINCT aircraft_code FROM aircraft WHERE aircraft_code = 'M80'
atis
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE departments ( DEPARTME...
SELECT HIRE_DATE, SALARY FROM employees WHERE NOT FIRST_NAME LIKE '%M%'
nvbench
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND procedures.long_title = "Colostomy, not otherwise specified"
mimicsql_data
CREATE TABLE table_56896 ( "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. -- The home team has a score of 12.9 (81) what is t...
SELECT "Away team score" FROM table_56896 WHERE "Home team score" = '12.9 (81)'
wikisql
CREATE TABLE table_53653 ( "Place (Posici\u00f3n)" real, "Team (Equipo)" text, "Played (PJ)" real, "Won (PG)" real, "Draw (PE)" real, "Lost (PP)" real, "Goals Scored (GF)" real, "Goals Conceded (GC)" real, "+/- (Dif.)" real, "Points (Pts.)" real ) -- Using valid SQLite, answer ...
SELECT AVG("Goals Conceded (GC)") FROM table_53653 WHERE "Goals Scored (GF)" > '19' AND "Points (Pts.)" = '31' AND "Draw (PE)" > '7'
wikisql
CREATE TABLE table_3565 ( "Contestant" text, "Place" real, "Age" real, "Country" text, "Federal state" text, "City" text, "Height" text, "Measurements (in cm)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what measurement does the cont...
SELECT "Measurements (in cm)" FROM table_3565 WHERE "City" = 'Sindelfingen'
wikisql
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, chart...
SELECT COUNT(*) > 0 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 = 433)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp mean' A...
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 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 WHERE demographic.discharge_location = "SHORT TERM HOSPITAL" AND demographic.admityear < "2198"
mimicsql_data
CREATE TABLE ship ( name VARCHAR, ship_id VARCHAR ) CREATE TABLE captain ( ship_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the name of the ships that have more than one captain.
SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id GROUP BY t2.ship_id HAVING COUNT(*) > 1
sql_create_context
CREATE TABLE table_name_69 ( runner_up VARCHAR, winning_score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Runner-up has a Winning score of 20 (70-69-64-65=268)?
SELECT runner_up FROM table_name_69 WHERE winning_score = −20(70 - 69 - 64 - 65 = 268)
sql_create_context
CREATE TABLE table_27715173_8 ( game VARCHAR, high_points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the game where the high points is by manu gin bili (26)?
SELECT game FROM table_27715173_8 WHERE high_points = "Manu Ginóbili (26)"
sql_create_context
CREATE TABLE table_50944 ( "Rider" text, "Manufacturer" text, "Laps" real, "Time" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the average Laps on Grid 15?
SELECT AVG("Laps") FROM table_50944 WHERE "Grid" = '15'
wikisql
CREATE TABLE table_66598 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Event" text, "Notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What event was in a year later than 2007 and in the 88th position?
SELECT "Event" FROM table_66598 WHERE "Year" > '2007' AND "Position" = '88th'
wikisql
CREATE TABLE table_53525 ( "Position" real, "Club" text, "Played" real, "Points" text, "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....
SELECT MAX("Goals against") FROM table_53525 WHERE "Wins" = '19' AND "Goals for" > '53'
wikisql
CREATE TABLE table_203_871 ( id number, "#" number, "player" text, "pos" text, "pts" number, "tries" number, "conv" number, "pens" number, "drop" number, "opposition" text, "venue" text, "date" text ) -- Using valid SQLite, answer the following questions for the tables ...
SELECT "player" FROM table_203_871 WHERE id = 1
squall
CREATE TABLE table_42917 ( "m\u00e5cha" text, "indicative" text, "imperative" text, "subjunctive" text, "inverse subjunctive" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What inverse subjunctive has as the imperative and a subjunctive of se m cha...
SELECT "inverse subjunctive" FROM table_42917 WHERE "imperative" = '—' AND "subjunctive" = 'se måchadn'
wikisql
CREATE TABLE table_name_76 ( term_in_office VARCHAR, electorate VARCHAR, state VARCHAR, party VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which term in office has a qld state, a Party of labor, and an Electorate of fisher?
SELECT term_in_office FROM table_name_76 WHERE state = "qld" AND party = "labor" AND electorate = "fisher"
sql_create_context
CREATE TABLE Documents ( document_id INTEGER, document_type_code VARCHAR(10), grant_id INTEGER, sent_date DATETIME, response_received_date DATETIME, other_details VARCHAR(255) ) CREATE TABLE Grants ( grant_id INTEGER, organisation_id INTEGER, grant_amount DECIMAL(19,4), grant_st...
SELECT outcome_description, COUNT(outcome_description) FROM Research_Outcomes AS T1 JOIN Project_Outcomes AS T2 ON T1.outcome_code = T2.outcome_code GROUP BY outcome_description ORDER BY outcome_description DESC
nvbench
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, Mark...
SELECT COUNT(*) FROM Users WHERE DisplayName LIKE 'Abby %' AND WebsiteUrl LIKE '%twitter%'
sede
CREATE TABLE table_name_40 ( score VARCHAR, money___$__ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the score for the player who won $3,600?
SELECT score FROM table_name_40 WHERE money___$__ = "3,600"
sql_create_context
CREATE TABLE table_72533 ( "Player" text, "Position" text, "Starter" text, "Touchdowns" real, "Extra points" real, "Field goals" real, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the most field goals
SELECT MAX("Field goals") FROM table_72533
wikisql
CREATE TABLE table_53833 ( "Year" text, "Winner" text, "Jockey" text, "Trainer" text, "Owner" text, "Distance" text, "Time" text, "Purse" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year did jockey Ramon Dominguez have a distance...
SELECT "Year" FROM table_53833 WHERE "Distance" = '1-1/16' AND "Jockey" = 'ramon dominguez'
wikisql
CREATE TABLE table_73867 ( "Constituency" text, "Candidate" text, "Affiliation" text, "Result - votes" real, "Result - %" text, "Loss/gain" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the largest vote result if loss/gain is -0.5%?
SELECT MAX("Result - votes") FROM table_73867 WHERE "Loss/gain" = '-0.5%'
wikisql
CREATE TABLE table_36845 ( "Game" real, "December" real, "Opponent" text, "Score" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum for December when the record was 22-12-5?
SELECT SUM("December") FROM table_36845 WHERE "Record" = '22-12-5'
wikisql
CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP...
SELECT PROF_OFFICE, COUNT(PROF_OFFICE) FROM PROFESSOR AS T1 JOIN EMPLOYEE AS T2 ON T1.EMP_NUM = T2.EMP_NUM GROUP BY PROF_OFFICE ORDER BY COUNT(PROF_OFFICE) DESC
nvbench
CREATE TABLE table_22851 ( "Year" real, "Worldwide" real, "Africa" real, "America" real, "Asia" real, "Australia" real, "Europe" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many members did Africa have the year that Australia had 9461...
SELECT "Africa" FROM table_22851 WHERE "Australia" = '94615'
wikisql
CREATE TABLE table_2533 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Opponent in the final" text, "Score in the final" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- List the total number of years that have a score of 3 6...
SELECT COUNT("Year") FROM table_2533 WHERE "Score in the final" = '3–6, 4–6, 2–6'
wikisql