context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
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 diagnoses ( ...
get the number of dead patients who were prescribed atropine sulfate.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.expire_flag = "1" AND prescriptions.drug = "Atropine Sulfate"
mimicsql_data
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid nu...
has sc 20 fe po been administered to patient 14054 on last month/01?
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 = 14054)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sc 20 fe...
mimic_iii
CREATE TABLE Courses ( course_id INTEGER, author_id INTEGER, subject_id INTEGER, course_name VARCHAR(120), course_description VARCHAR(255) ) CREATE TABLE Subjects ( subject_id INTEGER, subject_name VARCHAR(120) ) CREATE TABLE Student_Tests_Taken ( registration_id INTEGER, date_test...
Return the completion date for all the tests that have 'Fail' result, and count them by a bar chart, sort bars in desc order.
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" GROUP BY date_of_completion ORDER BY date_of_completion DESC
nvbench
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, ...
what is subject name and marital status of subject id 2560?
SELECT demographic.name, demographic.marital_status FROM demographic WHERE demographic.subject_id = "2560"
mimicsql_data
CREATE TABLE table_57862 ( "Years" text, "Engine" text, "Displacement" text, "Power" text, "Torque" text, "Notes" text )
What is the power when the displacement is 182cid (2,988cc) and the notes are eu spec?
SELECT "Power" FROM table_57862 WHERE "Displacement" = '182cid (2,988cc)' AND "Notes" = 'eu spec'
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, ...
count the number of patients whose ethnicity is white - russian and year of death is less than or equal to 2168?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND demographic.dod_year <= "2168.0"
mimicsql_data
CREATE TABLE table_name_19 ( home_team VARCHAR, venue VARCHAR )
What is the Home team score at junction oval?
SELECT home_team FROM table_name_19 WHERE venue = "junction oval"
sql_create_context
CREATE TABLE table_name_65 ( diameter__mi_ VARCHAR, longitude VARCHAR )
What is the Diameter (mi) when the Longitude is 79.8 e?
SELECT diameter__mi_ FROM table_name_65 WHERE longitude = "79.8° e"
sql_create_context
CREATE TABLE table_33731 ( "Date" text, "Venue" text, "Result" text, "Goals" real, "Competition" text )
What venue has a Result of 3-0?
SELECT "Venue" FROM table_33731 WHERE "Result" = '3-0'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE ftxmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, ...
在2007-08-06到2021-12-19期间内,患者70148968被开出的所有检验报告单中的标本采集部位需要列出来
SELECT jybgb.BBCJBW FROM hz_info JOIN txmzjzjlb JOIN jybgb ON hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '70148968' AND jybgb.BGRQ BETWEEN '2007-08-06' AND '202...
css
CREATE TABLE table_204_833 ( id number, "game" number, "date" text, "team" text, "score" text, "high points" text, "high rebounds" text, "high assists" text, "location\nattendance" text, "record" text )
which player scored the largest number of points in one game in april ?
SELECT "high points" FROM table_204_833 ORDER BY "high points" DESC LIMIT 1
squall
CREATE TABLE table_name_84 ( gold INTEGER, total VARCHAR, bronze VARCHAR, rank VARCHAR )
Bronze larger than 2, and a Rank of 4, and a Total larger than 7 has how many numbers of gold?
SELECT AVG(gold) FROM table_name_84 WHERE bronze > 2 AND rank = 4 AND total > 7
sql_create_context
CREATE TABLE table_7919 ( "Rank" real, "Company" text, "Headquarters" text, "Industry" text, "Sales (billion $)" real, "Profits (billion $)" real, "Assets (billion $)" real, "Market Value (billion $)" real )
What is the lowest market value (billion $) with a headquarter of usa , and the rank larger than 3, assets (billion$) larger than 208.34, and the company jpmorgan chase?
SELECT MIN("Market Value (billion $)") FROM table_7919 WHERE "Headquarters" = 'usa' AND "Rank" > '3' AND "Assets (billion $)" > '208.34' AND "Company" = 'jpmorgan chase'
wikisql
CREATE TABLE table_name_32 ( label VARCHAR, date VARCHAR )
Which label is dated February 14, 2002?
SELECT label FROM table_name_32 WHERE date = "february 14, 2002"
sql_create_context
CREATE TABLE table_23227 ( "Season" real, "Series" text, "Team" text, "Races" real, "Wins" real, "Poles" real, "F/Laps" real, "Podiums" real, "Points" real, "Position" text )
What's the minimal number of wins of a team?
SELECT MIN("Wins") FROM table_23227
wikisql
CREATE TABLE Participants ( Participant_ID INTEGER, Participant_Type_Code CHAR(15), Participant_Details VARCHAR(255) ) CREATE TABLE Participants_in_Events ( Event_ID INTEGER, Participant_ID INTEGER ) CREATE TABLE Events ( Event_ID INTEGER, Service_ID INTEGER, Event_Details VARCHAR(255)...
Group and count details for the events using a bar chart, show by the Y-axis in desc.
SELECT Event_Details, COUNT(Event_Details) FROM Events GROUP BY Event_Details ORDER BY COUNT(Event_Details) DESC
nvbench
CREATE TABLE table_203_804 ( id number, "pos" text, "no" number, "driver" text, "constructor" text, "laps" number, "time/retired" text, "grid" number )
which driver completed the least number of laps ?
SELECT "driver" FROM table_203_804 ORDER BY "laps" LIMIT 1
squall
CREATE TABLE table_33084 ( "Player" text, "Nationality" text, "Position" text, "From" text, "School/Country" text )
Which player played the guard position from 1968?
SELECT "Player" FROM table_33084 WHERE "Position" = 'guard' AND "From" = '1968'
wikisql
CREATE TABLE table_4984 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
How did he win with a time of 0:38?
SELECT "Method" FROM table_4984 WHERE "Time" = '0:38'
wikisql
CREATE TABLE Subjects ( subject_id INTEGER, subject_name VARCHAR(120) ) CREATE TABLE Courses ( course_id INTEGER, author_id INTEGER, subject_id INTEGER, course_name VARCHAR(120), course_description VARCHAR(255) ) CREATE TABLE Course_Authors_and_Tutors ( author_id INTEGER, author_tu...
Find the latest logon date of the students whose family name is 'Jaskolski' or 'Langosh', and count them by a bar chart, and could you show from high to low by the Y?
SELECT date_of_latest_logon, COUNT(date_of_latest_logon) FROM Students WHERE family_name = "Jaskolski" OR family_name = "Langosh" ORDER BY COUNT(date_of_latest_logon) DESC
nvbench
CREATE TABLE table_name_81 ( place INTEGER, team VARCHAR, lost VARCHAR )
What's the place that Once Municipal has a lost greater than 3?
SELECT AVG(place) FROM table_name_81 WHERE team = "once municipal" AND lost > 3
sql_create_context
CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text...
Distribution of Hours to Close a Duplicate Question.
SELECT diff1 AS hoursToClose, COUNT(*) FROM (SELECT CAST((JULIANDAY(ClosedDate) - JULIANDAY(d.CreationDate)) * 24.0 AS INT) AS "diff1", TIME_TO_STR(d.CreationDate, '%y-%m') AS "date1", TIME_TO_STR(d.ClosedDate, '%y-%m') AS "date2", (d.Id) AS id FROM Posts AS d LEFT JOIN PostHistory AS ph ON ph.PostId = d.Id LEFT JOIN P...
sede
CREATE TABLE table_204_79 ( id number, "season" text, "tier" number, "division" text, "place" text )
which season places first in their division ?
SELECT "season" FROM table_204_79 WHERE "place" = 1
squall
CREATE TABLE table_26375386_18 ( couple VARCHAR, result VARCHAR )
Who was the couple on the bottom two?
SELECT couple FROM table_26375386_18 WHERE result = "Bottom two"
sql_create_context
CREATE TABLE table_61835 ( "Seat" real, "Season 1" text, "Season 2" text, "Season 3" text, "Season 6" text, "Season 7" text )
Which Season 3 has a Season 7 of jim treliving?
SELECT "Season 3" FROM table_61835 WHERE "Season 7" = 'jim treliving'
wikisql
CREATE TABLE table_76314 ( "Tournament" text, "1990" text, "1991" text, "1992" text, "1993" text, "1994" text, "1995" text, "1996" text, "1997" text, "Career SR" text, "Career Win-Loss" text )
What is Tournament, when Career SR is 'ATP Masters Series'?
SELECT "Tournament" FROM table_76314 WHERE "Career SR" = 'atp masters series'
wikisql
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
A scatter chart shows the correlation between ACC_Percent and All_Games_Percent .
SELECT ACC_Percent, All_Games_Percent FROM basketball_match
nvbench
CREATE TABLE table_63841 ( "Region" text, "Date" text, "Label" text, "Format" text, "Catalog" text )
What is the Label of the September 20, 2008 release with Catalog number RTRADCD491?
SELECT "Label" FROM table_63841 WHERE "Catalog" = 'rtradcd491' AND "Date" = 'september 20, 2008'
wikisql
CREATE TABLE mountain ( id number, name text, height number, prominence number, range text, country text ) CREATE TABLE photos ( id number, camera_lens_id number, mountain_id number, color text, name text ) CREATE TABLE camera_lens ( id number, brand text, name ...
What is the name of each camera lens and the number of photos taken by it? Order the result by the count of photos.
SELECT T1.name, COUNT(*) FROM camera_lens AS T1 JOIN photos AS T2 ON T1.id = T2.camera_lens_id GROUP BY T1.id ORDER BY COUNT(*)
spider
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of headquarter and the average of price , and group by attribute headquarter.
SELECT Headquarter, AVG(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter
nvbench
CREATE TABLE table_name_85 ( champions VARCHAR, coeff VARCHAR )
Which Champion has a Coeff of 1.000?
SELECT champions FROM table_name_85 WHERE coeff = "1.000"
sql_create_context
CREATE TABLE table_1684 ( "Episode" text, "First broadcast" text, "Graemes guest" text, "Jeremys guest" text, "Votes (%)" text )
in what date was aired the first broacast of the episode 1x02
SELECT "First broadcast" FROM table_1684 WHERE "Episode" = '1x02'
wikisql
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 )
Find the number of different products that are produced by companies at different headquarter cities Plot them as bar chart, and show X in asc order.
SELECT Headquarter, COUNT(DISTINCT T1.Name) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code ORDER BY Headquarter
nvbench
CREATE TABLE table_53622 ( "Year" real, "Competition Description" text, "Location" text, "Apparatus" text, "Score-Final" real, "Score-Qualifying" real )
Which apparatus had a final score that was more than 17.75?
SELECT "Apparatus" FROM table_53622 WHERE "Score-Final" > '17.75'
wikisql
CREATE TABLE table_38223 ( "Name" text, "Height" text, "Weight" text, "Class" text, "Position" text, "Hometown" text )
What is the class of the qb, Josh Riddell?
SELECT "Class" FROM table_38223 WHERE "Position" = 'qb' AND "Name" = 'josh riddell'
wikisql
CREATE TABLE table_1358608_4 ( weight__kg_ VARCHAR, race VARCHAR )
What was the weight in kg on the day of the race at Ranvet Stakes?
SELECT weight__kg_ FROM table_1358608_4 WHERE race = "Ranvet Stakes"
sql_create_context
CREATE TABLE field ( fieldid int ) CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE dataset ...
What journals has james landay published in ?
SELECT DISTINCT paper.journalid FROM author, paper, writes WHERE author.authorname = 'james landay' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid GROUP BY paper.journalid
scholar
CREATE TABLE table_31588 ( "Name" text, "Degree" text, "Degree Year" text, "Award Year" real, "Award" text )
Tell me the degree for chemistry 1965
SELECT "Degree" FROM table_31588 WHERE "Award Year" = '1965' AND "Award" = 'chemistry'
wikisql
CREATE TABLE table_34696 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text )
On what date was the record 21-26?
SELECT "Date" FROM table_34696 WHERE "Record" = '21-26'
wikisql
CREATE TABLE table_14296 ( "Name A[\u203a ]" text, "Dam or A[\u203a ] Reservoir" text, "GNIS Feature ID # Link A[\u203a ] B[\u203a ]" real, "Elevation A[\u203a ]" text, "Borough or A[\u203a ] Census area" text )
what is the borough or A[ ] Census area when the Name A[ ] is jerome lake dam?
SELECT "Borough or A[\u203a ] Census area" FROM table_14296 WHERE "Name A[\u203a ]" = 'jerome lake dam'
wikisql
CREATE TABLE table_name_84 ( evening_gown INTEGER, interview VARCHAR, preliminaries VARCHAR )
What is the evening gown score where the interview score is 9.22 and the preliminaries are larger than 9.057?
SELECT SUM(evening_gown) FROM table_name_84 WHERE interview = 9.22 AND preliminaries > 9.057
sql_create_context
CREATE TABLE table_53356 ( "Year" real, "Film/Video" text, "Visual Arts" text, "Theatre" text, "Dance" text, "Music" text )
What Dance has the Visual Arts of Bryon Kim?
SELECT "Dance" FROM table_53356 WHERE "Visual Arts" = 'bryon kim'
wikisql
CREATE TABLE table_32044 ( "Name" text, "Career" text, "Caps" real, "Goals" real, "First Cap" text, "Recent Cap" text )
Who has a 59 cap?
SELECT "Name" FROM table_32044 WHERE "Caps" = '59'
wikisql
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
在21年8月25日到21年9月5日期间,患者马璇珠曾到医院看过几次病
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.person_info_XM = '马璇珠' AND mzjzjlb.JZKSRQ BETWEEN '2021-08-25' AND '2021-09-05') + (SELECT COUNT(*) FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AN...
css
CREATE TABLE table_name_15 ( schwaben VARCHAR, oberbayern VARCHAR, mittelfranken VARCHAR )
Which Schwaben has a Oberbayern of fc bayern munich ii and a Mittelfranken of 1. fc nuremberg ii?
SELECT schwaben FROM table_name_15 WHERE oberbayern = "fc bayern munich ii" AND mittelfranken = "1. fc nuremberg ii"
sql_create_context
CREATE TABLE table_name_62 ( position VARCHAR, season INTEGER )
What is the position in the 2004 season?
SELECT position FROM table_name_62 WHERE season > 2004
sql_create_context
CREATE TABLE perpetrator ( Country VARCHAR )
What are the countries of perpetrators? Show each country and the corresponding number of perpetrators there.
SELECT Country, COUNT(*) FROM perpetrator GROUP BY Country
sql_create_context
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) ...
A bar chart about how many departments are in each school?, and I want to order by the x axis from high to low.
SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT ORDER BY SCHOOL_CODE DESC
nvbench
CREATE TABLE table_78461 ( "Name" text, "Nation" text, "Points" real, "Games" real, "Pts/game" real )
Can you tell me the lowest Games that has the Pts/game larger than 1.4 and the Points of 20, and the Name of susan day?
SELECT MIN("Games") FROM table_78461 WHERE "Pts/game" > '1.4' AND "Points" = '20' AND "Name" = 'susan day'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
查一下病患葛映波的医疗记录,分别列出医疗费总额高于6981.35元的入院诊断疾病名和编码
SELECT t_kc21.OUT_DIAG_DIS_CD, t_kc21.OUT_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_NM = '葛映波' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 6981.35)
css
CREATE TABLE table_8709 ( "Developer(s)" text, "Release date" text, "Required OS" text, "Payment" text, "Type" text )
Which Type has a Release date of november 30, 1997?
SELECT "Type" FROM table_8709 WHERE "Release date" = 'november 30, 1997'
wikisql
CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) 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, ...
在03年8月11日到14年7月7日内59190525患者在医疗机构2322054开了多少西药?
SELECT COUNT(*) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_ID = '59190525' AND t_kc22.STA_DATE BETWEEN '2003-08-11' AND '2014-07-07' AND t_kc21.MED_SER_ORG_NO = '2322054' AND t_kc22.MED_INV_ITEM_TYPE = '西药费'
css
CREATE TABLE video_games ( gameid number, gname text, gtype text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE plays_games ( stuid number, gameid number, hours_pla...
Show all video games and their types in the order of their names.
SELECT gname, gtype FROM video_games ORDER BY gname
spider
CREATE TABLE table_name_36 ( date VARCHAR, away_team VARCHAR )
What is the date of the game where Essendon is the away team?
SELECT date FROM table_name_36 WHERE away_team = "essendon"
sql_create_context
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 procedures_icd ( ...
how many times has patient 29806 been admitted to the icu since 2103?
SELECT COUNT(DISTINCT icustays.icustay_id) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 29806) AND STRFTIME('%y', icustays.intime) >= '2103'
mimic_iii
CREATE TABLE table_26303 ( "Vehicle code" text, "Bore (mm)" text, "Stroke (mm)" text, "Capacity (cm 3 )" real, "Compression ratio" text, "Torque (N m)" real, "Power (HP)" real )
what is the vehicle code where the bore is 79.4?
SELECT "Vehicle code" FROM table_26303 WHERE "Bore (mm)" = '79.4'
wikisql
CREATE TABLE table_9595 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Location" text )
Where was the fight that lasted 3 rounds and was won or loss by a decision?
SELECT "Location" FROM table_9595 WHERE "Round" = '3' AND "Method" = 'decision'
wikisql
CREATE TABLE table_1397655_1 ( station VARCHAR, city VARCHAR )
which station is located in edmonton
SELECT station FROM table_1397655_1 WHERE city = "Edmonton"
sql_create_context
CREATE TABLE table_40682 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the total of rank when silver is more than 1, gold is 2, and total is more than 4?
SELECT SUM("Rank") FROM table_40682 WHERE "Silver" > '1' AND "Gold" = '2' AND "Total" > '4'
wikisql
CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE Badges ( Id number, UserId number, Name text, ...
newest user to hit 10000 rep.
SELECT * FROM Users WHERE Reputation >= 10000 ORDER BY CreationDate DESC
sede
CREATE TABLE table_1973842_1 ( type VARCHAR, nickname VARCHAR )
What is the type of the school whose students' nickname is tigers?
SELECT type FROM table_1973842_1 WHERE nickname = "Tigers"
sql_create_context
CREATE TABLE table_40869 ( "Round" real, "Pick" real, "Player" text, "Position" text, "School" text )
What was the average round for john markham draft pick?
SELECT AVG("Round") FROM table_40869 WHERE "Player" = 'john markham'
wikisql
CREATE TABLE table_name_72 ( venue VARCHAR, result VARCHAR, score VARCHAR )
Which Venue has a Result of 5-1, and a Score of 1-0?
SELECT venue FROM table_name_72 WHERE result = "5-1" AND score = "1-0"
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年12月29日到13年8月9日期间,医疗机构5217265的科室476处理的住院就诊数是多少?
SELECT COUNT(*) FROM wdmzjzjlb WHERE wdmzjzjlb.YLJGDM = '5217265' AND wdmzjzjlb.JZKSDM = '476' AND wdmzjzjlb.RYDJSJ BETWEEN '2012-12-29' AND '2013-08-09' UNION SELECT COUNT(*) FROM bdmzjzjlb WHERE bdmzjzjlb.YLJGDM = '5217265' AND bdmzjzjlb.JZKSDM = '476' AND bdmzjzjlb.RYDJSJ BETWEEN '2012-12-29' AND '2013-08-09'
css
CREATE TABLE table_13465 ( "Japanese Title" text, "Romaji Title" text, "TV Station" text, "Episodes" text, "Average Ratings" text )
What is the TV Station of the episode with a Romaji Title of Tokkyuu Tanaka Sangou?
SELECT "TV Station" FROM table_13465 WHERE "Romaji Title" = 'tokkyuu tanaka sangou'
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 diagnoses ( ...
among patients who had a lab test for cerebrospinal fluid (csf), how many of them had laparoscopic lysis of peritoneal adhesions?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Laparoscopic lysis of peritoneal adhesions" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
mimicsql_data
CREATE TABLE table_20928682_1 ( record VARCHAR, hurricanes_points VARCHAR )
What was the record after the game in which the Hurricanes scored 24 points?
SELECT record FROM table_20928682_1 WHERE hurricanes_points = 24
sql_create_context
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE locations ( LOCATIO...
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of first_name and manager_id in a bar chart, and I want to display X-axis in asc order.
SELECT FIRST_NAME, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY FIRST_NAME
nvbench
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
what is the maximum age of black/african american patients who are above 44 years of age?
SELECT MAX(demographic.age) FROM demographic WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND demographic.age >= "44"
mimicsql_data
CREATE TABLE debate ( debate_id number, date text, venue text, num_of_audience number ) CREATE TABLE people ( people_id number, district text, name text, party text, age number ) CREATE TABLE debate_people ( debate_id number, affirmative number, negative number, if_...
What are the date and venue of each debate?
SELECT date, venue FROM debate
spider
CREATE TABLE table_78555 ( "Position" real, "Club" text, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real )
How many Goals against have Played more than 34?
SELECT COUNT("Goals against") FROM table_78555 WHERE "Played" > '34'
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, ...
among patients who had abnormal lab test results, how many of them were aged below 49?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "49" AND lab.flag = "abnormal"
mimicsql_data
CREATE TABLE table_50009 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What date was Leeds United the away team?
SELECT "Date" FROM table_50009 WHERE "Away team" = 'leeds united'
wikisql
CREATE TABLE table_name_27 ( player VARCHAR, place VARCHAR )
What Player is in Place 1?
SELECT player FROM table_name_27 WHERE place = "1"
sql_create_context
CREATE TABLE table_78214 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the Away team score for Footscray?
SELECT "Away team score" FROM table_78214 WHERE "Away team" = 'footscray'
wikisql
CREATE TABLE table_49466 ( "Game" text, "Date" text, "Home team" text, "Result" text, "Road team" text )
Which Result has a Home team of portland, and a Date of may 31?
SELECT "Result" FROM table_49466 WHERE "Home team" = 'portland' AND "Date" = 'may 31'
wikisql
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessD...
Find users who got Strunk & White and edited with more than 40 edits close to that date.
SELECT UserId, MAX(ph_count) FROM (SELECT b.UserId, DATEDIFF(day, b.Date, CreationDate) AS days, COUNT(DATEDIFF(day, b.Date, CreationDate)) AS ph_count FROM Badges AS b INNER JOIN PostHistory AS ph ON (b.Name = 'Strunk & White' AND b.UserId = ph.UserId AND DATEDIFF(day, b.Date, CreationDate) BETWEEN -3 AND 3) INNER JOI...
sede
CREATE TABLE table_35754 ( "District" text, "Incumbent" text, "Party" text, "First elected" text, "Result" text )
What party has an incumbent of Stanyarne Wilson?
SELECT "Party" FROM table_35754 WHERE "Incumbent" = 'stanyarne wilson'
wikisql
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_ti...
For Fall and Winter courses which ones meet the ULCS requirement ?
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id...
advising
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Badges...
Finding favorites of a user with no accepted answer and no answer posted by that user.
SELECT p.Id AS "post_link", MAX(p.Score) AS "Score", CAST(MAX(p.AcceptedAnswerId) AS BIT) AS "Accepted Answer?" FROM Posts AS p LEFT JOIN Votes AS v ON v.VoteTypeId = 5 AND v.PostId = p.Id WHERE p.PostTypeId = 1 AND p.AcceptedAnswerId IS NULL AND v.UserId = @UserID GROUP BY p.Id ORDER BY MAX(p.Score)
sede
CREATE TABLE table_69397 ( "Riding" text, "Candidate's Name" text, "Gender" text, "Residence" text, "Occupation" text, "Votes" real, "Rank" text )
What is the rank of walter noel from st. john's?
SELECT "Rank" FROM table_69397 WHERE "Residence" = 'st. john''s' AND "Candidate's Name" = 'walter noel'
wikisql
CREATE TABLE table_75171 ( "Year" real, "Male" text, "Female" text, "Album" text, "Live Performance" text )
Which male is paired with dido in 2004?
SELECT "Male" FROM table_75171 WHERE "Year" < '2004' AND "Female" = 'dido'
wikisql
CREATE TABLE table_58764 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" real, "Money ( $ )" real )
What is the highest to par for the 76-70-76-76=298 score?
SELECT MAX("To par") FROM table_58764 WHERE "Score" = '76-70-76-76=298'
wikisql
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE vitalperiodic ( ...
find the number of people diagnosed with diabetes mellitus since 3 years ago.
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'diabetes mellitus' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-3 year'))
eicu
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime t...
what are the four most common intakes since 2100?
SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%intake%' AND STRFTIME('%y', intakeoutput.intakeoutputtime) >= '2100' GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 4
eicu
CREATE TABLE table_51125 ( "Position" real, "Name" text, "Played" real, "Drawn" real, "Lost" real, "Points" real )
How many Points have a Position larger than 3, and a Played smaller than 14?
SELECT COUNT("Points") FROM table_51125 WHERE "Position" > '3' AND "Played" < '14'
wikisql
CREATE TABLE member ( member_id number, card_number text, name text, hometown text, level number ) CREATE TABLE branch ( branch_id number, name text, open_year text, address_road text, city text, membership_amount text ) CREATE TABLE purchase ( member_id number, bra...
What are the total purchases for members rated at level 6?
SELECT COUNT(*) FROM purchase AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T2.level = 6
spider
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE T...
SELECT * FROM Posts WHERE Id < 50000.
SELECT * FROM Posts WHERE Id < 50000
sede
CREATE TABLE table_name_59 ( position VARCHAR, school_club_team VARCHAR )
What is Michigan State's position?
SELECT position FROM table_name_59 WHERE school_club_team = "michigan state"
sql_create_context
CREATE TABLE table_name_33 ( venue VARCHAR, against VARCHAR, opposing_teams VARCHAR )
What is the venue of the match with more than 8 against and ireland as the opposing team?
SELECT venue FROM table_name_33 WHERE against > 8 AND opposing_teams = "ireland"
sql_create_context
CREATE TABLE table_5245 ( "Years" text, "Building" text, "City" text, "Height" text, "Storeys" real )
Which city had years 1971-1974?
SELECT "City" FROM table_5245 WHERE "Years" = '1971-1974'
wikisql
CREATE TABLE table_9180 ( "Official Name" text, "Status" text, "Area km 2" real, "Population" real, "Census Ranking" text )
What is the population when the area km2 is 173.4?
SELECT "Population" FROM table_9180 WHERE "Area km 2" = '173.4'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
provide the number of black/haitian patients who were born before 2089.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/HAITIAN" AND demographic.dob_year < "2089"
mimicsql_data
CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE author ( authorid int, authorname...
In what years did Pedro Domingos publish a paper ?
SELECT DISTINCT paper.year FROM author, paper, writes WHERE author.authorname = 'Pedro Domingos' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid GROUP BY paper.year
scholar
CREATE TABLE artist ( Artist_ID int, Name text, Country text, Year_Join int, Age int ) CREATE TABLE exhibition_record ( Exhibition_ID int, Date text, Attendance int ) CREATE TABLE exhibition ( Exhibition_ID int, Year int, Theme text, Artist_ID int, Ticket_Price real...
Compare the average of artists' age by country in a bar graph, I want to sort by the X from high to low.
SELECT Country, AVG(Age) FROM artist GROUP BY Country ORDER BY Country DESC
nvbench
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) ...
Query Code Search on SO [from Deep Code Search].
SELECT * FROM Posts WHERE Id IN (309424, 157944, 1066589, 363681, 5585779, 1005073, 1128723, 604424, 886955, 1200621, 41107, 409784, 109383, 295579, 80476, 326390, 1149703, 513832, 3481828, 2885173, 507602, 223918, 415953, 1069066, 2784514, 153724, 473282, 529085, 4716503, 1104975, 3076078, 4105331, 8172420, 1816673, 4...
sede
CREATE TABLE table_42274 ( "Position" text, "Jersey #" real, "Name" text, "Height (cm)" real, "Weight (kg)" real, "Birthdate" text, "Birthplace" text, "1999\u20132000 Team" text, "NHL Rights" text )
What is the Position, when the Birthplace is Buffalo, New York?
SELECT "Position" FROM table_42274 WHERE "Birthplace" = 'buffalo, new york'
wikisql
CREATE TABLE table_name_87 ( institution VARCHAR, founded VARCHAR, current_conference VARCHAR )
What American Southwest Conference school was founded in 1883?
SELECT institution FROM table_name_87 WHERE founded > 1883 AND current_conference = "american southwest"
sql_create_context
CREATE TABLE table_name_53 ( agricultural_panel INTEGER, national_university_of_ireland VARCHAR, labour_panel VARCHAR, total VARCHAR )
What is the average agricultural panel value with a Labour panel less than 1, a total value less than 21, and a National University of Ireland value greater than 0?
SELECT AVG(agricultural_panel) FROM table_name_53 WHERE labour_panel < 1 AND total < 21 AND national_university_of_ireland > 0
sql_create_context
CREATE TABLE table_22026 ( "Club" text, "Played" text, "Won" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text, "Losing bonus" text, "Points" text )
Name the points when tries for is 49
SELECT "Points" FROM table_22026 WHERE "Tries for" = '49'
wikisql