context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
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...
在哪几次医疗记录中患者34441190被开出过金额不低于8665.65元的药品?医疗就诊编号是什么啊?
SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_ID = '34441190' AND gwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT >= 8665.65) UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_ID = '34441190' AND fgwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID ...
css
CREATE TABLE table_29234 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text )
What is the date of appointment when the outgoing manager was mustafa denizli?
SELECT "Date of appointment" FROM table_29234 WHERE "Outgoing manager" = 'Mustafa Denizli'
wikisql
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...
how many hours has passed since the last time patient 007-849 visited ward 430 during their current hospital visit?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '007-849' AND patient.wardid = 430 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1
eicu
CREATE TABLE table_name_51 ( bullet VARCHAR, shoulder VARCHAR )
What bullet does the gun with a shoulder measurement of 12.5 (.491)?
SELECT bullet FROM table_name_51 WHERE shoulder = "12.5 (.491)"
sql_create_context
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid...
what is patient 21074's last measured height?
SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 21074)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit ht'...
mimic_iii
CREATE TABLE table_13940 ( "Rank" real, "Athlete" text, "Country" text, "Time" text, "Notes" text )
What country has a time of 8:03.61?
SELECT "Country" FROM table_13940 WHERE "Time" = '8:03.61'
wikisql
CREATE TABLE table_56130 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the average crowd size at a home game that had a score of 14.15 (99)?
SELECT AVG("Crowd") FROM table_56130 WHERE "Home team score" = '14.15 (99)'
wikisql
CREATE TABLE table_203_349 ( id number, "no. in\nseries" number, "no. in\nseason" number, "title" text, "directed by" text, "written by" text, "original air date" text, "production\ncode" text, "u.s. viewers\n(millions)" number )
what director is listed with the same original air date as jeremiah chechik ?
SELECT "directed by" FROM table_203_349 WHERE "directed by" <> 'jeremiah chechik' AND "original air date" = (SELECT "original air date" FROM table_203_349 WHERE "directed by" = 'jeremiah chechik')
squall
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...
when patient 027-203413 had first had the maximum heartrate on this month/27?
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-203413')) AND NOT vitalperiodic.heartrate IS NU...
eicu
CREATE TABLE table_name_69 ( teaching_language VARCHAR, program VARCHAR )
What is the teaching language for Master of Quantitative Finance?
SELECT teaching_language FROM table_name_69 WHERE program = "master of quantitative finance"
sql_create_context
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospita...
patient 004-29334 was allergic to a drug during this month, what was the name of the drug?
SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-29334')) AND DATETIME(allergy.allergytime, 'start of month') = DATETIME(...
eicu
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 )
Display a bar chart for how many products are there for each manufacturer?, could you show in descending by the Y-axis?
SELECT T2.Name, COUNT(*) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_15847691_2 ( points_against INTEGER, attendance VARCHAR )
What is the maximum number of points against when the attendance was 47678?
SELECT MAX(points_against) FROM table_15847691_2 WHERE attendance = 47678
sql_create_context
CREATE TABLE table_name_58 ( venue VARCHAR, home_team VARCHAR )
What is Home team Venue for the hawthorn team?
SELECT venue FROM table_name_58 WHERE home_team = "hawthorn"
sql_create_context
CREATE TABLE table_26133 ( "Type of unit" text, "Type of aircraft" text, "Number of aircraft" text, "Number of crews" text, "Men per crew" text, "Total personnel" real, "Officers" real, "Enlisted" real )
Name the number of crews for light bombardment group
SELECT "Number of crews" FROM table_26133 WHERE "Type of unit" = 'Light bombardment group'
wikisql
CREATE TABLE table_13917 ( "Year(s)" text, "Selection show" text, "Venue" text, "National final main host" text, "National final co host" text, "Semi final/heat host" text )
What is the name of the national final main host at BBC Television Centre, and the selection show was Eurovision: Your Country Needs You?
SELECT "National final main host" FROM table_13917 WHERE "Venue" = 'bbc television centre' AND "Selection show" = 'eurovision: your country needs you'
wikisql
CREATE TABLE table_name_45 ( laps VARCHAR, time_retired VARCHAR )
How many laps were there when the Time/Retired was +14.403?
SELECT laps FROM table_name_45 WHERE time_retired = "+14.403"
sql_create_context
CREATE TABLE table_18600760_13 ( ansi_code VARCHAR, latitude VARCHAR )
How many places associated with latitude 48.247662?
SELECT COUNT(ansi_code) FROM table_18600760_13 WHERE latitude = "48.247662"
sql_create_context
CREATE TABLE table_name_73 ( result VARCHAR, date VARCHAR )
What is the result of the game on October 17, 1965?
SELECT result FROM table_name_73 WHERE date = "october 17, 1965"
sql_create_context
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
Get questions with long titles.
SELECT Score, Id AS "post_link" FROM Posts WHERE (LENGTH(Title) >= 100) AND (@Tag IS NULL OR STR_POSITION(Tags, @Tag) > 0) ORDER BY Score DESC LIMIT 25
sede
CREATE TABLE table_76672 ( "Driver" text, "Team" text, "Race 1" text, "Race 2" text, "Points" real )
Which driver for Greenfield Mowers Racing has fewer than 36 points?
SELECT "Driver" FROM table_76672 WHERE "Points" < '36' AND "Team" = 'greenfield mowers racing'
wikisql
CREATE TABLE table_40262 ( "Date" text, "Time" text, "Home" text, "Away" text, "Score" text, "Ground" text )
What is the Time with a Score that is 65-19?
SELECT "Time" FROM table_40262 WHERE "Score" = '65-19'
wikisql
CREATE TABLE table_27871 ( "Settlement" text, "Cyrillic Name Other Names" text, "Type" text, "Population (2011)" real, "Largest ethnic group (2002)" text, "Dominant religion (2002)" text )
Name the population for 2011 for
SELECT "Population (2011)" FROM table_27871 WHERE "Cyrillic Name Other Names" = 'Српска Црња'
wikisql
CREATE TABLE table_name_99 ( torque VARCHAR, type VARCHAR, code VARCHAR )
What is the torque of the engine with a type 16 valves dohc and a code k4m hi-flex?
SELECT torque FROM table_name_99 WHERE type = "16 valves dohc" AND code = "k4m hi-flex"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text, person_info_CSD text, person_info_CSRQ time, person_info_GJDM text, person_info_GJMC text, person_info_JGDM text, person_info_JGMC text, person_info_MZDM text, person_info_MZMC text, person_info_XBDM ...
从2017年8月1日开始直到2020年3月1日内患者苏秀艾被开出的所有检验报告单的科室序列号以及名称?
SELECT jybgb.KSBM, jybgb.KSMC FROM hz_info JOIN mzjzjlb JOIN jybgb 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 WHERE hz_info.person_info_XM = '苏秀艾' AND jybgb.BGRQ BETWEEN '2017-08-01' AND '...
css
CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text ) CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int )
For each type, how many ships are there. Show the proportion.
SELECT Type, COUNT(*) FROM ship GROUP BY Type
nvbench
CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_p...
For class MEMS 421 , who is the usual teacher ?
SELECT COUNT(instructor.name), instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'MEMS' AND course.number = 421 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = co...
advising
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, ...
how many newborn patients were born before the year 2197?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.dob_year < "2197"
mimicsql_data
CREATE TABLE table_39567 ( "Role" text, "D'Oyly Carte 1920 Tour" text, "D'Oyly Carte 1930 Tour" text, "D'Oyly Carte 1939 Tour" text, "D'Oyly Carte 1945 Tour" text, "D'Oyly Carte 1950 Tour" text )
D'Oyly Carte 1930 Tour of john dean involved what D'Oyly Carte 1945 Tour?
SELECT "D'Oyly Carte 1945 Tour" FROM table_39567 WHERE "D'Oyly Carte 1930 Tour" = 'john dean'
wikisql
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...
People Who Have Accepted My answer.
SELECT q.OwnerUserId AS "user_link", COUNT(*) AS "answers_accepted" FROM Posts AS q INNER JOIN Posts AS a ON q.AcceptedAnswerId = a.Id WHERE a.OwnerUserId = '##UserId:int##' GROUP BY q.OwnerUserId ORDER BY 'answers_accepted' DESC
sede
CREATE TABLE table_141541_5 ( international_mail INTEGER, total_freight_and_mail VARCHAR )
what is the maximum international mail with total freight and mail being 145044
SELECT MAX(international_mail) FROM table_141541_5 WHERE total_freight_and_mail = 145044
sql_create_context
CREATE TABLE table_75939 ( "Draw" real, "Song" text, "Performer" text, "Points" real, "Rank" text )
What is the average number of points when the ranking is 7th and the draw is less than 4?
SELECT AVG("Points") FROM table_75939 WHERE "Rank" = '7th' AND "Draw" < '4'
wikisql
CREATE TABLE table_46486 ( "Order" text, "Episode" text, "Rating" real, "Share" real, "Rating/share (18\u201349)" text, "Viewers (millions)" real, "Rank (Night)" real, "Rank (Timeslot)" real, "Rank (Week)" real )
What is the average week rank with 1.2 ratings, less than 1.94 million viewers, and a night rank less than 11?
SELECT AVG("Rank (Week)") FROM table_46486 WHERE "Rating" = '1.2' AND "Viewers (millions)" < '1.94' AND "Rank (Night)" < '11'
wikisql
CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int,...
which flights on UA and NW go through DENVER
SELECT DISTINCT flight.flight_id FROM airport_service, city, flight, flight_stop WHERE ((flight.airline_code = 'NW') OR (flight.airline_code = 'UA')) AND city.city_code = airport_service.city_code AND city.city_name = 'DENVER' AND flight_stop.stop_airport = airport_service.airport_code AND flight.flight_id = flight_sto...
atis
CREATE TABLE table_31993 ( "Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Winning constructor" text, "Report" text )
Name the circuit for marcel lehoux
SELECT "Circuit" FROM table_31993 WHERE "Winning driver" = 'marcel lehoux'
wikisql
CREATE TABLE table_35348 ( "Round" real, "Pick #" real, "Overall" real, "Name" text, "Position" text, "College" text )
Which Pick # has a Round larger than 5, and a Position of wide receiver, and a Name of gregory spann, and an Overall larger than 228?
SELECT AVG("Pick #") FROM table_35348 WHERE "Round" > '5' AND "Position" = 'wide receiver' AND "Name" = 'gregory spann' AND "Overall" > '228'
wikisql
CREATE TABLE table_name_37 ( mayor VARCHAR, election VARCHAR, municipality VARCHAR )
What is the Mayor of Riva del Garda in 2010?
SELECT mayor FROM table_name_37 WHERE election = 2010 AND municipality = "riva del garda"
sql_create_context
CREATE TABLE table_57527 ( "Class" text, "Type" text, "Introduced" text, "Fleet Size" real, "Numbers" text )
What is the smallest fleet size with a type of shunter introduced in 1953?
SELECT MIN("Fleet Size") FROM table_57527 WHERE "Type" = 'shunter' AND "Introduced" = '1953'
wikisql
CREATE TABLE table_23242958_1 ( no_in_series VARCHAR, written_by VARCHAR )
What number episode in the series was written by David Zuckerman?
SELECT no_in_series FROM table_23242958_1 WHERE written_by = "David Zuckerman"
sql_create_context
CREATE TABLE table_name_29 ( attendance VARCHAR, game_site VARCHAR, result VARCHAR )
Game Site of hoosier dome, and a Result of l 7 31 involved what attendance?
SELECT attendance FROM table_name_29 WHERE game_site = "hoosier dome" AND result = "l 7–31"
sql_create_context
CREATE TABLE table_58973 ( "Provider" text, "Years" text, "Free or pay" text, "No. of channels" text, "Colour" text, "Digital" text, "Transmission" text )
Which provider is pay with analogue cable?
SELECT "Provider" FROM table_58973 WHERE "Free or pay" = 'pay' AND "Transmission" = 'analogue cable'
wikisql
CREATE TABLE table_name_60 ( res VARCHAR, event VARCHAR )
What was the result for the M-1 Selection Europe event?
SELECT res FROM table_name_60 WHERE event = "m-1 selection europe"
sql_create_context
CREATE TABLE table_name_99 ( coach VARCHAR, win__percentage VARCHAR )
What is Coach, when Win % is .352?
SELECT coach FROM table_name_99 WHERE win__percentage = ".352"
sql_create_context
CREATE TABLE table_28637 ( "Rank" real, "Couple" text, "Judges" real, "Public" real, "Total" real, "Vote percentage" text, "Result" text )
what couple had a vote percentage of 5.8%?
SELECT "Couple" FROM table_28637 WHERE "Vote percentage" = '5.8%'
wikisql
CREATE TABLE table_203_306 ( id number, "no." number, "title" text, "directed by" text, "written by" text, "original air date" text )
list the number of items written by brad falchuk
SELECT COUNT("title") FROM table_203_306 WHERE "written by" = 'brad falchuk'
squall
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...
give me the number of patients whose year of birth is less than 2180 and drug name is d12.5w?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2180" AND prescriptions.drug = "D12.5W"
mimicsql_data
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TA...
what was the name of the drug that patient 025-51640 was prescribed after receiving a electrolyte administration procedure in the last hospital visit, during the same day?
SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-51640' AND NOT patient.hospit...
eicu
CREATE TABLE table_230 ( "Race Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Constructor" text, "Report" text )
What date was the Silverstone circuit driven?
SELECT "Date" FROM table_230 WHERE "Circuit" = 'Silverstone'
wikisql
CREATE TABLE table_name_98 ( years VARCHAR, actor VARCHAR )
Which years did Martin Sacks work on a soap opera?
SELECT years FROM table_name_98 WHERE actor = "martin sacks"
sql_create_context
CREATE TABLE table_63720 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What was the score for the away team of Brentford?
SELECT "Score" FROM table_63720 WHERE "Away team" = 'brentford'
wikisql
CREATE TABLE table_name_47 ( opponent VARCHAR, week VARCHAR )
What was week 2's opponent?
SELECT opponent FROM table_name_47 WHERE week = 2
sql_create_context
CREATE TABLE table_name_83 ( industry VARCHAR, profits__billion_$_ VARCHAR, assets__billion_$_ VARCHAR )
For which industry was the profit smaller than 14.2 billion and the assets larger than 2,467.9 billion?
SELECT industry FROM table_name_83 WHERE profits__billion_$_ < 14.2 AND assets__billion_$_ > 2 OFFSET 467.9
sql_create_context
CREATE TABLE table_name_61 ( score VARCHAR, high_rebounds VARCHAR )
What is Score, when High Rebounds is 'Nolan (10)'?
SELECT score FROM table_name_61 WHERE high_rebounds = "nolan (10)"
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 manufacturer over the name , and group by attribute name, could you rank from low to high by the y axis please?
SELECT T1.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Manufacturer
nvbench
CREATE TABLE table_name_47 ( earnings_per_share__p_ VARCHAR, year_ended VARCHAR )
What is the year 2007 earnings per share?
SELECT earnings_per_share__p_ FROM table_name_47 WHERE year_ended = "2007"
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescription...
How many patients had an ascitic fluid lab test and had an endoscopic sphincterotomy and papillotomy procedure done?
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 = "Endoscopic sphincterotomy and papillotomy" AND lab.fluid = "Ascites"
mimicsql_data
CREATE TABLE table_27539272_5 ( location_attendance VARCHAR, score VARCHAR )
what is the total number of locations that had a score of 1-3?
SELECT COUNT(location_attendance) FROM table_27539272_5 WHERE score = "1-3"
sql_create_context
CREATE TABLE table_12722 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
When Rocco Mediate has a To par of +2 and a 69-73=142 score, what is the country listed?
SELECT "Country" FROM table_12722 WHERE "To par" = '+2' AND "Score" = '69-73=142' AND "Player" = 'rocco mediate'
wikisql
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
What is the average salary of employees who have a commission percentage that is not null. Show scatter chart.
SELECT DEPARTMENT_ID, AVG(SALARY) FROM employees WHERE COMMISSION_PCT <> "null" GROUP BY DEPARTMENT_ID
nvbench
CREATE TABLE table_name_46 ( total INTEGER, gold VARCHAR, silver VARCHAR )
What is the lowest total of medals that has a gold of 3 and a silver less than 3?
SELECT MIN(total) FROM table_name_46 WHERE gold = 3 AND silver < 3
sql_create_context
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, ...
provide the number of patients whose admission location is trsf within this facility and year of birth is less than 2137?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.dob_year < "2137"
mimicsql_data
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...
volume (ml) heparin had been given to patient 030-4181 ever in 06/last year?
SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-4181')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput...
eicu
CREATE TABLE table_name_57 ( attendance INTEGER, venue VARCHAR, date VARCHAR )
What is the average Attendance at Venue A on 16 October 2004?
SELECT AVG(attendance) FROM table_name_57 WHERE venue = "a" AND date = "16 october 2004"
sql_create_context
CREATE TABLE table_204_146 ( id number, "tie" number, "home team" text, "score" text, "away team" text, "attendance" number )
how many games attendance was under 1000 ?
SELECT COUNT(*) FROM table_204_146 WHERE "attendance" < 1000
squall
CREATE TABLE table_58399 ( "Event Name" text, "Established" real, "Category" text, "Sub Category" text, "Main Venue" text )
Which is the category of the group was establishe in 1990?
SELECT "Category" FROM table_58399 WHERE "Established" = '1990'
wikisql
CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TE...
Plot year by mean price as a line chart, rank from high to low by the x axis.
SELECT Year, AVG(Price) FROM wine GROUP BY Year ORDER BY Year DESC
nvbench
CREATE TABLE table_name_47 ( power VARCHAR, fuel_system VARCHAR, displacement VARCHAR )
How much power does the fuel injection system have with a displacement of 1991cc?
SELECT power FROM table_name_47 WHERE fuel_system = "fuel injection" AND displacement = "1991cc"
sql_create_context
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, ...
what was the name of the drug that patient 92788 had been prescribed two times in this hospital encounter.
SELECT t1.drug FROM (SELECT prescriptions.drug, COUNT(prescriptions.startdate) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 92788 AND admissions.dischtime IS NULL) GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 = 2
mimic_iii
CREATE TABLE table_name_39 ( name VARCHAR, decile VARCHAR, area VARCHAR )
What school with a decile of 7 is in upper hutt?
SELECT name FROM table_name_39 WHERE decile = "7" AND area = "upper hutt"
sql_create_context
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 prescriptions ( subject_id text, hadm_id...
find out the age and marital status of patient jerry deberry.
SELECT demographic.marital_status, demographic.age FROM demographic WHERE demographic.name = "Jerry Deberry"
mimicsql_data
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( la...
what was the total output for patient 012-4131 on 02/17/2105?
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 = '012-4131')) AND intakeoutput.cellpath LIKE '%out...
eicu
CREATE TABLE table_65235 ( "Title" text, "Series" text, "Characters" text, "Production Num." real, "Release date" text )
When was the film released that a less than 5038 production number and was of the character Bosko?
SELECT "Release date" FROM table_65235 WHERE "Production Num." < '5038' AND "Characters" = 'bosko'
wikisql
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
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, a scatter chart shows the correlation between employee_id and manager_id .
SELECT EMPLOYEE_ID, MANAGER_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
nvbench
CREATE TABLE table_19770 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Game Site" text, "Attendance" real )
what's the result with record being 0 1
SELECT "Result" FROM table_19770 WHERE "Record" = '0–1'
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...
what is the number of patients whose days of hospital stay is greater than 6 and lab test category is chemistry?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "6" AND lab."CATEGORY" = "Chemistry"
mimicsql_data
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 ...
compared to last measured on the last icu visit is the arterial bp [diastolic] of patient 25461 greater than the value second to last measured on the last icu visit?
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25461) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents...
mimic_iii
CREATE TABLE table_59656 ( "Year recorded" text, "Title" text, "Genre" text, "Label" text, "Year inducted" text )
What's the year inducted for the label of label?
SELECT "Year inducted" FROM table_59656 WHERE "Label" = 'label'
wikisql
CREATE TABLE table_14345690_5 ( famous_for VARCHAR, finished VARCHAR )
Who is the famous for that finished 2nd?
SELECT famous_for FROM table_14345690_5 WHERE finished = "2nd"
sql_create_context
CREATE TABLE table_name_20 ( pick INTEGER, position VARCHAR )
what is the highest pick for the position tight end?
SELECT MAX(pick) FROM table_name_20 WHERE position = "tight end"
sql_create_context
CREATE TABLE table_name_21 ( gold VARCHAR, place VARCHAR )
Who won gold when the world championships were held in Phoenix?
SELECT gold FROM table_name_21 WHERE place = "phoenix"
sql_create_context
CREATE TABLE Catalogs ( catalog_id INTEGER, catalog_name VARCHAR(50), catalog_publisher VARCHAR(80), date_of_publication DATETIME, date_of_latest_revision DATETIME ) CREATE TABLE Catalog_Contents ( catalog_entry_id INTEGER, catalog_level_number INTEGER, parent_entry_id INTEGER, prev...
What are the number of the names of catalog entries with level number 8?, and list by the Y in desc.
SELECT catalog_entry_name, COUNT(catalog_entry_name) FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" GROUP BY catalog_entry_name ORDER BY COUNT(catalog_entry_name) DESC
nvbench
CREATE TABLE table_47231 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What is the game with the golden state warriors?
SELECT "Game" FROM table_47231 WHERE "Team" = 'golden state warriors'
wikisql
CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Has_Allergy ( StuID INTEGER, Allergy VARCHAR(20) ) CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), ...
Give me a pie to show the average of age from different sex.
SELECT Sex, AVG(Age) FROM Student GROUP BY Sex
nvbench
CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, ...
are there any nonstop flights leaving from DALLAS to BALTIMORE 7 7 with who UA
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND date_day.day_number = 7 AND date_day.month_number = 7 AN...
atis
CREATE TABLE table_26977890_1 ( result VARCHAR, combatants_b VARCHAR )
With the Royal Navy as Combatants B, what was the result?
SELECT result FROM table_26977890_1 WHERE combatants_b = "Royal Navy"
sql_create_context
CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE airport ( airport_code varchar, airp...
what is the last flight from SAN FRANCISCO to BOSTON this wednesday
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND date_day.day_number = 23 AND date_day.month_number = 4 AND d...
atis
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
when did patient 012-40970 come into the hospital through the step-down unit (sdu) until 2 years ago for the first time?
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '012-40970' AND patient.hospitaladmitsource = 'step-down unit (sdu)' AND DATETIME(patient.hospitaladmittime) <= DATETIME(CURRENT_TIME(), '-2 year') ORDER BY patient.hospitaladmittime LIMIT 1
eicu
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
在0750542医院就医的患者郑碧菡出院的时候其出院诊断结果的诊断医生姓戚的是什么时候?
SELECT OUT_DIAG_DIS_CD, OUT_DIAG_DIS_NM FROM t_kc21 WHERE PERSON_NM = '郑碧菡' AND MED_SER_ORG_NO = '0750542' AND OUT_DIAG_DOC_NM LIKE '戚%'
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 lab ( subject_id text, hadm_id text, ...
count the number of patients whose year of death is less than or equal to 2131 and procedure long title is infusion of vasopressor agent?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2131.0" AND procedures.long_title = "Infusion of vasopressor agent"
mimicsql_data
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
what is days of hospital stay and lab test abnormal status of subject id 74032?
SELECT demographic.days_stay, lab.flag FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.subject_id = "74032"
mimicsql_data
CREATE TABLE table_25716397_1 ( directed_by VARCHAR, series_no VARCHAR )
How many directors of episode 55?
SELECT COUNT(directed_by) FROM table_25716397_1 WHERE series_no = 55
sql_create_context
CREATE TABLE table_39770 ( "Time" text, "12:00 PM" text, "01:00 PM" text, "02:00 PM" text, "03:00 PM" text, "04:00 PM" text, "05:00 PM" text, "05:55 PM" text )
Who preforms at 5:55PM on Monday?
SELECT "05:55 PM" FROM table_39770 WHERE "Time" = 'monday'
wikisql
CREATE TABLE bank ( branch_ID int, bname varchar(20), no_of_customers int, city varchar(10), state varchar(20) ) CREATE TABLE loan ( loan_ID varchar(3), loan_type varchar(15), cust_ID varchar(3), branch_ID varchar(3), amount int ) CREATE TABLE customer ( cust_ID varchar(3),...
For each account type, find the average account balance of customers with credit score lower than 50. Show bar chart.
SELECT acc_type, AVG(acc_bal) FROM customer WHERE credit_score < 50 GROUP BY acc_type
nvbench
CREATE TABLE table_name_77 ( laps VARCHAR, manufacturer VARCHAR, rider VARCHAR )
How many laps did Valentino rossi have when riding a vehicle manufactured by yamaha?
SELECT laps FROM table_name_77 WHERE manufacturer = "yamaha" AND rider = "valentino rossi"
sql_create_context
CREATE TABLE table_13674 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
what is the outcome when the tournament is san diego and the opponent is ann grossman?
SELECT "Outcome" FROM table_13674 WHERE "Tournament" = 'san diego' AND "Opponent" = 'ann grossman'
wikisql
CREATE TABLE table_2779 ( "No." real, "#" real, "Title" text, "Directed by" text, "Written by" text, "U.S. viewers (million)" text, "Rank (week)" real, "Original air date" text )
What was the week ranking of the episode written by Russel Friend & Garrett Lerner?
SELECT "Rank (week)" FROM table_2779 WHERE "Written by" = 'Russel Friend & Garrett Lerner'
wikisql
CREATE TABLE table_203_359 ( id number, "outcome" text, "year" number, "championship" text, "surface" text, "opponent" text, "score" text )
how many total wins has he had ?
SELECT COUNT(*) FROM table_203_359 WHERE "outcome" = 'winner'
squall
CREATE TABLE table_name_83 ( year VARCHAR, accolade VARCHAR )
What year was the accolade for Scottish albums of the decade?
SELECT year FROM table_name_83 WHERE accolade = "scottish albums of the decade"
sql_create_context
CREATE TABLE table_13004 ( "Played" real, "Drawn" real, "Lost" real, "Against" real, "% Won" real )
What is the smallest Against with Lost larger than 0, % Won larger than 50, and Played smaller than 5?
SELECT MIN("Against") FROM table_13004 WHERE "Lost" > '0' AND "% Won" > '50' AND "Played" < '5'
wikisql
CREATE TABLE table_name_72 ( oricon_peak VARCHAR, date_of_release VARCHAR, label VARCHAR, title VARCHAR )
WHAT IS THE ORICON PEAK NUMBER WITH AN ATLANTIC LABEL, SUBHUMAN RACE, LATER THAN 1995?
SELECT COUNT(oricon_peak) FROM table_name_72 WHERE label = "atlantic" AND title = "subhuman race" AND date_of_release > 1995
sql_create_context