context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_66050 ( "Game" text, "Date" text, "Opponent" text, "Score" text, "Location/Attendance" text, "Record" text )
What was the location and attendance at the game when the record was 9-6?
SELECT "Location/Attendance" FROM table_66050 WHERE "Record" = '9-6'
wikisql
CREATE TABLE table_name_1 ( nation_represented VARCHAR, year VARCHAR )
Which nation won the boxing championship in 2012?
SELECT nation_represented FROM table_name_1 WHERE year = 2012
sql_create_context
CREATE TABLE table_204_680 ( id number, "released" text, "title" text, "artist" text, "format" text, "language" text )
who released the most songs ?
SELECT "artist" FROM table_204_680 GROUP BY "artist" ORDER BY COUNT("title") DESC LIMIT 1
squall
CREATE TABLE table_8079 ( "County or City" text, "NUTS 3 Region" text, "Population (2006)" text, "Area (km\u00b2)" text, "Population Density" text, "Principal town/city" text, "Vehicle Registration Code" text )
What is the 2006 population of the area with vehicle registration code of G and population density of 1,432.0?
SELECT "Population (2006)" FROM table_8079 WHERE "Vehicle Registration Code" = 'g' AND "Population Density" = '1,432.0'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
what is the number of patients whose ethnicity is white and diagnoses icd9 code is 7847?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "WHITE" AND diagnoses.icd9_code = "7847"
mimicsql_data
CREATE TABLE table_name_53 ( high_points VARCHAR, date VARCHAR )
who has the high points on june 16?
SELECT high_points FROM table_name_53 WHERE date = "june 16"
sql_create_context
CREATE TABLE table_name_26 ( t__µm_ INTEGER, technology VARCHAR )
What is the sum of t ( m), when Technology is MJ?
SELECT SUM(t__µm_) FROM table_name_26 WHERE technology = "mj"
sql_create_context
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
在哪几次医疗记录中患者21485426被开出的均低于7162.91元的药品?列出医疗就诊编号是什么?
SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '21485426' AND NOT t_kc21.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT >= 7162.91)
css
CREATE TABLE table_77670 ( "Debut year" real, "Player" text, "Date of birth" text, "Games" real, "Goals" real, "Years at club" text )
What is the years at the club of the player with 2 goals and was born on 23 July 1910?
SELECT "Years at club" FROM table_77670 WHERE "Goals" = '2' AND "Date of birth" = '23 july 1910'
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, ...
Tell me the number of female patients who had replacement of tube or enterostomy device of the small intestine.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "F" AND procedures.long_title = "Replacement of tube or enterostomy device of small intestine"
mimicsql_data
CREATE TABLE table_23852 ( "No. in series" real, "Title" text, "Directedby" text, "Writtenby" text, "Originalairdate" text, "Production code" text )
What title episode did Paris Barclay direct?
SELECT "Title" FROM table_23852 WHERE "Directedby" = 'Paris Barclay'
wikisql
CREATE TABLE table_48344 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" real, "Finish" text )
What is Player, when To Par is less than 14?
SELECT "Player" FROM table_48344 WHERE "To par" < '14'
wikisql
CREATE TABLE table_26677836_1 ( lost INTEGER )
What is the highest lost?
SELECT MAX(lost) FROM table_26677836_1
sql_create_context
CREATE TABLE Residents ( resident_id INTEGER, property_id INTEGER, date_moved_in DATETIME, date_moved_out DATETIME, other_details VARCHAR(255) ) CREATE TABLE Organizations ( organization_id INTEGER, parent_organization_id INTEGER, organization_details VARCHAR(255) ) CREATE TABLE Custom...
Show the number of type of thing code from each type of thing code, and could you rank Type_of_Thing_Code from low to high order?
SELECT Type_of_Thing_Code, COUNT(Type_of_Thing_Code) FROM Things GROUP BY Type_of_Thing_Code ORDER BY Type_of_Thing_Code
nvbench
CREATE TABLE table_43076 ( "Tournament" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text )
What is the 2010 of the Grand Slam Tournaments in 2011?
SELECT "2010" FROM table_43076 WHERE "2011" = 'grand slam tournaments'
wikisql
CREATE TABLE Procedures ( Code INTEGER, Name VARCHAR(30), Cost REAL ) CREATE TABLE Room ( RoomNumber INTEGER, RoomType VARCHAR(30), BlockFloor INTEGER, BlockCode INTEGER, Unavailable BOOLEAN ) CREATE TABLE Undergoes ( Patient INTEGER, Procedures INTEGER, Stay INTEGER, D...
Find the number of medications prescribed for each brand Plot them as bar chart, order from low to high by the X-axis please.
SELECT Name, COUNT(*) FROM Medication AS T1 JOIN Prescribes AS T2 ON T1.Code = T2.Medication GROUP BY T1.Brand ORDER BY Name
nvbench
CREATE TABLE table_name_88 ( club VARCHAR, head_coach VARCHAR )
What club does Manuel Fernandes coach?
SELECT club FROM table_name_88 WHERE head_coach = "manuel fernandes"
sql_create_context
CREATE TABLE table_name_86 ( Id VARCHAR )
What is the 1998 value if the 2011 value is 30.4?
SELECT 1998 FROM table_name_86 WHERE 2011 = "30.4"
sql_create_context
CREATE TABLE table_name_67 ( loss VARCHAR, record VARCHAR )
What is the loss when the record is 38-33?
SELECT loss FROM table_name_67 WHERE record = "38-33"
sql_create_context
CREATE TABLE table_59210 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" real )
What years did the player with a total larger than 157 have wins?
SELECT "Year(s) won" FROM table_59210 WHERE "Total" > '157'
wikisql
CREATE TABLE table_name_97 ( character_name VARCHAR, leading_lady VARCHAR )
What is the character name that has phyllis welch as the leading lady?
SELECT character_name FROM table_name_97 WHERE leading_lady = "phyllis welch"
sql_create_context
CREATE TABLE table_42664 ( "Rank" real, "Province" text, "Population" real, "Area" real, "Density" real )
What is the lowest population total in La Romana when the area is less than 1,788.4, the density is greater than 234.77, and a rank greater than 30
SELECT MIN("Population") FROM table_42664 WHERE "Area" < '1,788.4' AND "Density" > '234.77' AND "Province" = 'la romana' AND "Rank" > '30'
wikisql
CREATE TABLE table_30058355_2 ( thurs_25_aug VARCHAR, wed_24_aug VARCHAR )
What is the thurs 25 aug when wed 24 aug is 19' 59.73 113.216mph?
SELECT thurs_25_aug FROM table_30058355_2 WHERE wed_24_aug = "19' 59.73 113.216mph"
sql_create_context
CREATE TABLE table_38785 ( "Round" text, "Player" text, "Position" text, "Nationality" text, "College/Junior/Club Team (League)" text )
What is Brendan Locke's College/Junior/Club Team (League)?
SELECT "College/Junior/Club Team (League)" FROM table_38785 WHERE "Player" = 'brendan locke'
wikisql
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid nu...
tell me the difference between the total amount of input and output from patient 31880 on 01/05/last year?
SELECT (SELECT SUM(inputevents_cv.amount) 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 = 31880)) AND DATETIME(inputevents_cv.charttime, 'start of year') = DATETIME(CURRENT...
mimic_iii
CREATE TABLE table_23033 ( "Application" text, "Latest release date and version" text, "Developed by" text, "Platforms" text, "Mainly Used For" text, "License" text )
Name the platforms for cityengine
SELECT "Platforms" FROM table_23033 WHERE "Application" = 'CityEngine'
wikisql
CREATE TABLE table_name_6 ( mel_martinez__r_ VARCHAR, sample_size VARCHAR )
What is the percentage for Mel Martinez when the sample size is 800?
SELECT mel_martinez__r_ FROM table_name_6 WHERE sample_size = 800
sql_create_context
CREATE TABLE table_203_397 ( id number, "series" text, "launch date" text, "finale date" text, "days" number, "housemates" number, "winner" text, "main presenter" text, "grand prize" text, "liveshow\naudience\nmillions" number )
who was the main presenter previous to barbara d'urso ?
SELECT "main presenter" FROM table_203_397 WHERE "launch date" < (SELECT "launch date" FROM table_203_397 WHERE "main presenter" = "barbara d'urso") ORDER BY "launch date" DESC LIMIT 1
squall
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...
在15年6月14日到17年1月10日期间,医疗机构8513028处理的新生儿门诊的就诊次数共是多少次?
SELECT COUNT(*) FROM zzmzjzjlb WHERE zzmzjzjlb.YLJGDM = '8513028' AND zzmzjzjlb.JZKSRQ BETWEEN '2015-06-14' AND '2017-01-10' AND zzmzjzjlb.ZSEBZ > 0 UNION SELECT COUNT(*) FROM fzzmzjzjlb WHERE fzzmzjzjlb.YLJGDM = '8513028' AND fzzmzjzjlb.JZKSRQ BETWEEN '2015-06-14' AND '2017-01-10' AND fzzmzjzjlb.ZSEBZ > 0
css
CREATE TABLE table_54878 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Date" text )
What date is the Victoria Park venue?
SELECT "Date" FROM table_54878 WHERE "Venue" = 'victoria park'
wikisql
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicationid ...
when was the first time on 04/05/2103 that patient 027-64792 had his or her heartrate measured?
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-64792')) AND NOT vitalperiodic.heartrate IS NUL...
eicu
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeri...
how many days have elapsed since the time patient 005-4471 was admitted to the icu?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '005-4471' AND patient.unitdischargetime IS NULL
eicu
CREATE TABLE Financial_Transactions ( transaction_id INTEGER, previous_transaction_id INTEGER, account_id INTEGER, card_id INTEGER, transaction_type VARCHAR(15), transaction_date DATETIME, transaction_amount DOUBLE, transaction_comment VARCHAR(255), other_transaction_details VARCHAR(...
Give me a bar chart showing the number of customers who has an account for each customer last name, I want to display in ascending by the y-axis.
SELECT customer_last_name, COUNT(customer_last_name) FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id GROUP BY customer_last_name ORDER BY COUNT(customer_last_name)
nvbench
CREATE TABLE table_202_76 ( id number, "member" text, "party" text, "term" text )
how long did ian armstrong serve ?
SELECT "term" - "term" FROM table_202_76 WHERE "member" = 'ian armstrong'
squall
CREATE TABLE table_50297 ( "Player" text, "Nationality" text, "Position" text, "Years for Grizzlies" text, "School/Club Team" text )
What nationality is the forward/center position?
SELECT "Nationality" FROM table_50297 WHERE "Position" = 'forward/center'
wikisql
CREATE TABLE table_34549 ( "Rank" real, "Country" text, "International tourist arrivals (2012)" text, "International tourist arrivals (2011)" text, "Change (2011 to 2012)" text, "Change (2010 to 2011)" text )
In 2011, how many tourists visited the country that had 23.4 million tourists in 2012?
SELECT "International tourist arrivals (2011)" FROM table_34549 WHERE "International tourist arrivals (2012)" = '23.4 million'
wikisql
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
how many days has it been since the first time on this hospital visit that patient 016-9636 had a procedure performed?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-9636' ...
eicu
CREATE TABLE zyjzjlb ( YLJGDM text, JZLSH text, MZJZLSH text, KH text, KLX number, HZXM text, WDBZ number, RYDJSJ time, RYTJDM number, RYTJMC text, JZKSDM text, JZKSMC text, RZBQDM text, RZBQMC text, RYCWH text, CYKSDM text, CYKSMC text, CYBQDM tex...
用哪个设备做的71379731927检查结果指标记录设备编码和仪器编号以及名称分别是什么
SELECT SBBM, YQBH, YQMC FROM jyjgzbb WHERE JYZBLSH = '71379731927'
css
CREATE TABLE table_name_32 ( year INTEGER, tyres VARCHAR, points VARCHAR )
What is the lowest year with tyres in g and less than 0 points?
SELECT MIN(year) FROM table_name_32 WHERE tyres = "g" AND points < 0
sql_create_context
CREATE TABLE table_name_62 ( baltimore_group VARCHAR, family VARCHAR )
Which Baltimore group is of the retroviridae family?
SELECT baltimore_group FROM table_name_62 WHERE family = "retroviridae"
sql_create_context
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,...
what is the cheapest fare one way between PITTSBURGH and DENVER
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 = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.c...
atis
CREATE TABLE table_name_37 ( state VARCHAR, city VARCHAR )
What is the State with Suwon as the city
SELECT state FROM table_name_37 WHERE city = "suwon"
sql_create_context
CREATE TABLE table_51683 ( "Debut year" real, "Player" text, "Date of birth" text, "Games" real, "Goals" real, "Years at club" text )
What is the number of Years at Club for the player who has had more games than 28, more Goals than 225, and his Debut year was after 1950?
SELECT "Years at club" FROM table_51683 WHERE "Games" > '28' AND "Goals" > '225' AND "Debut year" > '1950'
wikisql
CREATE TABLE table_39384 ( "Year" real, "Championship" text, "54 holes" text, "Winning score" text, "Margin" text, "Runner(s)-up" text )
Who are the Runner(s)-up with a Margin of 3 strokes?
SELECT "Runner(s)-up" FROM table_39384 WHERE "Margin" = '3 strokes'
wikisql
CREATE TABLE table_name_16 ( driver_s_ VARCHAR, crew_chief VARCHAR )
Who is the driver of the team with the crew chief Derrick Finley?
SELECT driver_s_ FROM table_name_16 WHERE crew_chief = "derrick finley"
sql_create_context
CREATE TABLE table_203_718 ( id number, "pos" text, "rider" text, "manufacturer" text, "time/retired" text, "points" number )
how many riders got more than 10 points ?
SELECT COUNT("rider") FROM table_203_718 WHERE "points" > 10
squall
CREATE TABLE table_1783 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "Record" text, "Attendance" real )
What is the record when the game was at the San Diego Stadium?
SELECT "Record" FROM table_1783 WHERE "Game site" = 'San Diego Stadium'
wikisql
CREATE TABLE table_56063 ( "Round" text, "Date" text, "Opponent" text, "Score" text, "Attendance" real, "Report" text )
On what Date was the Opponent Panathinaikos?
SELECT "Date" FROM table_56063 WHERE "Opponent" = 'panathinaikos'
wikisql
CREATE TABLE table_name_38 ( year INTEGER, remixed_by VARCHAR )
What the highest Year with a Remixed by Laurent Boutonnat?
SELECT MAX(year) FROM table_name_38 WHERE remixed_by = "laurent boutonnat"
sql_create_context
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime tim...
when did patient 8016 had a mch test the first time during a month before?
SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'mch') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8016) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIM...
mimic_iii
CREATE TABLE table_name_81 ( high_points VARCHAR, game VARCHAR )
What is High Points, when Game is '3'?
SELECT high_points FROM table_name_81 WHERE game = 3
sql_create_context
CREATE TABLE table_26419467_1 ( alumni VARCHAR, fresh_meat_partner VARCHAR )
What alumni had noor jehangir as their fresh meat partner?
SELECT alumni FROM table_26419467_1 WHERE fresh_meat_partner = "Noor Jehangir"
sql_create_context
CREATE TABLE table_200_32 ( id number, "year" number, "w" number, "l" number, "t" number, "finish" text, "coach" text )
who coached the muncie flyers to an indiana state championship ?
SELECT "coach" FROM table_200_32 WHERE "finish" = 'indiana state champs'
squall
CREATE TABLE table_47566 ( "Event" text, "Games played" real, "Goals" real, "Assists" real, "Points" real )
What is the highest amount of points with less than 5 assists and less than 2 goals?
SELECT MAX("Points") FROM table_47566 WHERE "Assists" < '5' AND "Goals" < '2'
wikisql
CREATE TABLE Playlist ( PlaylistId integer, Name varchar(120) ) CREATE TABLE Album ( AlbumId integer, Title varchar(160), ArtistId integer ) CREATE TABLE Genre ( GenreId integer, Name varchar(120) ) CREATE TABLE Employee ( EmployeeId integer, LastName varchar(20), FirstName va...
What are the first names and support rep ids for employees serving 10 or more customers, and order X-axis in descending order.
SELECT T1.FirstName, T1.SupportRepId FROM Customer AS T1 JOIN Employee AS T2 ON T1.SupportRepId = T2.EmployeeId ORDER BY T1.FirstName DESC
nvbench
CREATE TABLE table_69180 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text )
What was the score when the Rangers' attendance was 23,493?
SELECT "Score" FROM table_69180 WHERE "Attendance" = '23,493'
wikisql
CREATE TABLE students_in_detention ( student_id number, detention_id number, incident_id number ) CREATE TABLE detention ( detention_id number, detention_type_code text, teacher_id number, datetime_detention_start time, datetime_detention_end time, detention_summary text, other_...
How many addresses have zip code 197?
SELECT COUNT(*) FROM addresses WHERE zip_postcode = "197"
spider
CREATE TABLE table_15187735_20 ( episode INTEGER )
What is the first episode number?
SELECT MIN(episode) FROM table_15187735_20
sql_create_context
CREATE TABLE table_59248 ( "County" text, "Precincts" text, "E. Greenberg" text, "G. Hager" text, "T. Wyka" text )
Which Precincts has a County of passaic?
SELECT "Precincts" FROM table_59248 WHERE "County" = 'passaic'
wikisql
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime ti...
count the number of times until 2100 patient 16572 received a closed liver biopsy.
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 = 'closed liver biopsy') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 16572) AND STRFTIME('%y', proce...
mimic_iii
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CRE...
what time was patient 035-13344 prescribed a drug for the last time until 27 months ago?
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 = '035-13344')) AND DATETIME(medication.drugstarttime) <= DATETIM...
eicu
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) ...
what drug was the first drug prescribed for patient 99661 until 07/2101?
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99661) AND STRFTIME('%y-%m', prescriptions.startdate) <= '2101-07' ORDER BY prescriptions.startdate LIMIT 1
mimic_iii
CREATE TABLE table_14706 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What nation had 135 Bronze medals?
SELECT COUNT("Bronze") FROM table_14706 WHERE "Total" = '135'
wikisql
CREATE TABLE table_76376 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the lowest number of gold medals the nation with less than 0 silver medals has?
SELECT MIN("Gold") FROM table_76376 WHERE "Silver" < '0'
wikisql
CREATE TABLE table_62936 ( "Rank" real, "Name" text, "Capacity ( MW )" real, "Province" text, "Type" text )
what is the name when the type is hydro, the capacity (mw) is less than 478, the rank is more than 85 and the province is quebec?
SELECT "Name" FROM table_62936 WHERE "Type" = 'hydro' AND "Capacity ( MW )" < '478' AND "Rank" > '85' AND "Province" = 'quebec'
wikisql
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, ...
Get the avg size of a question for a tag.
SELECT AVG(LENGTH(p.Body)) FROM Posts AS p INNER JOIN PostTags AS pt ON pt.TagId = @TagId WHERE pt.PostId = p.Id AND p.PostTypeId = 1
sede
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 demographic (...
count the number of patients whose diagnoses icd9 code is v489 and drug type is additive?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "V489" AND prescriptions.drug_type = "ADDITIVE"
mimicsql_data
CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE airport ( airport_code varchar, ...
show me flights from DENVER to ATLANTA
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA...
atis
CREATE TABLE table_16448 ( "1973 Democratic initial primary" text, "Manhattan" text, "The Bronx" text, "Brooklyn" text, "Queens" text, "Richmond [Staten Is.]" text, "Total" real, "%" text )
What is the manhattan for richmond 35%?
SELECT "Manhattan" FROM table_16448 WHERE "Richmond [Staten Is.]" = '35%'
wikisql
CREATE TABLE table_76151 ( "Position" real, "Team" text, "Points" real, "Played" real, "Drawn" real, "Lost" real, "Against" real, "Difference" text )
What was the total number of Points when the value Difference was 13, and when the value Lost was greater than 3?
SELECT SUM("Points") FROM table_76151 WHERE "Difference" = '13' AND "Lost" > '3'
wikisql
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostHistory...
Zero scored question with no actual answer. Questions having zero score or less, zero answers
SELECT Id AS "post_link", Score AS "Votes", CreationDate AS "Posted", LastActivityDate AS "Last Active", ViewCount AS "Views", CommentCount AS "Comments" FROM Posts WHERE PostTypeId = 1 AND AcceptedAnswerId IS NULL AND ClosedDate IS NULL AND AnswerCount = 0 AND CreationDate < DATEADD(Year, -'##Year##', GETDATE()) AND S...
sede
CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE days ( days_code varchar, ...
show flights from PHILADELPHIA to SAN FRANCISCO
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'S...
atis
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 treatment ( treat...
how many hours has patient 021-95970 been since the first procedure during this hospital encounter?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-95970...
eicu
CREATE TABLE table_61086 ( "Place" real, "Name" text, "All Around" real, "Rope" real, "Total" real )
What is Milena Reljin's place with a smaller than 9.8 rope?
SELECT "Place" FROM table_61086 WHERE "Rope" < '9.8' AND "Name" = 'milena reljin'
wikisql
CREATE TABLE Customers ( customer_status_code VARCHAR )
List all customer status codes and the number of customers having each status code.
SELECT customer_status_code, COUNT(*) FROM Customers GROUP BY customer_status_code
sql_create_context
CREATE TABLE table_name_29 ( Id VARCHAR )
What is the 2005 figure when 2002 is A and 2010 is 3R?
SELECT 2005 FROM table_name_29 WHERE 2002 = "a" AND 2010 = "3r"
sql_create_context
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 procedures ( ...
what is the number of patients whose language is engl and age is less than 30?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.language = "ENGL" AND demographic.age < "30"
mimicsql_data
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...
患者95153262在哪几次医疗记录中药品金额高于3127.09元?医疗就诊编号是多少
SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '95153262' AND NOT t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT <= 3127.09)
css
CREATE TABLE table_204_207 ( id number, "week" number, "date" text, "opponent" text, "result" text, "attendance" number, "bye" text )
what is the only week with more than 80,000 attendance
SELECT "week" FROM table_204_207 WHERE "attendance" > 80000
squall
CREATE TABLE table_47544 ( "Elector" text, "Nationality" text, "Order" text, "Title" text, "Elevated" text, "Elevator" text )
What is the Title of Elector Giovanni Boccamazza?
SELECT "Title" FROM table_47544 WHERE "Elector" = 'giovanni boccamazza'
wikisql
CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER ) CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT )
what is the average age for a male in each job?, list by the mean age in asc.
SELECT job, AVG(age) FROM Person WHERE gender = 'male' GROUP BY job ORDER BY AVG(age)
nvbench
CREATE TABLE table_21330550_2 ( winner VARCHAR, location VARCHAR )
Who is the winner in the location of ljvm coliseum winston-salem, nc?
SELECT winner FROM table_21330550_2 WHERE location = "LJVM Coliseum • Winston-Salem, NC"
sql_create_context
CREATE TABLE table_44636 ( "State" text, "Type" text, "Name" text, "Title" text, "Royal house" text, "From" text )
What type is You from the state of Chen?
SELECT "Type" FROM table_44636 WHERE "State" = 'chen' AND "Name" = 'you'
wikisql
CREATE TABLE table_46957 ( "Squad No." real, "Name" text, "Position" text, "League Apps" text, "League Goals" real, "FA Cup Apps" text, "FA Cup Goals" real, "League Cup Apps" text, "League Cup Goals" real, "Total Apps" text, "Total Goals" real )
What is the league goals when the league cup goals is less than 0 and 16 (1) league apps?
SELECT AVG("League Goals") FROM table_46957 WHERE "League Apps" = '16 (1)' AND "League Cup Goals" < '0'
wikisql
CREATE TABLE party_forms ( party_id number, form_id number, date_completion_started time, form_status_code text, date_fully_completed time ) CREATE TABLE individuals ( individual_id number, individual_first_name text, individual_middle_name text, inidividual_phone text, individu...
What are the first, middle, and last names of all individuals, ordered by last name?
SELECT individual_first_name, individual_middle_name, individual_last_name FROM individuals ORDER BY individual_last_name
spider
CREATE TABLE table_name_7 ( away_team VARCHAR, tie_no VARCHAR )
who is the away team when the tie no is 7?
SELECT away_team FROM table_name_7 WHERE tie_no = "7"
sql_create_context
CREATE TABLE table_name_51 ( year INTEGER, nominated_work VARCHAR, category VARCHAR )
What is the total number of years in which Eiza Gonz lez had a nominated work in the category of solista favorito?
SELECT SUM(year) FROM table_name_51 WHERE nominated_work = "eiza gonzález" AND category = "solista favorito"
sql_create_context
CREATE TABLE table_203_757 ( id number, "year" number, "award ceremony" text, "category" text, "film/show" text, "result" text )
what was the last award ceremony on the film/show sarabhai vs sarabhi ?
SELECT "award ceremony" FROM table_203_757 WHERE "film/show" = 'sarabhai vs sarabhai' ORDER BY id DESC LIMIT 1
squall
CREATE TABLE table_48313 ( "Wicket" text, "Runs" text, "Batsmen" text, "Opponent" text, "Venue" text, "Season" text )
Who were the batsmen paired for wicket 7?
SELECT "Batsmen" FROM table_48313 WHERE "Wicket" = '7'
wikisql
CREATE TABLE table_62898 ( "Title" text, "Type" text, "Artist" text, "Label" text, "Standard number" text, "Release date" text )
What Title has the Label of Columbia and Standard number of CODC-8760?
SELECT "Title" FROM table_62898 WHERE "Label" = 'columbia' AND "Standard number" = 'codc-8760'
wikisql
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE d_labitems ( row_id number, itemid number, label te...
get the id's of the patients who were diagnosed with primary hyperparathyroid during this year.
SELECT admissions.subject_id FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'primary hyperparathyroid') AND DATETIME(diagnoses_icd.charttime, 'start of...
mimic_iii
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 ) ...
provide the number of patients whose procedure long title is percutaneous (endoscopic) jejunostomy (pej) and lab test fluid is joint fluid.
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 = "Percutaneous (endoscopic) jejunostomy [PEJ]" AND lab.fluid = "Joint Fluid"
mimicsql_data
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...
患者柏曼衍在2003年11月1日到2008年6月26日这五年里,在医疗机构8406678开了多少西药?
SELECT COUNT(*) FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '柏曼衍' AND t_kc22.STA_DATE BETWEEN '2003-11-01' AND '2008-06-26' AND t_kc21.MED_SER_ORG_NO = '8406678' AND t_kc22.MED_INV_ITEM...
css
CREATE TABLE table_3457 ( "Year" real, "Starts" real, "Wins" real, "Top 5" real, "Top 10" real, "Poles" real, "Avg. Start" text, "Avg. Finish" text, "Winnings" text, "Position" text, "Team(s)" text )
What is every year with average start of 27.2?
SELECT "Year" FROM table_3457 WHERE "Avg. Start" = '27.2'
wikisql
CREATE TABLE table_name_83 ( goals_for VARCHAR, drawn VARCHAR )
How many Goals For have Drawn of 10?
SELECT COUNT(goals_for) FROM table_name_83 WHERE drawn = 10
sql_create_context
CREATE TABLE table_4641 ( "Series" text, "Theme" text, "Start" text, "Finale" text, "Days" real, "Housemates" real, "Winner" text, "Prize money" text, "Presenter" text, "Co-presenter" text )
What's the theme for a series of season 3 with smaller than 148 days?
SELECT "Theme" FROM table_4641 WHERE "Days" < '148' AND "Series" = 'season 3'
wikisql
CREATE TABLE table_name_24 ( seasons VARCHAR, driver VARCHAR )
Which seasons have fernando alonso as the driver?
SELECT seasons FROM table_name_24 WHERE driver = "fernando alonso"
sql_create_context
CREATE TABLE table_2639433_4 ( market_share__target_group_14_49_ VARCHAR, viewers__in_millions_target_group_14_49_ VARCHAR )
How many times was the viewer target group 0.63?
SELECT COUNT(market_share__target_group_14_49_) FROM table_2639433_4 WHERE viewers__in_millions_target_group_14_49_ = "0.63"
sql_create_context
CREATE TABLE table_name_10 ( attendance VARCHAR, tie_no VARCHAR )
What is the Attendance of Tie no 3?
SELECT attendance FROM table_name_10 WHERE tie_no = "3"
sql_create_context
CREATE TABLE table_77650 ( "Date" text, "Round" text, "Opponents" text, "H / A" text, "Result F\u2013A" text, "Attendance" real )
What is the H/A for 20 february 2007?
SELECT "H / A" FROM table_77650 WHERE "Date" = '20 february 2007'
wikisql