context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_203_418 ( id number, "#" number, "player" text, "position" text, "height" number, "current club" text )
who is taller garreth lodge or ross campbell ?
SELECT "player" FROM table_203_418 WHERE "player" IN ('garreth lodge', 'ross campbell') ORDER BY "height" DESC LIMIT 1
squall
CREATE TABLE table_name_7 ( chassis VARCHAR, engine_† VARCHAR, driver VARCHAR )
What's the chassis for alexander wurz's playlife fb02 engine?
SELECT chassis FROM table_name_7 WHERE engine_† = "playlife fb02" AND driver = "alexander wurz"
sql_create_context
CREATE TABLE election ( Election_ID int, Counties_Represented text, District int, Delegate text, Party int, First_Elected real, Committee text ) CREATE TABLE county ( County_Id int, County_name text, Population real, Zip_code text ) CREATE TABLE party ( Party_ID int, ...
Show the county name and population of all counties Show bar chart, rank in asc by the y-axis.
SELECT County_name, Population FROM county ORDER BY Population
nvbench
CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Movie ( mID int, title text, year int, director text )
For each director who directed more than one movie, for each movie title, bin their dates of release into Year interval and count the total number in each bucket using a line chart, and list by the X-axis in asc.
SELECT year, COUNT(year) FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title <> T2.title GROUP BY title ORDER BY year
nvbench
CREATE TABLE table_18568 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
What party is incumbent virgil chapman from?
SELECT "Party" FROM table_18568 WHERE "Incumbent" = 'Virgil Chapman'
wikisql
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, ...
give the primary disease of jane dillard.
SELECT demographic.diagnosis FROM demographic WHERE demographic.name = "Jane Dillard"
mimicsql_data
CREATE TABLE table_32696 ( "Year" text, "Date" text, "Stages" text, "Distance" text, "Winner" text )
What stage was 1,648 km achieved?
SELECT "Stages" FROM table_32696 WHERE "Distance" = '1,648 km'
wikisql
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 ...
从二00二年四月二十五日到二0二0年十二月二十一日这段时间,患者沈宾鸿检测超敏肌钙蛋白T找的哪些医务人员做的,这些医务人员的工号和姓名报一下
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM person_info JOIN hz_info JOIN mzjzjlb JOIN zyjybgb 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 = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZJZJLB ...
css
CREATE TABLE entrepreneur ( Entrepreneur_ID int, People_ID int, Company text, Money_Requested real, Investor text ) CREATE TABLE people ( People_ID int, Name text, Height real, Weight real, Date_of_Birth text )
A line chart for returning the number of the dates of birth for entrepreneurs who have either the investor Simon Woodroffe or Peter Jones, could you order X in descending order?
SELECT Date_of_Birth, COUNT(Date_of_Birth) FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor = "Simon Woodroffe" OR T1.Investor = "Peter Jones" ORDER BY Date_of_Birth DESC
nvbench
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...
列出患者赵星波被开出的所有检验报告单在2011-11-25到2013-05-15期间的检验报告单号是什么?
SELECT jybgb.BGDH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb 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 WHERE person_info.XM = '赵星波' AND jybg...
css
CREATE TABLE table_name_68 ( points VARCHAR, year VARCHAR, engine VARCHAR )
What points larger than 1950 has a maserati straight-6 engine?
SELECT points FROM table_name_68 WHERE year > 1950 AND engine = "maserati straight-6"
sql_create_context
CREATE TABLE table_1514634_2 ( margin_of_victory VARCHAR, tournament VARCHAR )
What was the margin of victory at the Hawaiian Open tournament?
SELECT margin_of_victory FROM table_1514634_2 WHERE tournament = "Hawaiian Open"
sql_create_context
CREATE TABLE table_name_51 ( try_bonus VARCHAR, lost VARCHAR, drawn VARCHAR )
What is the try bonus when the loss is 13 and the draw is 2?
SELECT try_bonus FROM table_name_51 WHERE lost = "13" AND drawn = "2"
sql_create_context
CREATE TABLE table_name_6 ( date VARCHAR, venue VARCHAR )
On what date was a game played at Windy Hill?
SELECT date FROM table_name_6 WHERE venue = "windy hill"
sql_create_context
CREATE TABLE table_40849 ( "Republican ticket" text, "Democratic ticket" text, "American Labor ticket" text, "Communist ticket" text, "Socialist ticket" text )
Who's the Republican ticket with a Communist ticket of elizabeth gurley flynn?
SELECT "Republican ticket" FROM table_40849 WHERE "Communist ticket" = 'elizabeth gurley flynn'
wikisql
CREATE TABLE table_name_17 ( date VARCHAR, away_team VARCHAR )
what date were they playing in hawthorn
SELECT date FROM table_name_17 WHERE away_team = "hawthorn"
sql_create_context
CREATE TABLE table_22883210_5 ( high_points VARCHAR, game VARCHAR )
Who had highest points in game 5?
SELECT high_points FROM table_22883210_5 WHERE game = 5
sql_create_context
CREATE TABLE table_11545282_10 ( player VARCHAR, no VARCHAR, position VARCHAR )
Which forward player has the number 22?
SELECT player FROM table_11545282_10 WHERE no = "22" AND position = "Forward"
sql_create_context
CREATE TABLE table_204_924 ( id number, "match" number, "date" text, "ground" text, "opponent" text, "score1" text, "pos." number, "pts." number, "gd" number )
who had the largest margin of winning ?
SELECT "opponent" FROM table_204_924 ORDER BY ABS("score1" - "score1") DESC LIMIT 1
squall
CREATE TABLE table_73536 ( "Date" text, "Opponent" text, "Location" text, "Irish Points" real, "Opp. Points" real, "Record" text )
what is the record where the locaiton is tampa, fl and the opponent is louisville?
SELECT "Record" FROM table_73536 WHERE "Location" = 'Tampa, FL' AND "Opponent" = 'Louisville'
wikisql
CREATE TABLE table_name_80 ( opponent VARCHAR, date VARCHAR )
Who was the opponent on December 18, 2005?
SELECT opponent FROM table_name_80 WHERE date = "december 18, 2005"
sql_create_context
CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE field ( fieldid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE pape...
What papers has Ed Desmond written on Semantic Parsing ?
SELECT DISTINCT author.authorid, paper.paperid FROM author, keyphrase, paper, paperkeyphrase, writes WHERE author.authorname = 'Ed Desmond' AND keyphrase.keyphrasename = 'Semantic Parsing' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND writes.authorid = author.auth...
scholar
CREATE TABLE table_name_48 ( host_team VARCHAR, date VARCHAR )
Who was the host team on November 17?
SELECT host_team FROM table_name_48 WHERE date = "november 17"
sql_create_context
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), ...
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, give me the comparison about the average of department_id over the job_id , and group by attribute job_id by a bar chart, and sort by the y axis in descending.
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY AVG(DEPARTMENT_ID) DESC
nvbench
CREATE TABLE table_175442_1 ( scientific_name VARCHAR, common_name VARCHAR )
Name the scientific name for veiled chameleon
SELECT scientific_name FROM table_175442_1 WHERE common_name = "Veiled chameleon"
sql_create_context
CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE semester ( semester_id int, semester varchar, year int )...
Show me the New Media Writing courses that cover the MDE requirement .
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (area.area LIKE '%New Media Writing%' OR course.description LIKE '%New Media Writing%' OR course.name LIKE '%New M...
advising
CREATE TABLE table_38588 ( "Position" real, "Team" text, "Played" real, "Wins" real, "Draws" real, "Losses" real, "Scored" real, "Conceded" real, "Points" real )
Which Scored has a Team of recoleta?
SELECT SUM("Scored") FROM table_38588 WHERE "Team" = 'recoleta'
wikisql
CREATE TABLE accounts ( custid number, name text ) CREATE TABLE checking ( custid number, balance number ) CREATE TABLE savings ( custid number, balance number )
Find the total checking and saving balance of all accounts sorted by the total balance in ascending order.
SELECT T1.balance + T2.balance FROM checking AS T1 JOIN savings AS T2 ON T1.custid = T2.custid ORDER BY T1.balance + T2.balance
spider
CREATE TABLE qtb ( 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...
在1559785这个医院的患者方忆秋,他的出院诊断疾病名称中包含肺病的医疗就诊记录编号是哪些
SELECT qtb.MED_CLINIC_ID FROM qtb WHERE qtb.PERSON_NM = '方忆秋' AND qtb.MED_SER_ORG_NO = '1559785' AND qtb.OUT_DIAG_DIS_NM LIKE '%肺病%' UNION SELECT gyb.MED_CLINIC_ID FROM gyb WHERE gyb.PERSON_NM = '方忆秋' AND gyb.MED_SER_ORG_NO = '1559785' AND gyb.OUT_DIAG_DIS_NM LIKE '%肺病%' UNION SELECT zyb.MED_CLINIC_ID FROM zyb WHERE zy...
css
CREATE TABLE table_42931 ( "Position" real, "Team" text, "Points" real, "Played" real, "Drawn" real, "Lost" real, "Against" real, "Difference" text )
What average played has an against less than 15?
SELECT AVG("Played") FROM table_42931 WHERE "Against" < '15'
wikisql
CREATE TABLE zzmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZ...
在04年9月6日到12年2月8日期间的门诊就诊中有多少医院2106089的科室开出了超出24张检验报告单?
SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM zzmzjzjlb JOIN jybgb ON zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE zzmzjzjlb.YLJGDM = '2106089' AND jybgb.BGRQ BETWEEN '2004-09-06' AND '2012-02-08' GROUP BY jybgb.KSBM HAVING COUNT(*) > 24 UNION SELECT jybgb.KSBM FROM fzzmzjzjlb ...
css
CREATE TABLE table_name_29 ( original_teams VARCHAR, the_biggest_loser VARCHAR )
What were the original teams for the season that was won by Danni Allen?
SELECT original_teams FROM table_name_29 WHERE the_biggest_loser = "danni allen"
sql_create_context
CREATE TABLE constructorStandings ( constructorStandingsId INTEGER, raceId INTEGER, constructorId INTEGER, points REAL, position INTEGER, positionText TEXT, wins INTEGER ) CREATE TABLE results ( resultId INTEGER, raceId INTEGER, driverId INTEGER, constructorId INTEGER, n...
What are the number of the names of races held between 2009 and 2011?, and could you display by the Y from high to low?
SELECT name, COUNT(name) FROM races WHERE year BETWEEN 2009 AND 2011 GROUP BY name ORDER BY COUNT(name) DESC
nvbench
CREATE TABLE table_2226343_1 ( miles__km_ VARCHAR, date VARCHAR )
What are the miles when February 25 is the date?
SELECT miles__km_ FROM table_2226343_1 WHERE date = "February 25"
sql_create_context
CREATE TABLE table_203_808 ( id number, "rank" number, "peak name" text, "elevation" text, "location" text, "notes" text )
how many of the mountains have an elevation above 3,300 ft ?
SELECT COUNT("peak name") FROM table_203_808 WHERE "elevation" > 3300
squall
CREATE TABLE table_58250 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text )
What's the Loss listed for the Opponent of California Angels and has an Attendance of 57,762?
SELECT "Loss" FROM table_58250 WHERE "Opponent" = 'california angels' AND "Attendance" = '57,762'
wikisql
CREATE TABLE table_name_31 ( silver INTEGER, total VARCHAR, gold VARCHAR )
Which Silver has a Total of 11, and a Gold smaller than 8?
SELECT MIN(silver) FROM table_name_31 WHERE total = 11 AND gold < 8
sql_create_context
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) C...
First 20 Moroccan users in StackOverflow.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Id, Reputation FROM Users WHERE LOWER(Location) LIKE '%morocco%' ORDER BY Reputation DESC LIMIT 20
sede
CREATE TABLE allergy_type ( allergy text, allergytype text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE has_allergy ( stuid number, allergy text )
What are the full names and ages for all female students whose sex is F?
SELECT fname, lname, age FROM student WHERE sex = 'F'
spider
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE chartevents ( row_id number, subject_id number, ...
what were the top four most frequent procedures that patients took within 2 months after receiving flexible sigmoidoscopy in a year before?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admi...
mimic_iii
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PendingFlags ( Id nu...
Total comment on a tag.
SELECT SUM(CAST(CommentCount AS INT)) AS comment_count FROM Posts WHERE PostTypeId = 1 AND CreationDate > @from_date AND CreationDate < @to_date AND Tags LIKE '%##Tag##%'
sede
CREATE TABLE table_23247 ( "Rank" real, "Couple" text, "Judges" real, "Public" real, "Total" real, "Vote percentage" text, "Result" text )
When roxanne and daniel are the couple what is the highest rank?
SELECT MAX("Rank") FROM table_23247 WHERE "Couple" = 'Roxanne and Daniel'
wikisql
CREATE TABLE table_name_14 ( population__percentage_1971 VARCHAR, population__percentage_1961 VARCHAR )
For the group with 1.79% population in 1961, what was their percentage of the population in 1971?
SELECT population__percentage_1971 FROM table_name_14 WHERE population__percentage_1961 = "1.79%"
sql_create_context
CREATE TABLE table_41860 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-10" real, "Top-25" real, "Events" real, "Cuts made" real )
What is the average cuts made at the top 25, less than 10, and at the Top 10 more than 3?
SELECT AVG("Cuts made") FROM table_41860 WHERE "Top-25" < '10' AND "Top-10" > '3'
wikisql
CREATE TABLE table_20672 ( "State" text, "Preliminary Average" text, "Interview" text, "Swimsuit" text, "Evening Gown" text, "Semifinal Average" text )
What was the swimsuit score for the one who had a semifinal average of 8.759 (5)?
SELECT "Swimsuit" FROM table_20672 WHERE "Semifinal Average" = '8.759 (5)'
wikisql
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE Tags ( Id number, TagName text, Count ...
Percentage of closed questions by each hour of the day.
SELECT TIME_TO_STR(q.CreationDate, '%I') AS "Hour", CAST((100.0 * COUNT(q.ClosedDate) / COUNT(*)) AS FLOAT(10, 0)) AS "Closed percent", COUNT(*) AS "question_count" FROM Posts AS q WHERE q.PostTypeId = 1 GROUP BY TIME_TO_STR(q.CreationDate, '%I') ORDER BY 'Hour'
sede
CREATE TABLE table_name_39 ( against INTEGER, date VARCHAR )
What is the total against on 15/10/1999?
SELECT SUM(against) FROM table_name_39 WHERE date = "15/10/1999"
sql_create_context
CREATE TABLE table_203_165 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
which nation finished first in total medals earned ?
SELECT "nation" FROM table_203_165 ORDER BY "total" DESC LIMIT 1
squall
CREATE TABLE table_2886617_9 ( player VARCHAR, nhl_team VARCHAR )
Who was picked for the draft by St. Louis Blues?
SELECT player FROM table_2886617_9 WHERE nhl_team = "St. Louis Blues"
sql_create_context
CREATE TABLE table_62531 ( "Name / Generation" text, "Model" text, "Frequency [MHz]" text, "Architecture version" text, "Cores" text, "Process [nm]" text )
What is the architecture version of Model 1b?
SELECT "Architecture version" FROM table_62531 WHERE "Model" = '1b'
wikisql
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...
how many patients whose discharge location is rehab/distinct part hosp and procedure long title is other phototherapy?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "REHAB/DISTINCT PART HOSP" AND procedures.long_title = "Other phototherapy"
mimicsql_data
CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) CREATE TABLE airline ( ...
what flights leave SEATTLE on sunday on CO after 2100
SELECT DISTINCT flight.flight_id FROM airport_service, city, date_day, days, flight WHERE ((date_day.day_number = 27 AND date_day.month_number = 8 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time > 2100 AND flight.flight_days = days.days_code) AND city.city_code = airport_service...
atis
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...
这个患者00559880的身高和体重是多少?
SELECT wdmzjzjlb.SG, wdmzjzjlb.TZ FROM hz_info JOIN wdmzjzjlb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE hz_info.RYBH = '00559880' UNION SELECT bdmzjzjlb.SG, bdmzjzjlb.TZ FROM hz_info JOIN bdmzjzjlb ON hz_info.YLJGDM = bdmzjzjlb.YLJGDM AND hz_info.KH = bdmzj...
css
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
what is the five year survival rate for patients who had been prescribed lr after having been diagnosed with cv dis nec-deliver w p/p?
SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 5 * 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_name_30 ( Id VARCHAR )
What 2010 has an A 2006 & 2011?
SELECT 2010 FROM table_name_30 WHERE 2006 = "a" AND 2011 = "a"
sql_create_context
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE patient ( uniquepid text, patientheal...
when has patient 018-20179 been prescribed medication for the first time since 02/2105 via intravenous route?
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '018-20179')) AND medication.routeadmin = 'intravenous' AND STR...
eicu
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsysto...
how many times was midazolam hcl 2 mg/2ml ij soln prescribed until 01/2105 for patient 006-171217.
SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-171217')) AND medication.drugname = 'midazolam hcl 2 mg/2ml ij soln' AND S...
eicu
CREATE TABLE table_name_15 ( number_of_households VARCHAR, median_family_income VARCHAR )
How many households have a median family income of $60,400?
SELECT number_of_households FROM table_name_15 WHERE median_family_income = "$60,400"
sql_create_context
CREATE TABLE journalist ( journalist_ID int, Name text, Nationality text, Age text, Years_working int ) CREATE TABLE event ( Event_ID int, Date text, Venue text, Name text, Event_Attendance int ) CREATE TABLE news_report ( journalist_ID int, Event_ID int, Work_Type ...
Visualize a bar chart, count and group by nationality from the journalist table.
SELECT Nationality, COUNT(Nationality) FROM journalist GROUP BY Nationality
nvbench
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
患者李凯唱的异常情况,之前有哪些?
SELECT * 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 jybgb.YLJGDM = jyjgzbb.YLJGDM...
css
CREATE TABLE table_name_57 ( college VARCHAR, position VARCHAR )
What is the College of the Halfback Player?
SELECT college FROM table_name_57 WHERE position = "halfback"
sql_create_context
CREATE TABLE table_train_56 ( "id" int, "organ_transplantation" bool, "severe_sepsis" bool, "immune_suppression" bool, "autoimmune_disease" bool, "hematopoietic" bool, "chronic_infectious" bool, "steroid_therapy" bool, "sepsis" bool, "systemic_inflammatory_response" bool, "or...
adult patients ( age > 18 years )
SELECT * FROM table_train_56 WHERE age > 18
criteria2sql
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...
count the number of times that patient 54825 has had a rt/left heart card cath treatment during the last year.
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'rt/left heart card cath') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 54825) AND DATETIME(procedu...
mimic_iii
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( ...
how many patients whose primary disease is colangitis and drug route is id?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "COLANGITIS" AND prescriptions.route = "ID"
mimicsql_data
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions...
how many patients are primarily diagnosed for aortic valve insuffiency/aortic valve replacement /sda and lab tested for hematology?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" AND lab."CATEGORY" = "Hematology"
mimicsql_data
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text,...
Posts with the Azure tag but not any other tag with the word Azure in it.
SELECT DISTINCT Posts.Id, Posts.Title, Posts.Tags, Posts.CreationDate FROM Posts WHERE (Posts.CreationDate > '2020-10-01') AND (Posts.Tags LIKE '%azure%') AND (Posts.Id NOT IN (SELECT p.Id FROM Posts AS p JOIN PostTags AS pt ON p.Id = pt.PostId JOIN Tags AS t ON t.Id = pt.TagId WHERE (pt.TagId != 14158) AND t.TagName L...
sede
CREATE TABLE temperature ( city_id number, jan number, feb number, mar number, apr number, jun number, jul number, aug number, sep number, oct number, nov number, dec number ) CREATE TABLE hosting_city ( year number, match_id number, host_city text ) CREATE ...
What is the temperature of 'Shanghai' city in January?
SELECT T2.jan FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T1.city = "Shanghai"
spider
CREATE TABLE table_52939 ( "Peak" text, "Height (m)" real, "Prom. (m)" real, "Class" text, "Parent" text )
Name the peak for height more than 619 and class of hewitt with prom being 148
SELECT "Peak" FROM table_52939 WHERE "Height (m)" > '619' AND "Class" = 'hewitt' AND "Prom. (m)" = '148'
wikisql
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, Deletio...
first-day closures who come back on another day.
SELECT ucdfp.OwnerUserId, COUNT(p2.Id) AS futureposts FROM (SELECT udfp.OwnerUserId, udfp.dfp FROM (SELECT p.OwnerUserId, MIN(p.CreationDate) AS dfp FROM Posts AS p WHERE p.PostTypeId < 3 GROUP BY p.OwnerUserId) AS udfp LEFT OUTER JOIN Posts AS p ON p.OwnerUserId = udfp.OwnerUserId AND p.PostTypeId = 1 LEFT OUTER JOIN ...
sede
CREATE TABLE table_name_39 ( builder VARCHAR, date VARCHAR )
Which Builder has a Date of early 1871?
SELECT builder FROM table_name_39 WHERE date = "early 1871"
sql_create_context
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE Comments ( Id number, PostId number, Score num...
Get unanswered Latest 20 Questions By Tag.
SELECT q.Id AS "post_link", q.Tags FROM Posts AS q LEFT OUTER JOIN Posts AS a ON q.Id = a.ParentId AND a.PostTypeId = 2 WHERE q.PostTypeId = 1 AND a.Id IS NULL AND q.Tags LIKE '%<##TagName##>%' ORDER BY q.CreationDate LIMIT 20
sede
CREATE TABLE table_10333757_1 ( branding VARCHAR, group_owner VARCHAR )
What is the Branding for Group Owner Qantam of Cape Cod, LLC?
SELECT branding FROM table_10333757_1 WHERE group_owner = "Qantam of Cape Cod, LLC"
sql_create_context
CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufac...
round trip fare from BALTIMORE to PHILADELPHIA less than 1000 dollars
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.c...
atis
CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) 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 swimme...
Return a bar chart about the distribution of Nationality and the amount of Nationality , and group by attribute Nationality, and order x-axis in ascending order.
SELECT Nationality, COUNT(Nationality) FROM swimmer GROUP BY Nationality ORDER BY Nationality
nvbench
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
tell me the number of patients with procedure icd9 code 5361.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "5361"
mimicsql_data
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
provide the number of patients whose diagnoses long title is personal history of venous thrombosis and embolism?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Personal history of venous thrombosis and embolism"
mimicsql_data
CREATE TABLE table_1404456_1 ( capital VARCHAR, area__km_2__ VARCHAR )
what's the capital with area (km 2 ) being 12,245.9
SELECT capital FROM table_1404456_1 WHERE area__km_2__ = "12,245.9"
sql_create_context
CREATE TABLE table_name_51 ( driving_wheels VARCHAR, date_built VARCHAR )
What are the driving wheels of the model built in 1883?
SELECT driving_wheels FROM table_name_51 WHERE date_built = "1883"
sql_create_context
CREATE TABLE table_36141 ( "Candidate" text, "Party" text, "EU Party" text, "1st count" real, "29th count" text )
Which eu party has a 29th count of 40,529?
SELECT "EU Party" FROM table_36141 WHERE "29th count" = '40,529'
wikisql
CREATE TABLE Apartment_Facilities ( apt_id INTEGER, facility_code CHAR(15) ) CREATE TABLE Apartments ( apt_id INTEGER, building_id INTEGER, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, bedroom_count INTEGER, room_count CHAR(5) ) CREATE TABLE View_Unit_Status...
How many bookings for each apartment number? Plot a bar chart, I want to sort names in asc order.
SELECT apt_number, COUNT(apt_number) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id GROUP BY apt_number ORDER BY apt_number
nvbench
CREATE TABLE table_name_99 ( country VARCHAR, director VARCHAR )
Where is the director Dariush Mehrjui from?
SELECT country FROM table_name_99 WHERE director = "dariush mehrjui"
sql_create_context
CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate real ) CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight re...
Return a bar chart about the distribution of Name and Weight , list total number in descending order please.
SELECT Name, Weight FROM people ORDER BY Weight DESC
nvbench
CREATE TABLE table_name_34 ( production_cost VARCHAR, date VARCHAR )
What is the Production Cost with a Date that is february 2000?
SELECT production_cost FROM table_name_34 WHERE date = "february 2000"
sql_create_context
CREATE TABLE table_204_724 ( id number, "outcome" text, "no." number, "date" text, "tournament" text, "surface" text, "partner" text, "opponents in the final" text, "score in the final" text )
what tournament was played after the kremlin cup ?
SELECT "tournament" FROM table_204_724 WHERE "date" > (SELECT "date" FROM table_204_724 WHERE "tournament" = 'kremlin cup') ORDER BY "date" LIMIT 1
squall
CREATE TABLE table_name_7 ( game INTEGER, date VARCHAR, attendance VARCHAR )
What average game was held on february 24 and has an attendance smaller than 16,541?
SELECT AVG(game) FROM table_name_7 WHERE date = "february 24" AND attendance < 16 OFFSET 541
sql_create_context
CREATE TABLE fgwyjzb ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
找出医院8754336全部医疗就诊的记录里不一样的科室接诊的患者和不同疾病编号的患者平均的年纪有多大
SELECT gwyjzb.MED_ORG_DEPT_NM, gwyjzb.IN_DIAG_DIS_CD, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '8754336' GROUP BY gwyjzb.MED_ORG_DEPT_NM, gwyjzb.IN_DIAG_DIS_CD UNION SELECT fgwyjzb.MED_ORG_DEPT_NM, fgwyjzb.IN_DIAG_DIS_CD, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '87543...
css
CREATE TABLE table_name_6 ( away_team VARCHAR )
What is the score for Footscray?
SELECT away_team AS score FROM table_name_6 WHERE away_team = "footscray"
sql_create_context
CREATE TABLE table_3485 ( "No. in series" real, "No. in season" real, "Title" text, "Vessel Type" text, "Vessel Operator" text, "Narrated by" text, "Original air date" real )
Name the vessel type for beluga shipping
SELECT "Vessel Type" FROM table_3485 WHERE "Vessel Operator" = 'Beluga Shipping'
wikisql
CREATE TABLE table_37613 ( "Game" real, "February" real, "Opponent" text, "Score" text, "Record" text, "Points" real )
Who were the opponents in games before number 54?
SELECT "Opponent" FROM table_37613 WHERE "Game" < '54'
wikisql
CREATE TABLE table_59081 ( "Season" text, "GP/MP" text, "Kills" real, "K/Game" real, "Errors" real, "Total Attempts" real, "Percentage" real, "Assists" real, "Service Aces" real, "Digs" real, "Solo Blocks" real, "Block Assists" real, "Total Blocks" real, "Points" ...
How many kills when percentage is more than 0.313, attempts are more than 1035 and assists are larger than 57?
SELECT COUNT("Kills") FROM table_59081 WHERE "Percentage" > '0.313' AND "Total Attempts" > '1035' AND "Assists" > '57'
wikisql
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE m...
when did patient 009-5001 receive an fio2 laboratory test for the last time during this hospital encounter?
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 = '009-5001' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'fio2' ORDE...
eicu
CREATE TABLE table_21125 ( "English name" text, "Irish name" text, "Numeral" text, "Reverse" text, "Introduction" text, "Withdrawal" text, "\u00a31 Fraction" text )
What is the numeral where the English name is Florin?
SELECT "Numeral" FROM table_21125 WHERE "English name" = 'Florin'
wikisql
CREATE TABLE table_64985 ( "Tournament" text, "1986" text, "1988" text, "1989" text, "1990" text, "1991" text, "1992" text, "1993" text, "1994" text, "1995" text, "1996" text, "1997" text, "1998" text, "1999" text )
What's the 1997 when 1992 is QF, 1995 is 1R, and 1999 is 1R?
SELECT "1997" FROM table_64985 WHERE "1999" = '1r' AND "1992" = 'qf' AND "1995" = '1r'
wikisql
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...
how many patients whose drug code is metr500pm and lab test fluid is ascites?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "METR500PM" AND lab.fluid = "Ascites"
mimicsql_data
CREATE TABLE table_name_97 ( type VARCHAR, newspaper_magazine VARCHAR )
What is Type, when Newspaper/Magazine is Telecoms & It Magazine?
SELECT type FROM table_name_97 WHERE newspaper_magazine = "telecoms & it magazine"
sql_create_context
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...
A bar chart shows the distribution of Team_Name and ACC_Percent , and rank in descending by the y-axis.
SELECT Team_Name, ACC_Percent FROM basketball_match ORDER BY ACC_Percent DESC
nvbench
CREATE TABLE table_name_8 ( attendance VARCHAR, tie_no VARCHAR )
When there was a tie of 16 what was the attendance?
SELECT attendance FROM table_name_8 WHERE tie_no = "16"
sql_create_context
CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE field ( fieldid int ) CREA...
In what scholarly journals does Takashi Matsumoto publish ?
SELECT DISTINCT paper.journalid FROM author, paper, writes WHERE author.authorname = 'Takashi Matsumoto' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid GROUP BY paper.journalid
scholar
CREATE TABLE table_74710 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
What day had over 51,319 attending week 4?
SELECT "Date" FROM table_74710 WHERE "Attendance" > '51,319' AND "Week" = '4'
wikisql
CREATE TABLE city ( Hispanic VARCHAR, Black INTEGER )
What are the percentage of hispanics in cities with the black percentage higher than 10?
SELECT Hispanic FROM city WHERE Black > 10
sql_create_context