context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_name_52 ( parent VARCHAR, height__m_ VARCHAR, prom__m_ VARCHAR )
Which Parent has height smaller than 756 and a Prom of 39?
SELECT parent FROM table_name_52 WHERE height__m_ < 756 AND prom__m_ = 39
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 ...
哪些医务人员在2012年5月30日到2014年9月25日期间为患者朱清佳检测指标204728的,提供一下工号及姓名
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb 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 AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jy...
css
CREATE TABLE table_name_81 ( name VARCHAR, event VARCHAR )
Who has the event of 36 arrow finals?
SELECT name FROM table_name_81 WHERE event = "36 arrow finals"
sql_create_context
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE jybgb ( BBCJBW text, BBDM tex...
住院就诊42916483908的门诊中,主要诊断的名称是什么?列出名称列表、编码类型和编码列表、
SELECT wdmzjzjlb.MZBMLX, wdmzjzjlb.MZZDBM, wdmzjzjlb.MZZDMC FROM wdmzjzjlb WHERE wdmzjzjlb.JZLSH = '42916483908' UNION SELECT bdmzjzjlb.MZBMLX, bdmzjzjlb.MZZDBM, bdmzjzjlb.MZZDMC FROM bdmzjzjlb WHERE bdmzjzjlb.JZLSH = '42916483908'
css
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
get me the number of patients with lab test item id 51025 who died in the year 2126 or before that.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2126.0" AND lab.itemid = "51025"
mimicsql_data
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...
Visualize a bar chart about the distribution of ACC_Regular_Season and School_ID .
SELECT ACC_Regular_Season, School_ID FROM basketball_match
nvbench
CREATE TABLE table_name_98 ( laps INTEGER, finish VARCHAR )
What is the highest number of laps that also has a finish total of 8?
SELECT MAX(laps) FROM table_name_98 WHERE finish = "8"
sql_create_context
CREATE TABLE table_name_33 ( nationality VARCHAR, name VARCHAR )
Which Nationality has a Name of janne happonen?
SELECT nationality FROM table_name_33 WHERE name = "janne happonen"
sql_create_context
CREATE TABLE table_40306 ( "Date" text, "Result" text, "Opponent" text, "Location" text, "Method" text, "Round" real, "Record" text )
Which Opponent has a Method of tko, and a Location of elgin, illinois, usa on 2001-02-11?
SELECT "Opponent" FROM table_40306 WHERE "Method" = 'tko' AND "Location" = 'elgin, illinois, usa' AND "Date" = '2001-02-11'
wikisql
CREATE TABLE table_name_27 ( student_body VARCHAR, affiliation VARCHAR, enrollment VARCHAR )
What's the Student Body with an Affiliation of Roman Catholic and has an Enrollment of 502?
SELECT student_body FROM table_name_27 WHERE affiliation = "roman catholic" AND enrollment = 502
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...
统计医疗记录中医院0652199的出院诊断为H88.444的最低医疗费总额和最高医疗费总额分别是多少钱?
SELECT MIN(t_kc24.MED_AMOUT), MAX(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.t_kc21_MED_SER_ORG_NO = '0652199' AND t_kc24.t_kc21_OUT_DIAG_DIS_CD = 'H88.444')
css
CREATE TABLE table_name_33 ( total INTEGER, year_s__won VARCHAR )
Total for 1994, 1997 years won?
SELECT SUM(total) FROM table_name_33 WHERE year_s__won = "1994, 1997"
sql_create_context
CREATE TABLE table_46342 ( "Title" text, "Release date" text, "Format" text, "Code" text, "UK Singles Chart" text, "US Modern Rock" text, "Album" text )
What is the format of code 9 40231-2 (us only)?
SELECT "Format" FROM table_46342 WHERE "Code" = '9 40231-2 (us only)'
wikisql
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, ...
what is average days of hospital stay of patients whose year of death is less than 2186?
SELECT AVG(demographic.days_stay) FROM demographic WHERE demographic.dod_year < "2186.0"
mimicsql_data
CREATE TABLE table_name_42 ( first VARCHAR, surname VARCHAR )
Which First has a Surname of searle?
SELECT first FROM table_name_42 WHERE surname = "searle"
sql_create_context
CREATE TABLE table_204_57 ( id number, "year" number, "film" text, "role" text, "language" text, "notes" text )
what was the only movie madhurima play in during the year 2012 ?
SELECT "film" FROM table_204_57 WHERE "year" = 2012
squall
CREATE TABLE table_204_459 ( id number, "date" text, "time" text, "opponent" text, "site" text, "tv" text, "result" text, "attendance" number, "record" text )
what was the total attendance at the wright state and loyola games ?
SELECT SUM("attendance") FROM table_204_459 WHERE "opponent" IN ('wright state', 'loyola')
squall
CREATE TABLE table_name_74 ( runner_s__up VARCHAR, winning_score VARCHAR )
Who were the Runner(s)-up with the winning score of 16 (66-68-70-68=272)?
SELECT runner_s__up FROM table_name_74 WHERE winning_score = −16(66 - 68 - 70 - 68 = 272)
sql_create_context
CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numci...
How many papers are presented in acl 2016 ?
SELECT DISTINCT COUNT(paper.paperid) FROM paper, venue WHERE paper.year = 2016 AND venue.venueid = paper.venueid AND venue.venuename = 'acl'
scholar
CREATE TABLE table_10118412_6 ( filipino VARCHAR, indian VARCHAR )
How many States have an Indian population of 30947?
SELECT COUNT(filipino) FROM table_10118412_6 WHERE indian = 30947
sql_create_context
CREATE TABLE country ( country_id number, name text, population number, area number, languages text ) CREATE TABLE roller_coaster ( roller_coaster_id number, name text, park text, country_id number, length number, height number, speed text, opened text, status te...
Show the names of roller coasters and names of country they are in.
SELECT T2.name, T1.name FROM country AS T1 JOIN roller_coaster AS T2 ON T1.country_id = T2.country_id
spider
CREATE TABLE table_7936 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What date was there a game larger than 17?
SELECT "Date" FROM table_7936 WHERE "Game" > '17'
wikisql
CREATE TABLE time_slot ( time_slot_id varchar(4), day varchar(1), start_hr numeric(2), start_min numeric(2), end_hr numeric(2), end_min numeric(2) ) CREATE TABLE instructor ( ID varchar(5), name varchar(20), dept_name varchar(20), salary numeric(8,2) ) CREATE TABLE course ( ...
How many courses with more than one prerequisite for each title? Return a bar chart.
SELECT title, COUNT(title) FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY title
nvbench
CREATE TABLE table_name_25 ( uni_number INTEGER, surname VARCHAR )
What is the uniform number of the player whose last name is Wiltshire?
SELECT MIN(uni_number) FROM table_name_25 WHERE surname = "wiltshire"
sql_create_context
CREATE TABLE table_56701 ( "League" text, "Sport" text, "Season" text, "# of Teams" real, "Games" real, "Total attendance" text, "Average attendance" real )
What was the total number of average attendance for games of 1311?
SELECT SUM("Average attendance") FROM table_56701 WHERE "Games" = '1311'
wikisql
CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), AllergyType VARCHAR(20) ) CREATE TABLE Has_Allergy ( StuID INTEGER, Allergy VARCHAR(20) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER...
Return a bar chart on what are the allergy types and how many allergies correspond to each one?, and display from low to high by the X-axis.
SELECT AllergyType, COUNT(*) FROM Allergy_Type GROUP BY AllergyType ORDER BY AllergyType
nvbench
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, return a scatter chart about the correlation between manufacturer and revenue , and group by attribute name.
SELECT T1.Manufacturer, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Name
nvbench
CREATE TABLE Elimination ( Elimination_ID text, Wrestler_ID text, Team text, Eliminated_By text, Elimination_Move text, Time text ) CREATE TABLE wrestler ( Wrestler_ID int, Name text, Reign text, Days_held text, Location text, Event text )
Show the reign and days held of wrestlers. Visualize by scatter chart.
SELECT Reign, Days_held FROM wrestler
nvbench
CREATE TABLE table_27294 ( "Freq" real, "Call" text, "City" text, "Owner" text, "Start" real, "Day Power ( W )" real, "Night Power" real, "Nickname" text, "Format" text, "Stereo" text )
In which year did the voice of muscatine show start?
SELECT "Start" FROM table_27294 WHERE "Nickname" = 'Voice of Muscatine'
wikisql
CREATE TABLE table_2639433_4 ( timeslot VARCHAR, year VARCHAR )
What was the timeslot for the episode in the year 2008?
SELECT timeslot FROM table_2639433_4 WHERE year = 2008
sql_create_context
CREATE TABLE table_41347 ( "RANK" real, "NAME" text, "TEAM" text, "COUNTRY" text, "POINTS" real )
What Country is in Rank 2?
SELECT "COUNTRY" FROM table_41347 WHERE "RANK" = '2'
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
provide the number of patients whose religion is jewish and lab test name is total protein, urine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "JEWISH" AND lab.label = "Total Protein, Urine"
mimicsql_data
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, ...
在2013年12月16日到2014年11月24日内姓名为何修明的参保人单一药品最多购买次数是多少次?
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 '2013-12-16' AND '2014-11-24' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC LIMIT 1
css
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGu...
Top users based on the number of 0-score answers.
SELECT DISTINCT OwnerUserId AS "user_link", COUNT(Id) AS "answers_count" FROM Posts WHERE PostTypeId = 1 AND Score = 0 GROUP BY OwnerUserId ORDER BY 2 DESC
sede
CREATE TABLE table_name_62 ( points INTEGER, drawn VARCHAR, games VARCHAR )
Drawn of 0, and a Games larger than 5 has what amount of highest points?
SELECT MAX(points) FROM table_name_62 WHERE drawn = 0 AND games > 5
sql_create_context
CREATE TABLE table_72763 ( "Track Name" text, "Location" text, "Length" text, "Sanction" text, "Program" text )
What programs were held at highland speedway?
SELECT "Program" FROM table_72763 WHERE "Track Name" = 'Highland Speedway'
wikisql
CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmoun...
Top 50 All Time Related Tags of Single Tag.
SELECT t1.TagName AS Tag, t2.TagName AS "Related Tag", COUNT(t2.TagName) AS "Count" FROM PostTags AS pt1 INNER JOIN Tags AS t1 ON pt1.TagId = t1.Id INNER JOIN PostTags AS pt2 ON pt1.PostId = pt2.PostId AND pt1.TagId != pt2.TagId INNER JOIN Tags AS t2 ON pt2.TagId = t2.Id INNER JOIN Posts AS A ON pt2.PostId = A.Id WHERE...
sede
CREATE TABLE table_name_15 ( rank INTEGER, time VARCHAR, lane VARCHAR )
What's the total rank of the lane smaller than 8 with a time of 59.80?
SELECT SUM(rank) FROM table_name_15 WHERE time = "59.80" AND lane < 8
sql_create_context
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE swimme...
Draw a bar chart about the distribution of meter_200 and the average of meter_100 , and group by attribute meter_200, list from high to low by the names please.
SELECT meter_200, AVG(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 DESC
nvbench
CREATE TABLE table_22683 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location" text, "Record" text )
When dydek (8) has the highest rebounds who has the highest amount of points?
SELECT "High points" FROM table_22683 WHERE "High rebounds" = 'Dydek (8)'
wikisql
CREATE TABLE activity ( actid number, activity_name text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE faculty_participates_in ( facid number, actid number ) CREATE TABLE...
How many faculty members do we have for each rank and gender?
SELECT rank, sex, COUNT(*) FROM faculty GROUP BY rank, sex
spider
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime...
tell me the total amount of gastric (ng) that patient 017-74752 has since 03/27/2102.
SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-74752')) AND intakeoutput.celllabel = 'gastr...
eicu
CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDispl...
All User Comments Starting with Most Recent.
SELECT CreationDate, Score, Text, 'http://stackoverflow.com/questions/' + CAST(PostId AS TEXT(10)) + '#comment' + CAST(Id AS TEXT(10)) + '_' + CAST(PostId AS TEXT(10)) AS Link FROM Comments WHERE UserId = @UserId ORDER BY Score DESC
sede
CREATE TABLE table_name_8 ( silver INTEGER, bronze VARCHAR, gold VARCHAR, nation VARCHAR )
What is the average silver that has a gold greater than 3, with soviet union (urs) as the nation, and a bronze greater than 26?
SELECT AVG(silver) FROM table_name_8 WHERE gold > 3 AND nation = "soviet union (urs)" AND bronze > 26
sql_create_context
CREATE TABLE table_69594 ( "Name" text, "Circuit" text, "Date" text, "Winning drivers" text, "Winning constructor" text, "Report" text )
What was the name for the race in the Miramas circuit?
SELECT "Name" FROM table_69594 WHERE "Circuit" = 'miramas'
wikisql
CREATE TABLE table_name_40 ( player VARCHAR, college VARCHAR )
Who is the player from Arizona State?
SELECT player FROM table_name_40 WHERE college = "arizona state"
sql_create_context
CREATE TABLE table_1341453_32 ( candidates VARCHAR, incumbent VARCHAR )
Who were the candidates in the district whose incumbent is Bill Pascrell?
SELECT candidates FROM table_1341453_32 WHERE incumbent = "Bill Pascrell"
sql_create_context
CREATE TABLE table_name_88 ( position INTEGER, drawn VARCHAR, lost VARCHAR, goal_difference VARCHAR )
what is the position when lot is less than 14, goal difference is +1 and drawn is more than 15?
SELECT SUM(position) FROM table_name_88 WHERE lost < 14 AND goal_difference = "+1" AND drawn > 15
sql_create_context
CREATE TABLE table_73788 ( "Series #" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Viewers (in millions)" text )
How many episodes are written by Lew Schneider?
SELECT COUNT("Series #") FROM table_73788 WHERE "Written by" = 'Lew Schneider'
wikisql
CREATE TABLE table_14810 ( "Office" text, "Representative" text, "Party" text, "Residence" text, "First Elected" text )
Which Office has a Party of rep, and a Representative of brian bosma?
SELECT "Office" FROM table_14810 WHERE "Party" = 'rep' AND "Representative" = 'brian bosma'
wikisql
CREATE TABLE table_name_8 ( player VARCHAR, span VARCHAR )
What is the player with a Span of 1998-2009?
SELECT player FROM table_name_8 WHERE span = "1998-2009"
sql_create_context
CREATE TABLE table_47942 ( "Date" text, "Opponents" text, "H / A" text, "Result F \u2013 A" text, "Scorers" text )
Who was the opponent when the H/A was H and the scorer was Ferguson?
SELECT "Opponents" FROM table_47942 WHERE "H / A" = 'h' AND "Scorers" = 'ferguson'
wikisql
CREATE TABLE table_204_516 ( id number, "date" text, "opponents" text, "h / a" text, "result\nf - a" text, "scorers" text, "attendance" number )
what was the difference in score between the two teams for the last game ?
SELECT ABS("result\nf - a" - "result\nf - a") FROM table_204_516 ORDER BY "date" DESC LIMIT 1
squall
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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL v...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, find job_id and the sum of manager_id , and group by attribute job_id, and visualize them by a bar chart, show by the X in asc.
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY JOB_ID
nvbench
CREATE TABLE table_70948 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real )
How many total points were earned with ferrari 125 Chassis after 1952?
SELECT SUM("Points") FROM table_70948 WHERE "Chassis" = 'ferrari 125' AND "Year" > '1952'
wikisql
CREATE TABLE table_203_4 ( id number, "medal" text, "name" text, "sport" text, "event" text, "date" text )
what was the total number of silver medals earned ?
SELECT COUNT(*) FROM table_203_4 WHERE "medal" = 'silver'
squall
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE patient ( uniquep...
what was the length of stay of patient 006-254232 during the last icu stay?
SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-254232') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime DESC LIMIT ...
eicu
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE microlab ( microl...
what is the average hospital cost that involves a procedure known as a antiplatelet agent - aggregation inhibitors until 2102?
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'antiplatelet agent - aggregation inhibitors'...
eicu
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...
give the number of patients whose item id is 51464 and lab test abnormal status is delta.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51464" AND lab.flag = "delta"
mimicsql_data
CREATE TABLE table_name_20 ( bronze VARCHAR, nation VARCHAR )
How many bronze medals does South Korea have?
SELECT bronze FROM table_name_20 WHERE nation = "south korea"
sql_create_context
CREATE TABLE table_name_63 ( tournament VARCHAR, outcome VARCHAR, date VARCHAR )
What is Tournament, when Outcome is Winner, and when Date is 13 July 2013?
SELECT tournament FROM table_name_63 WHERE outcome = "winner" AND date = "13 july 2013"
sql_create_context
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TAB...
Extract accepted and most-voted answer of a question.
SELECT * FROM (SELECT Id, Body, Score, DENSE_RANK() OVER (ORDER BY Score DESC) AS Rank FROM (SELECT a.Id, a.ParentId, a.Body, a.Score FROM Posts AS a WHERE a.ParentId = '##QuestionId##') AS x LIMIT 2) AS x WHERE (SELECT q.AcceptedAnswerId FROM Posts AS q WHERE q.Id = '##QuestionId##') = Id OR Rank = 1
sede
CREATE TABLE table_42838 ( "Name" text, "Seat" text, "Population (2011)" real, "Area (km 2 )" real, "Density (inhabitants/km 2 )" real )
For Stellenbosch, which has a population larger than 155,733, what is the average area?
SELECT AVG("Area (km 2 )") FROM table_42838 WHERE "Name" = 'stellenbosch' AND "Population (2011)" > '155,733'
wikisql
CREATE TABLE table_1557974_1 ( birthplace VARCHAR, debut VARCHAR )
Where were the wrestlers born who debuted in 2002-7?
SELECT birthplace FROM table_1557974_1 WHERE debut = "2002-7"
sql_create_context
CREATE TABLE table_9075 ( "Country or territory" text, "Area (km\u00b2)" real, "Population" real, "Population density (per km\u00b2)" real, "Capital" text )
What's the average area in canada with a population density (per km ) larger than 3.4?
SELECT AVG("Area (km\u00b2)") FROM table_9075 WHERE "Country or territory" = 'canada' AND "Population density (per km\u00b2)" > '3.4'
wikisql
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE allergy ( allergy...
when did patient 015-96048 first take his/her enteral novosource renal?
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-96048')) AND intakeoutput.cellpath LIKE '%intake%...
eicu
CREATE TABLE table_7831 ( "Team" text, "Head Coach" text, "City" text, "Stadium" text, "Capacity" real )
What is VFB Stuttgart II Team's Stadiuim?
SELECT "Stadium" FROM table_7831 WHERE "Team" = 'vfb stuttgart ii'
wikisql
CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ...
How many professors whose office is located in DRE 102 are hired in each month? Return a bar chart.
SELECT EMP_HIREDATE, COUNT(EMP_HIREDATE) FROM EMPLOYEE AS T1 JOIN PROFESSOR AS T2 ON T1.EMP_NUM = T2.EMP_NUM WHERE T2.PROF_OFFICE = 'DRE 102'
nvbench
CREATE TABLE table_57574 ( "Ward" text, "Bello" text, "Ben-Tahir" text, "Doucet" text, "Furtenbacher" text, "Gauthier" text, "Haydon" text, "Larter" text, "Lawrance" text, "Libweshya" text, "Liscumb" text )
What Gauthier had a 15 Liscumb?
SELECT "Gauthier" FROM table_57574 WHERE "Liscumb" = '15'
wikisql
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeri...
what is the total output of patient 022-121402 since 06/19/2102?
SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-121402')) AND intakeoutput.cellpath LIKE '%o...
eicu
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 jybgb ( BBCJBW text, BBDM tex...
患者编号为76980404的人在2001年7月25日到2018年6月20日内曾在医院就诊的次数有多少次?
SELECT (SELECT COUNT(*) 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.RYBH = '76980404' AND mzjzjlb.JZKSRQ BETWEEN '2001-07-25' AND '2018-06-20') + (SELECT COUNT(*) FROM hz_info JOIN zyjzjlb JOIN hz_info_zyjzjlb ON hz_info.YLJGDM = h...
css
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime tim...
calculate the two year survival rate among the patients who were prescribed prednisone after they were diagnosed with mitral valve disorder.
SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.subject_id, t2.charttime FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd...
mimic_iii
CREATE TABLE table_52791 ( "Tournament" text, "Winner" text, "Runner-up" text, "Score" text, "Third Place" text )
What is the name of the winner when Goran Ivani evi was in third place?
SELECT "Winner" FROM table_52791 WHERE "Third Place" = 'goran ivanišević'
wikisql
CREATE TABLE table_37667 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real )
Home of buffalo happened on what date?
SELECT "Date" FROM table_37667 WHERE "Home" = 'buffalo'
wikisql
CREATE TABLE film_actor ( actor_id number, film_id number, last_update time ) CREATE TABLE address ( address_id number, address text, address2 text, district text, city_id number, postal_code text, phone text, last_update time ) CREATE TABLE film ( film_id number, t...
What was the date of the earliest payment?
SELECT payment_date FROM payment ORDER BY payment_date LIMIT 1
spider
CREATE TABLE table_name_12 ( opponent_in_final VARCHAR, date VARCHAR )
What is Opponent in Final, when Date is '13 January 1992'?
SELECT opponent_in_final FROM table_name_12 WHERE date = "13 january 1992"
sql_create_context
CREATE TABLE table_name_55 ( overall INTEGER, round VARCHAR )
What is the overall sum of round 3?
SELECT SUM(overall) FROM table_name_55 WHERE round = 3
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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, ...
41736838这位患者的妊娠相关性血浆蛋白-A指标在08年4月18日至10月22日期间的情况
SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_info.RYBH = '...
css
CREATE TABLE table_66412 ( "Year" real, "Finish position" text, "1st day" text, "2nd day" text, "3rd day" text, "4th Day" text )
What is the 3rd day result when the 4th day was bumped Fitzwilliam?
SELECT "3rd day" FROM table_66412 WHERE "4th Day" = 'bumped fitzwilliam'
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 zyjzjlb ( CYBQDM text, CYBQMC...
18416093这个病人的检验报告结果指标均正常的有哪些?检验报告单号是什么
SELECT jybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN jybgb 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 mzjzjlb_jybgb.YLJGDM = jybgb.YLJGDM AND mzjzjlb_jybgb.BGDH ...
css
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE transfers ( r...
has patient 1232 received an sed,hyp,anxiolytc ab-con diagnosis?
SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'sed,hyp,anxiolytc ab-con') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1232)
mimic_iii
CREATE TABLE table_181892_4 ( year VARCHAR, chassis VARCHAR )
How many years was the chassis a lotus-ford 38/7?
SELECT COUNT(year) FROM table_181892_4 WHERE chassis = "Lotus-Ford 38/7"
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
count the number of patients on po/ng route of drug administration who have been diagnosed with methicillin susceptible pneumonia due to staphylococcus aureus.
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.short_title = "Meth sus pneum d/t Staph" AND prescriptions.route = "PO/NG"
mimicsql_data
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 t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_NM = '花心宜' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID...
css
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE diagnoses_icd ( row_id numbe...
what is the four most frequent drugs that were prescribed within 2 months to the patients in the same age 40s after they had been diagnosed with septic shock, since 4 years ago?
SELECT t3.drug FROM (SELECT t2.drug, 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 = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ...
mimic_iii
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, ...
did patient 51675 undergo an absolute lymphocyte count test until 3 years ago?
SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'absolute lymphocyte count') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51675) AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME...
mimic_iii
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, C...
java commenters near in entered location.
SELECT * FROM Users AS u WHERE UPPER(u.Location) LIKE UPPER('%' + '##YourLocation:string##' + '%') AND (u.Id IN (SELECT UserId FROM Comments AS c WHERE c.PostId IN (SELECT Id FROM Posts AS p WHERE UPPER(p.Tags) LIKE UPPER('%<' + '##Tag:string##' + '>%'))) OR u.Id IN (SELECT OwnerUserId FROM Posts AS p WHERE p.Tags LIKE...
sede
CREATE TABLE table_204_579 ( id number, "code" text, "district" text, "headquarters" text, "population (as of 2011)" number, "area (km2)" number, "density (/km2)" number )
if a person was headquartered in almora what would be his/her district ?
SELECT "district" FROM table_204_579 WHERE "headquarters" = 'almora'
squall
CREATE TABLE table_name_69 ( club VARCHAR, rank VARCHAR )
Which Club has a Rank of 1?
SELECT club FROM table_name_69 WHERE rank = "1"
sql_create_context
CREATE TABLE table_name_41 ( points VARCHAR, engine VARCHAR )
What is the total number of points of the honda hr-1 engine?
SELECT COUNT(points) FROM table_name_41 WHERE engine = "honda hr-1"
sql_create_context
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, give me the comparison about the average of code over the headquarter , and group by attribute headquarter, and order from low to high by the X.
SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T2.Headquarter
nvbench
CREATE TABLE table_21063459_1 ( result VARCHAR, opponent VARCHAR )
What was the result of the game against Mississippi State?
SELECT result FROM table_21063459_1 WHERE opponent = "Mississippi State"
sql_create_context
CREATE TABLE zyb ( CLINIC_ID 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, INSU_TYPE text, IN...
病患56819536从06年11月26日到21年1月2日内检查的次数是多少次?
SELECT COUNT(*) FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_ID = '56819536' AND t_kc22.STA_DATE BETWEEN '2006-11-26' AND '2021-01-02' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' UNION SELECT COUNT(*) FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gyb.PERSON_ID = '5...
css
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE flight ( aircraft_code_sequence text, air...
what UA FIRST class airfare flights are available from DENVER to BALTIMORE on 7 3
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 AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis AS FARE_BASIS_0, fare_basis AS FARE_BASIS_1, flight, flight_fare WHERE (((DAT...
atis
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeri...
what are the top four most frequently done lab tests during this year given to patients in the same month after being diagnosed with upper respiratory obstruction - suspected?
SELECT t3.labname FROM (SELECT t2.labname, 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 = 'upper respiratory obstruction - suspected' AND DATET...
eicu
CREATE TABLE table_203_478 ( id number, "week" number, "date" text, "opponent" text, "result" text, "attendance" number )
which game date only had a bit more than 20,000 in attendance ?
SELECT "date" FROM table_203_478 WHERE "attendance" > 20000 ORDER BY "attendance" LIMIT 1
squall
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...
how patient 19412 was admitted to hospital since 5 years ago for the last time?
SELECT admissions.admission_type FROM admissions WHERE admissions.subject_id = 19412 AND DATETIME(admissions.admittime) >= DATETIME(CURRENT_TIME(), '-5 year') ORDER BY admissions.admittime DESC LIMIT 1
mimic_iii
CREATE TABLE table_name_60 ( year VARCHAR, nominee VARCHAR )
How many years was Best Musical Revival nominated?
SELECT COUNT(year) FROM table_name_60 WHERE nominee = "best musical revival"
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
what is the number of patients whose diagnoses short title is encephalopathy nos and drug type is additive?
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.short_title = "Encephalopathy NOS" AND prescriptions.drug_type = "ADDITIVE"
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...
what is during this month minimum urinary specific gravity value of patient 030-28944?
SELECT MIN(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-28944')) AND lab.labname = 'urinary specific gravity' AND DATETIME(lab.labresu...
eicu