context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_62796 ( "Number" text, "Previous Number(s)" real, "Previous Class" text, "Converted" real, "Withdrawn" real, "Disposal" text )
With a previous number of 68165, what is the oldest converted date?
SELECT MAX("Converted") FROM table_62796 WHERE "Previous Number(s)" = '68165'
wikisql
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TAB...
what were the three most frequently ordered lab tests for patients who had previously received pulmonary artery catheter placement during the same month, since 2103?
SELECT t3.labname FROM (SELECT t2.labname, 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 = 'pulmonary artery catheter placement' AND STRFTIME('%...
eicu
CREATE TABLE table_name_56 ( score VARCHAR, date VARCHAR )
What was the score on June 28, 2009?
SELECT score FROM table_name_56 WHERE date = "june 28, 2009"
sql_create_context
CREATE TABLE authorship ( authid number, instid number, paperid number, authorder number ) CREATE TABLE authors ( authid number, lname text, fname text ) CREATE TABLE papers ( paperid number, title text ) CREATE TABLE inst ( instid number, name text, country text )
Find the number of papers published by the institution 'University of Pennsylvania'.
SELECT COUNT(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Pennsylvania"
spider
CREATE TABLE table_67119 ( "State ranked in partisan order" text, "Percentage Republicans" text, "Percentage Democrats" text, "Republican/ Democratic" text, "Republican seat plurality" text )
What is the ratio of Republicans to Democrats in South Carolina?
SELECT "Republican/ Democratic" FROM table_67119 WHERE "State ranked in partisan order" = 'south carolina'
wikisql
CREATE TABLE table_8624 ( "Discipline" text, "Championship" text, "Circuit" text, "Session" text, "Cause" text )
Which championship had a Circuit of le mans?
SELECT "Championship" FROM table_8624 WHERE "Circuit" = 'le mans'
wikisql
CREATE TABLE table_name_14 ( college_junior_club_team__league_ VARCHAR, player VARCHAR )
What College/junior/club team (league) did mitch fadden play for?
SELECT college_junior_club_team__league_ FROM table_name_14 WHERE player = "mitch fadden"
sql_create_context
CREATE TABLE table_name_55 ( score VARCHAR, opponent VARCHAR )
What is the Score with an Opponent that is flavia pennetta?
SELECT score FROM table_name_55 WHERE opponent = "flavia pennetta"
sql_create_context
CREATE TABLE table_name_47 ( tries_for VARCHAR, losing_bonus VARCHAR )
what is the tries fow when losing bonus is losing bonus?
SELECT tries_for FROM table_name_47 WHERE losing_bonus = "losing bonus"
sql_create_context
CREATE TABLE table_46571 ( "Number" real, "Builder" text, "Type" text, "Date" real, "Works number" real )
What is the sum of number with type 0-4-4 forney locomotive, number smaller than 20 and works number of 1251?
SELECT COUNT("Date") FROM table_46571 WHERE "Type" = '0-4-4 forney locomotive' AND "Number" < '20' AND "Works number" = '1251'
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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
what is lab test category of subject id 6983?
SELECT lab."CATEGORY" FROM lab WHERE lab.subject_id = "6983"
mimicsql_data
CREATE TABLE Student_Course_Enrolment ( registration_id INTEGER, student_id INTEGER, course_id INTEGER, date_of_enrolment DATETIME, date_of_completion DATETIME ) CREATE TABLE Course_Authors_and_Tutors ( author_id INTEGER, author_tutor_ATB VARCHAR(3), login_name VARCHAR(40), password...
Return a histogram on what is the name of each course and the corresponding number of student enrollment?, could you list in desc by the x axis?
SELECT course_name, COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY course_name DESC
nvbench
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...
tell me the total dose of desitin dosage that patient 13841 had been prescribed since 160 months ago?
SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13841) AND prescriptions.drug = 'desitin' AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-160 month')
mimic_iii
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost numbe...
what are the cost of diagnosis for acute lung injury - etiology unknown?
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'diagnosis' AND cost.eventid IN (SELECT diagnosis.diagnosisid FROM diagnosis WHERE diagnosis.diagnosisname = 'acute lung injury - etiology unknown')
eicu
CREATE TABLE table_77763 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
What is the low attendance rate against buffalo bills?
SELECT MIN("Attendance") FROM table_77763 WHERE "Opponent" = 'buffalo bills'
wikisql
CREATE TABLE table_name_77 ( to_par VARCHAR, place VARCHAR, score VARCHAR )
What is the To par of the T6 Place Player with a Score of 68-69-70=207?
SELECT to_par FROM table_name_77 WHERE place = "t6" AND score = 68 - 69 - 70 = 207
sql_create_context
CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TE...
List the number of areas of all appellations in the bar chart, rank by the total number from high to low.
SELECT Area, COUNT(Area) FROM appellations GROUP BY Area ORDER BY COUNT(Area) DESC
nvbench
CREATE TABLE table_35138 ( "Hand" text, "1 credit" text, "2 credits" text, "3 credits" text, "4 credits" text, "5 credits" text )
What is listed for 5 credits that has 1 credit of 300?
SELECT "5 credits" FROM table_35138 WHERE "1 credit" = '300'
wikisql
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversa...
Answers with scores over 20 in 2012.
SELECT * FROM Posts WHERE YEAR(CreationDate) = 2012 AND Score > 20
sede
CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_fli...
show me the flights from ATLANTA to BALTIMORE
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIM...
atis
CREATE TABLE table_2538117_5 ( founding_university VARCHAR, letters VARCHAR )
What was the founding university of ?
SELECT founding_university FROM table_2538117_5 WHERE letters = "ΑΕΦ"
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...
这个99402446411医护就诊里面的个人自理金额能有多少钱?
SELECT t_kc24.PER_SOL FROM t_kc24 JOIN t_kc21_t_kc24 JOIN t_kc21 ON t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID AND t_kc21_t_kc24.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '99402446411'
css
CREATE TABLE table_19789 ( "Year" real, "Mens singles" text, "Womens singles" text, "Mens doubles" text, "Womens doubles" text, "Mixed doubles" text )
How may women doubles winner were there when Philippe Aulner was mens singles winner?
SELECT COUNT("Womens doubles") FROM table_19789 WHERE "Mens singles" = 'Philippe Aulner'
wikisql
CREATE TABLE Movie ( mID int, title text, year int, director text ) CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date )
Show me a bar chart for how many movie reviews does each director get?, and I want to display by the y axis in descending please.
SELECT director, COUNT(*) FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Po...
Questions per tag ever before.
SELECT TagName, COUNT(p.Id) AS k FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE p.PostTypeId = 1 GROUP BY TagName ORDER BY COUNT(p.Id) DESC
sede
CREATE TABLE table_39115 ( "Tournament" text, "1998" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text, "2013" text )
2006 of 10 4 is in which 2000?
SELECT "2000" FROM table_39115 WHERE "2006" = '10–4'
wikisql
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid num...
what are the four most frequently ordered lab tests for patients who had previously received beta blocker within the same month, during the previous year?
SELECT t3.labname FROM (SELECT t2.labname, 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 = 'beta blocker' AND DATETIME(treatment.treatmenttime, ...
eicu
CREATE TABLE table_74657 ( "Party" text, "Seats" text, "Net gain/loss" text, "% of seats" text, "% of votes" text )
When the Swedish People's Party had a net gain/loss of 0, how many seats did they have?
SELECT "Seats" FROM table_74657 WHERE "Net gain/loss" = '0' AND "Party" = 'swedish people''s party'
wikisql
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...
what was the first time patient 027-73025 during their last hospital encounter received a lab test?
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-73025' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitala...
eicu
CREATE TABLE table_23315271_2 ( location VARCHAR, circuit VARCHAR )
In which location is aci vallelunga circuit?
SELECT location FROM table_23315271_2 WHERE circuit = "ACI Vallelunga circuit"
sql_create_context
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
患者被门诊诊断为口齿病(龋齿病)的检测指标559847的参考值范围下限和上限是多少
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM mzjzjlb JOIN jybgb JOIN jyjgzbb ON mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE mzjzjlb.JZZDSM = '口齿病(龋齿病)' AND jyjgzbb.JCZBDM = '559847'
css
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABL...
has 3% citrate been administered to patient 18866 on the first hospital visit?
SELECT COUNT(*) > 0 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 = 18866 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND inputevents_cv.it...
mimic_iii
CREATE TABLE table_72968 ( "English ( BCP )" text, "Writing system 1 (English-based)" text, "Writing system 2 (German-based)" text, "Modern German (close translation)" text, "Modern German (standard wording)" text )
What is the english (bcp) phrase 'for thine is the kingdom, the power' in modern german with standard wording?
SELECT "Modern German (standard wording)" FROM table_72968 WHERE "English ( BCP )" = 'For thine is the kingdom, the power'
wikisql
CREATE TABLE table_1449169_1 ( common VARCHAR, area__km_2__ VARCHAR )
Which common has an area (km2) of 38.38?
SELECT common FROM table_1449169_1 WHERE area__km_2__ = "38.38"
sql_create_context
CREATE TABLE hall_of_fame ( player_id TEXT, yearid INTEGER, votedby TEXT, ballots NUMERIC, needed NUMERIC, votes NUMERIC, inducted TEXT, category TEXT, needed_note TEXT ) CREATE TABLE player ( player_id TEXT, birth_year NUMERIC, birth_month NUMERIC, birth_day NUMERIC...
Bar chart x axis year y axis the number of year, sort y-axis in descending order.
SELECT year, COUNT(year) FROM home_game ORDER BY COUNT(year) DESC
nvbench
CREATE TABLE table_30999 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Series" text )
What was the final in the game that boris diaw (34) scored the most points?
SELECT "Score" FROM table_30999 WHERE "High points" = 'Boris Diaw (34)'
wikisql
CREATE TABLE table_76798 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Heat points" real, "Opponents" real, "Record" text, "Streak" text )
What is the highest Game, when Opponents is less than 80, and when Record is '1-0'?
SELECT MAX("Game") FROM table_76798 WHERE "Opponents" < '80' AND "Record" = '1-0'
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, ...
由于使用酒精引起的精神病性障碍的患者的在门诊诊断为检测指标686489的参考值范围下限是什么?上限是什么?
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM mzjzjlb JOIN jyjgzbb ON mzjzjlb.YLJGDM = jyjgzbb.jybgb_YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jyjgzbb.jybgb_JZLSH_MZJZJLB WHERE mzjzjlb.JZZDSM = '由于使用酒精引起的精神病性障碍' AND jyjgzbb.JCZBDM = '686489'
css
CREATE TABLE table_27045 ( "Episode" real, "First Air Date" text, "Rating (18\u201349)" text, "Share (18\u201349)" real, "Viewers (millions)" text, "Rank (timeslot)" text, "Rank (night)" text )
what episode number had 11.73 million viewers?
SELECT "Episode" FROM table_27045 WHERE "Viewers (millions)" = '11.73'
wikisql
CREATE TABLE table_name_99 ( nielsen_ranking VARCHAR, season VARCHAR )
What is the Nielsen ranking for Season 8?
SELECT nielsen_ranking FROM table_name_99 WHERE season = "season 8"
sql_create_context
CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, ...
what is the average cost of a hospital that involves a drug named lithium carbonate since 2105?
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'lithium carbonate') AND STRFTIME('%y', cost.chargetime) >= '2105' GROUP BY cost.hadm_id) AS t1
mimic_iii
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,...
有几个科室在医院9144989最长医疗住院时长少于20天的?
SELECT COUNT(*) FROM (SELECT t_kc21.MED_ORG_DEPT_CD FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '9144989' GROUP BY t_kc21.MED_ORG_DEPT_CD HAVING MAX(t_kc21.IN_HOSP_DAYS) < 20) AS T
css
CREATE TABLE table_10575 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Replaced by" text, "Date of appointment" text )
I want the team for replaced by mark mcghee
SELECT "Team" FROM table_10575 WHERE "Replaced by" = 'mark mcghee'
wikisql
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE hz_info ( KH text, KLX number...
叫鲁秀筠的患者的检验报告单的报告日期在零二年二月二十三日以前,这些报告单所对应的门诊就诊的流水号是什么
SELECT zzmzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN zzmzjzjlb 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 WHERE person_info.XM = '鲁秀筠' AND NOT zzmzjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ >= '2002-02-2...
css
CREATE TABLE table_name_7 ( score VARCHAR, record VARCHAR )
What was the score when the record 56-46 was met?
SELECT score FROM table_name_7 WHERE record = "56-46"
sql_create_context
CREATE TABLE table_42560 ( "Driver" text, "Team" text, "Laps" real, "Time/Retired" text, "Grid" real )
What is the mean number of laps when the grid is less than 19 and time/retired is +21.3 secs?
SELECT AVG("Laps") FROM table_42560 WHERE "Grid" < '19' AND "Time/Retired" = '+21.3 secs'
wikisql
CREATE TABLE table_28367242_1 ( area__km²_ VARCHAR, corporate_name VARCHAR )
What is the area of the corporation named the powell river, the corporation of the city of?
SELECT area__km²_ FROM table_28367242_1 WHERE corporate_name = "Powell River, The Corporation of the City of"
sql_create_context
CREATE TABLE schedule ( cinema_id number, film_id number, date text, show_times_per_day number, price number ) CREATE TABLE film ( film_id number, rank_in_series number, number_in_season number, title text, directed_by text, original_air_date text, production_code text )...
Show each location and the number of cinemas there.
SELECT location, COUNT(*) FROM cinema GROUP BY location
spider
CREATE TABLE table_16332 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (millions)" text )
Who directed the episode 'Escape'?
SELECT "Directed by" FROM table_16332 WHERE "Title" = 'Escape'
wikisql
CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_...
i would like to fly from DENVER to PITTSBURGH
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBU...
atis
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
provide the number of patients whose diagnoses short title is abn react-cardiac cath and lab test abnormal status is delta?
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.short_title = "Abn react-cardiac cath" AND lab.flag = "delta"
mimicsql_data
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TA...
how much is the diagnosis price for acute respiratory failure - due to obstructive lung disease.
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'diagnosis' AND cost.eventid IN (SELECT diagnosis.diagnosisid FROM diagnosis WHERE diagnosis.diagnosisname = 'acute respiratory failure - due to obstructive lung disease')
eicu
CREATE TABLE table_name_67 ( district VARCHAR, result VARCHAR, incumbent VARCHAR )
Which district has a retired republican hold and an incumbent of rufus p. spalding?
SELECT district FROM table_name_67 WHERE result = "retired republican hold" AND incumbent = "rufus p. spalding"
sql_create_context
CREATE TABLE takes ( id text, course_id text, sec_id text, semester text, year number, grade text ) CREATE TABLE instructor ( id text, name text, dept_name text, salary number ) CREATE TABLE prereq ( course_id text, prereq_id text ) CREATE TABLE section ( course_id...
How many students and instructors are in each department?
SELECT COUNT(DISTINCT T2.id), COUNT(DISTINCT T3.id), T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name GROUP BY T3.dept_name
spider
CREATE TABLE table_name_60 ( attendance VARCHAR, week VARCHAR )
How many people attended the game in week 13?
SELECT attendance FROM table_name_60 WHERE week = 13
sql_create_context
CREATE TABLE mzjzjlb_jybgb ( YLJGDM_MZJZJLB text, BGDH number, YLJGDM number ) 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.SG, mzjzjlb.TZ 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 = '谢天心'
css
CREATE TABLE table_61080 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What is the Tie no when Scarborough is the Home team?
SELECT "Tie no" FROM table_61080 WHERE "Home team" = 'scarborough'
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
What is the number of patients who had a lymphocytes lab test and stayed in the hospital for more than 26 days?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "26" AND lab.label = "Lymphocytes"
mimicsql_data
CREATE TABLE table_39765 ( "Season" real, "Bowl game" text, "Result" text, "Opponent" text, "Stadium" text, "Location" text, "Attendance" text )
What location has 51,212 as the attendance?
SELECT "Location" FROM table_39765 WHERE "Attendance" = '51,212'
wikisql
CREATE TABLE table_60783 ( "Region" text, "Year" text, "Label" text, "Format" text, "Catalog" text )
Which region had a year March 10, 1998?
SELECT "Region" FROM table_60783 WHERE "Year" = 'march 10, 1998'
wikisql
CREATE TABLE table_18994724_1 ( director_s_ VARCHAR, film_title_used_in_nomination VARCHAR )
Who directed the film Gomorra?
SELECT director_s_ FROM table_18994724_1 WHERE film_title_used_in_nomination = "Gomorra"
sql_create_context
CREATE TABLE table_name_60 ( game VARCHAR, location_attendance VARCHAR )
What game was located at the Los Angeles Memorial Sports Arena?
SELECT game FROM table_name_60 WHERE location_attendance = "los angeles memorial sports arena"
sql_create_context
CREATE TABLE table_name_31 ( league VARCHAR, playoffs VARCHAR )
Which league had a playoffs result of a lost semifinal?
SELECT league FROM table_name_31 WHERE playoffs = "lost semifinal"
sql_create_context
CREATE TABLE table_72283 ( "Name" text, "Alt name" text, "Launch date" text, "ID" text, "Mass (kg)" real, "Decay date" text, "Perigee (km)" real, "Apogee (km)" real, "Inclination" text )
What is the maximum apogee for samos f3-3?
SELECT MAX("Apogee (km)") FROM table_72283 WHERE "Name" = 'SAMOS F3-3'
wikisql
CREATE TABLE phone_market ( Market_ID int, Phone_ID text, Num_of_stock int ) CREATE TABLE phone ( Name text, Phone_ID int, Memory_in_G int, Carrier text, Price real ) CREATE TABLE market ( Market_ID int, District text, Num_of_employees int, Num_of_shops real, Rankin...
Bar chart x axis carrier y axis the number of carrier, and rank by the Y in ascending.
SELECT Carrier, COUNT(Carrier) FROM phone GROUP BY Carrier ORDER BY COUNT(Carrier)
nvbench
CREATE TABLE Asset_Parts ( asset_id INTEGER, part_id INTEGER ) CREATE TABLE Fault_Log_Parts ( fault_log_entry_id INTEGER, part_fault_id INTEGER, fault_status VARCHAR(10) ) CREATE TABLE Skills ( skill_id INTEGER, skill_code VARCHAR(20), skill_description VARCHAR(255) ) CREATE TABLE Ass...
How many assets can each parts be used in? List the part name and the number.
SELECT part_name, COUNT(*) FROM Parts AS T1 JOIN Asset_Parts AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name
nvbench
CREATE TABLE country ( country_id number, country text, last_update time ) CREATE TABLE film ( film_id number, title text, description text, release_year time, language_id number, original_language_id number, rental_duration number, rental_rate number, length number, ...
Return the sum of all payment amounts.
SELECT SUM(amount) FROM payment
spider
CREATE TABLE table_name_43 ( pilot_s_ VARCHAR, location VARCHAR )
Who was the pilot at lake dumbleyung?
SELECT pilot_s_ FROM table_name_43 WHERE location = "lake dumbleyung"
sql_create_context
CREATE TABLE table_name_8 ( language VARCHAR, percentage___percentage_ VARCHAR )
Which language has the percentage of 2.54?
SELECT language FROM table_name_8 WHERE percentage___percentage_ = "2.54"
sql_create_context
CREATE TABLE table_70090 ( "Project" text, "Year" text, "Location" text, "Capacity" real, "Suites" text, "Architect" text, "Cost" text )
Where is the Eren Talu bidding project located?
SELECT "Location" FROM table_70090 WHERE "Project" = 'eren talu bidding project'
wikisql
CREATE TABLE bridge ( architect_id number, id number, name text, location text, length_meters number, length_feet number ) CREATE TABLE architect ( id text, name text, nationality text, gender text ) CREATE TABLE mill ( architect_id number, id number, location text,...
What are the distinct types of mills that are built by American or Canadian architects?
SELECT DISTINCT T1.type FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id WHERE T2.nationality = 'American' OR T2.nationality = 'Canadian'
spider
CREATE TABLE table_13119 ( "Mark" text, "Wind*" text, "Athlete" text, "Nationality" text, "Venue" text, "Date" text )
Which Mark has an Athlete of tatyana lebedeva?
SELECT "Mark" FROM table_13119 WHERE "Athlete" = 'tatyana lebedeva'
wikisql
CREATE TABLE hz_info_mzjzjlb ( JZLSH number, YLJGDM number, mzjzjlb_id number ) 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 t...
慢性牙周炎的患者,门诊诊断的α-羟丁酸脱氢酶数值的平均值以及最值具体均是?
SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH AND hz_info_mzjzjlb.JZLSH = mzjzjl...
css
CREATE TABLE table_name_52 ( grand_final_dual_television_commentator VARCHAR, spokesperson VARCHAR )
What is the grand final dual television commentator status of the year when Amaury Vassili was the spokesperson?
SELECT grand_final_dual_television_commentator FROM table_name_52 WHERE spokesperson = "amaury vassili"
sql_create_context
CREATE TABLE Affiliated_With ( Physician INTEGER, Department INTEGER, PrimaryAffiliation BOOLEAN ) CREATE TABLE Appointment ( AppointmentID INTEGER, Patient INTEGER, PrepNurse INTEGER, Physician INTEGER, Start DATETIME, End DATETIME, ExaminationRoom TEXT ) CREATE TABLE Departme...
Find the number of medications prescribed for each brand.
SELECT Name, COUNT(*) FROM Medication AS T1 JOIN Prescribes AS T2 ON T1.Code = T2.Medication GROUP BY T1.Brand
nvbench
CREATE TABLE Team ( id INTEGER, team_api_id INTEGER, team_fifa_api_id INTEGER, team_long_name TEXT, team_short_name TEXT ) CREATE TABLE sqlite_sequence ( name any, seq any ) CREATE TABLE Player ( id INTEGER, player_api_id INTEGER, player_name TEXT, player_fifa_api_id INTEGE...
, and show in descending by the Y.
SELECT preferred_foot, COUNT(*) FROM Player_Attributes WHERE overall_rating > 80 GROUP BY preferred_foot ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_name_54 ( finish VARCHAR, year_s__won VARCHAR )
What was the finish of the winner of the 2000 Masters?
SELECT finish FROM table_name_54 WHERE year_s__won = "2000"
sql_create_context
CREATE TABLE workshop ( Workshop_ID int, Date text, Venue text, Name text ) CREATE TABLE Acceptance ( Submission_ID int, Workshop_ID int, Result text ) CREATE TABLE submission ( Submission_ID int, Scores real, Author text, College text )
Visualize a bar chart for how many authors submit to the workshop.
SELECT Author, COUNT(Author) FROM submission GROUP BY Author
nvbench
CREATE TABLE table_20305 ( "Episode" text, "Broadcast date" text, "Run time" text, "Viewers (in millions)" text, "Archive" text )
What date was an episode with a run time of 24:30 broadcasted?
SELECT "Broadcast date" FROM table_20305 WHERE "Run time" = '24:30'
wikisql
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), ...
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of job_id and commission_pct , and order by the X-axis in desc.
SELECT JOB_ID, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY JOB_ID DESC
nvbench
CREATE TABLE table_45909 ( "Winner" text, "Country" text, "Winter Olympics" text, "FIS Nordic World Ski Championships" text, "Holmenkollen" text )
Which Holmenkollen has a Country of norway, and a Winner of tom sandberg?
SELECT "Holmenkollen" FROM table_45909 WHERE "Country" = 'norway' AND "Winner" = 'tom sandberg'
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
Out of the total number of patients admitted to emergency, calculate the number of those on Medicaid insurance.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.insurance = "Medicaid"
mimicsql_data
CREATE TABLE product_characteristics ( product_id number, characteristic_id number, product_characteristic_value text ) CREATE TABLE ref_colors ( color_code text, color_description text ) CREATE TABLE products ( product_id number, color_code text, product_category_code text, produc...
What are the names of the products that have a color description of 'red' and the 'fast' characteristic?
SELECT product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN characteristics AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "red" AND t3.characteristic_name = "fast"
spider
CREATE TABLE table_54037 ( "Year" real, "Single" text, "Chart" text, "Position" real, "Weeks on chart" real )
What is the sum of the weeks on a chart a song with a position less than 1 haas?
SELECT SUM("Weeks on chart") FROM table_54037 WHERE "Position" < '1'
wikisql
CREATE TABLE table_48571 ( "Position" real, "Driver / Passenger" text, "Equipment" text, "Bike No" real, "Points" real )
What is the lowest Bike No, when Driver / Passenger is Joris Hendrickx / Kaspars Liepins, and when Position is less than 4?
SELECT MIN("Bike No") FROM table_48571 WHERE "Driver / Passenger" = 'joris hendrickx / kaspars liepins' AND "Position" < '4'
wikisql
CREATE TABLE table_name_36 ( road_team VARCHAR, result VARCHAR )
What is Road Team, when Result is '74-71'?
SELECT road_team FROM table_name_36 WHERE result = "74-71"
sql_create_context
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartr...
what were the five most frequently prescribed medications until 2 years ago?
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-2 year') GROUP BY medication.drugname) AS t1 WHERE t1.c1 <= 5
eicu
CREATE TABLE table_name_35 ( to_par_ VARCHAR, a_ VARCHAR, course VARCHAR, year VARCHAR )
What's the To par of St Andrews before the year 1888?
SELECT to_par_ AS "a_" FROM table_name_35 WHERE course = "st andrews" AND year < 1888
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
find the number of patients who have ed route of drug administration and diagnosed with chronic systolic and diastolic heart failure.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Chronic combined systolic and diastolic heart failure" AND prescriptions.route = "ED"
mimicsql_data
CREATE TABLE table_name_75 ( main_use VARCHAR, country VARCHAR, name VARCHAR )
What is the Main use of transmitter solt in Hungary?
SELECT main_use FROM table_name_75 WHERE country = "hungary" AND name = "transmitter solt"
sql_create_context
CREATE TABLE table_204_174 ( id number, "rank" number, "name" text, "nationality" text, "result" number, "notes" text )
what is the last nationality on the list ?
SELECT "nationality" FROM table_204_174 ORDER BY id DESC LIMIT 1
squall
CREATE TABLE table_19090 ( "Season" real, "Race Name" text, "Winning Driver" text, "Chassis" text, "Engine" text, "Tires" text, "Team" text )
In what year did Tom Sneva win a race?
SELECT "Season" FROM table_19090 WHERE "Winning Driver" = 'Tom Sneva'
wikisql
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 aircraft (...
show me all flights from PHOENIX to MILWAUKEE on wednesday
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 = 'MILWAUKEE' AND date_day.day_number = 23 AND date_day.month_number = 4 AND...
atis
CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_p...
What classes involve Special Naval Architecture and Marine Engineering and Orthodontics Practice Management and Transitions ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id WHERE (area.area LIKE '%Orthodontics Practice Management and Transitions%' OR course.description LIKE '%Orthodontics Practice Management and Transitions%' OR course.name LIKE '%Orthodontics Pra...
advising
CREATE TABLE table_name_53 ( source VARCHAR, name VARCHAR )
What source has delph as the name?
SELECT source FROM table_name_53 WHERE name = "delph"
sql_create_context
CREATE TABLE zyjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, ...
列出患者43772576所有检验结果指标记录中的仪器编号以及名称在2005-02-16到2014-01-13内均为什么?
SELECT jyjgzbb.YQBH, jyjgzbb.YQMC FROM hz_info JOIN mzjzjlb JOIN zyjybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZJZJLB AND zyjybgb.YLJGDM = jyjgzbb.YLJGDM AND zyjybgb.BGDH = ...
css
CREATE TABLE table_9051 ( "Date" text, "Venue" text, "Score" text, "Competition" text, "Report" text )
What was the Venue on November 14, 2007?
SELECT "Venue" FROM table_9051 WHERE "Date" = 'november 14, 2007'
wikisql
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) 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 admissions ( ...
when was patient 71320 for the first time admitted to the hospital since 2103?
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 71320 AND STRFTIME('%y', admissions.admittime) >= '2103' ORDER BY admissions.admittime LIMIT 1
mimic_iii
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, ...
Count the number of married patients who had a wbc pleural lab test done.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "MARRIED" AND lab.label = "WBC, Pleural"
mimicsql_data
CREATE TABLE table_10361625_1 ( player_name VARCHAR, position VARCHAR, college VARCHAR )
What is the name of the linebacker at Illinois college?
SELECT player_name FROM table_10361625_1 WHERE position = "Linebacker" AND college = "Illinois"
sql_create_context