context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
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, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE...
what is the marital status of patient 43052 during the first hospital encounter?
SELECT admissions.marital_status FROM admissions WHERE admissions.subject_id = 43052 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1
mimic_iii
CREATE TABLE table_2071644_1 ( flange_thickness__mm_ VARCHAR, weight__kg_m_ VARCHAR )
What is the flange thickness (mm) for the weight (kg/m) 10.4?
SELECT flange_thickness__mm_ FROM table_2071644_1 WHERE weight__kg_m_ = "10.4"
sql_create_context
CREATE TABLE table_29514 ( "Year" text, "Summits" text, "Country" text, "Continent" text, "Elevation ft" real, "Elevation m" real )
what is the continent in which the country russia is listed?
SELECT "Continent" FROM table_29514 WHERE "Country" = 'Russia'
wikisql
CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, ...
Which Winter courses are only offered then ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'EECS' AND semester.semester = 'Winter' AND (SELECT COUNT(DISTINCT SEMESTE...
advising
CREATE TABLE table_42247 ( "Event" text, "Record" text, "Nation" text, "Date" text, "Venue" text )
Which Record has a Date of 23 february 1986?
SELECT "Record" FROM table_42247 WHERE "Date" = '23 february 1986'
wikisql
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, value...
what was patient 76372's first tested specimen in the current hospital encounter?
SELECT microbiologyevents.spec_type_desc FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 76372 AND admissions.dischtime IS NULL) ORDER BY microbiologyevents.charttime LIMIT 1
mimic_iii
CREATE TABLE table_64333 ( "Year" real, "1st Place Team" text, "2nd Place Team" text, "3rd Place Team" text, "4th Place Team" text, "Host Location" text )
What year was the 1st Place Team the Hoak Packers, Fresno, CA, and 4th Place was Wells Motors, Greeley, Co?
SELECT MAX("Year") FROM table_64333 WHERE "1st Place Team" = 'hoak packers, fresno, ca' AND "4th Place Team" = 'wells motors, greeley, co'
wikisql
CREATE TABLE table_1108394_43 ( _percentage VARCHAR, total VARCHAR, queens VARCHAR )
what's the % with total value of 249887 and queens value of 6.8%
SELECT _percentage FROM table_1108394_43 WHERE total = 249887 AND queens = "6.8_percentage"
sql_create_context
CREATE TABLE table_name_89 ( report VARCHAR, date VARCHAR, away_team VARCHAR )
What kind of report was for the game played on 29 November with Melbourne Tigers being the away team?
SELECT report FROM table_name_89 WHERE date = "29 november" AND away_team = "melbourne tigers"
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
what is the number of patients with snf discharge who stayed in the hospital for more than 15 days?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SNF" AND demographic.days_stay > "15"
mimicsql_data
CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE sportsinfo ( stuid number, sportname text, hoursperweek number, gamesplayed number, onscholarship text ) CREATE TABLE video...
How many students play sports?
SELECT COUNT(DISTINCT stuid) FROM sportsinfo
spider
CREATE TABLE table_name_32 ( album VARCHAR, bass VARCHAR, drums VARCHAR )
Which album had Jay Bentley on bass and Bobby Schayer on drums?
SELECT album FROM table_name_32 WHERE bass = "jay bentley" AND drums = "bobby schayer"
sql_create_context
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, ...
what was the first time that the heart rate of patient 31880 was, on 01/10/last year, greater than 100.0?
SELECT chartevents.charttime 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 = 31880)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart ra...
mimic_iii
CREATE TABLE table_30218 ( "District" text, "Status" text, "Date abolished" text, "Former county" text, "Successor" text )
What are the statuses of the districts whose successor is Wiltshire?
SELECT "Status" FROM table_30218 WHERE "Successor" = 'Wiltshire'
wikisql
CREATE TABLE table_name_83 ( title VARCHAR, year VARCHAR, genre VARCHAR )
What was the title of Ashanti's 2003 rap song?
SELECT title FROM table_name_83 WHERE year = 2003 AND genre = "rap"
sql_create_context
CREATE TABLE artist ( Artist_ID int, Name text, Country text, Year_Join int, Age int ) CREATE TABLE exhibition ( Exhibition_ID int, Year int, Theme text, Artist_ID int, Ticket_Price real ) CREATE TABLE exhibition_record ( Exhibition_ID int, Date text, Attendance int...
For artist names who are not from United States, show me a stacked that the x-axis is the Year_Join and the group by name in Y, and order by the total number from high to low.
SELECT Year_Join, COUNT(Year_Join) FROM artist WHERE Country <> 'United States' GROUP BY Name ORDER BY COUNT(Year_Join) DESC
nvbench
CREATE TABLE table_203_645 ( id number, "lower mississippi periods" text, "lower yazoo phases" text, "lower yazoo\ndates" text, "tensas/natchez phases" text, "cahokia phases" text, "cahokia dates" text, "ohio/miss. river\nconfluence phases" text, "ohio/miss. dates" text )
what is the name of the last cahokia phase ?
SELECT "cahokia phases" FROM table_203_645 ORDER BY id DESC LIMIT 1
squall
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varcha...
For those employees who was hired before 2002-06-21, return a bar chart about the distribution of job_id and the sum of employee_id , and group by attribute job_id, and display from low to high by the y axis please.
SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY SUM(EMPLOYEE_ID)
nvbench
CREATE TABLE table_name_31 ( year_born INTEGER, position VARCHAR, player VARCHAR )
When was tony parker (guard) born?
SELECT MAX(year_born) FROM table_name_31 WHERE position = "guard" AND player = "tony parker"
sql_create_context
CREATE TABLE table_name_58 ( year VARCHAR, finish_position VARCHAR )
What year has 59th as a finish position?
SELECT year FROM table_name_58 WHERE finish_position = "59th"
sql_create_context
CREATE TABLE table_79232 ( "School" text, "Mascot" text, "Location" text, "Enrollment" real, "IHSAA Class" text, "IHSAA Football Class" text, "County" text )
What location has an enrollment greater than 1,313, and kingsmen as the mascot?
SELECT "Location" FROM table_79232 WHERE "Enrollment" > '1,313' AND "Mascot" = 'kingsmen'
wikisql
CREATE TABLE table_name_58 ( game_site VARCHAR, record VARCHAR )
Which game site(s) had record of 2-2?
SELECT game_site FROM table_name_58 WHERE record = "2-2"
sql_create_context
CREATE TABLE table_204_132 ( id number, "year" number, "location" text, "men's individual" text, "women's individual" text, "men's team" text, "women's team" text, "mixed team" text, "ref" number )
what women 's team won the last competition ?
SELECT "women's team" FROM table_204_132 WHERE NOT "women's team" IS NULL ORDER BY "year" DESC LIMIT 1
squall
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE procedures_icd ( row_id number, subject_id nu...
find the number of people diagnosed with popliteal synovial cyst.
SELECT COUNT(DISTINCT 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 = 'popliteal synovial cyst'))
mimic_iii
CREATE TABLE table_30956 ( "Episode" text, "First broadcast" text, "Andrew and Georgies guest" text, "Jamie and Johns guest Dermot OLeary replaced Jamie Redknapp as team captain for one week in series 3, episode 8." text, "Scores" text )
Who was Andrew and Georgie's gues when Jamie and John's guest was Phil Taylor?
SELECT "Andrew and Georgies guest" FROM table_30956 WHERE "Jamie and Johns guest Dermot OLeary replaced Jamie Redknapp as team captain for one week in series 3, episode 8." = 'Phil Taylor'
wikisql
CREATE TABLE table_17288825_7 ( score VARCHAR, date VARCHAR )
What is the score for the game played on January 25?
SELECT score FROM table_17288825_7 WHERE date = "January 25"
sql_create_context
CREATE TABLE Students ( student_id INTEGER, address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), date_first_rental DATETIME, date_left_university DATETIME, other_student_details VARC...
A scatter chart shows the correlation between student_id and monthly_rental .
SELECT student_id, monthly_rental FROM Student_Addresses ORDER BY monthly_rental DESC
nvbench
CREATE TABLE table_3750 ( "District" text, "Armenian" text, "Population (2001)" real, "Area (km\u00b2)" text, "Neighborhoods" text )
What is the Armenian name of the district that is 8.37 km large?
SELECT "Armenian" FROM table_3750 WHERE "Area (km\u00b2)" = '8.37'
wikisql
CREATE TABLE papers ( paperid number, title text ) CREATE TABLE authors ( authid number, lname text, fname text ) CREATE TABLE authorship ( authid number, instid number, paperid number, authorder number ) CREATE TABLE inst ( instid number, name text, country text )
What is the name of the institution the author 'Katsuhiro Ueno' belongs to?
SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Katsuhiro" AND t1.lname = "Ueno"
spider
CREATE TABLE table_204_562 ( id number, "no." number, "date" text, "location" text, "surface" text, "opponent in final" text, "score" text )
how many matches were not played on a clay surface ?
SELECT COUNT(*) FROM table_204_562 WHERE "surface" <> 'clay'
squall
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
what is language of subject name jerry deberry?
SELECT demographic.language FROM demographic WHERE demographic.name = "Jerry Deberry"
mimicsql_data
CREATE TABLE table_name_13 ( year INTEGER, opponent VARCHAR )
Name the average year for manly-warringah sea eagles
SELECT AVG(year) FROM table_name_13 WHERE opponent = "manly-warringah sea eagles"
sql_create_context
CREATE TABLE table_name_32 ( gold VARCHAR, bronze VARCHAR, silver VARCHAR, nation VARCHAR )
How many golds have a silver greater than 1, vietnam as the nation, with a bronze less than 3?
SELECT COUNT(gold) FROM table_name_32 WHERE silver > 1 AND nation = "vietnam" AND bronze < 3
sql_create_context
CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adults INTEGER, Kids INTEGER ) CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, baseP...
What are the name of rooms booked by customers whose first name has 'ROY' in part, and count them by a pie chart
SELECT roomName, COUNT(roomName) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE FirstName LIKE '%ROY%' GROUP BY roomName
nvbench
CREATE TABLE table_name_89 ( score VARCHAR, home VARCHAR )
What was the score when the home team was Toronto?
SELECT score FROM table_name_89 WHERE home = "toronto"
sql_create_context
CREATE TABLE table_7953 ( "Type" text, "Name" text, "Title" text, "Royal house" text, "From" text )
What is the type of Leader for the Royal House of Baasha, who is named Elah.
SELECT "Type" FROM table_7953 WHERE "Royal house" = 'baasha' AND "Name" = 'elah'
wikisql
CREATE TABLE table_203_137 ( id number, "title" text, "album details" text, "peak chart positions\nus" number, "peak chart positions\nus r&b" number, "certifications" text )
what is the total number of albums can i bus has released ?
SELECT COUNT("title") FROM table_203_137
squall
CREATE TABLE table_39370 ( "Round" real, "Pick #" real, "Overall" real, "Name" text, "Position" text, "College" text )
How many Picks have a Position of kicker, and an Overall smaller than 137?
SELECT SUM("Pick #") FROM table_39370 WHERE "Position" = 'kicker' AND "Overall" < '137'
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
let me know the long title of procedure for patient kelly gallardo.
SELECT procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Kelly Gallardo"
mimicsql_data
CREATE TABLE Payments ( Payment_ID INTEGER, Settlement_ID INTEGER, Payment_Method_Code VARCHAR(255), Date_Payment_Made DATE, Amount_Payment INTEGER ) CREATE TABLE Customer_Policies ( Policy_ID INTEGER, Customer_ID INTEGER, Policy_Type_Code CHAR(15), Start_Date DATE, End_Date DAT...
What about the average amounts of payments by each method code? You can give me a bar chart.
SELECT Payment_Method_Code, AVG(Amount_Payment) FROM Payments GROUP BY Payment_Method_Code
nvbench
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...
病人年龄7岁以上的医疗记录的平均医疗费总额有多少
SELECT AVG(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc21_t_kc24.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_AGE > 7)
css
CREATE TABLE table_name_29 ( transmission VARCHAR, production VARCHAR )
What is the transmission when the production was 2002-2005?
SELECT transmission FROM table_name_29 WHERE production = "2002-2005"
sql_create_context
CREATE TABLE table_47834 ( "Round" real, "Pick" real, "Overall" real, "Name" text, "Position" text, "College" text )
Which Overall has a Name of markus koch?
SELECT SUM("Overall") FROM table_47834 WHERE "Name" = 'markus koch'
wikisql
CREATE TABLE table_8239 ( "ISLAND" text, "CITY / TOWN" text, "ICAO" text, "IATA" text, "AIRPORTNAME" text )
Which city has an ICAO of gvsf?
SELECT "CITY / TOWN" FROM table_8239 WHERE "ICAO" = 'gvsf'
wikisql
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...
Visualize a bar chart about the distribution of Date_of_Birth and Weight .
SELECT Date_of_Birth, Weight FROM people
nvbench
CREATE TABLE table_32858 ( "Year" text, "US 200" text, "UK Albums" text, "RIAA certification" text, "BPI certification" text )
15 albums were released in the UK during which year?
SELECT "Year" FROM table_32858 WHERE "UK Albums" = '15'
wikisql
CREATE TABLE table_name_75 ( team_2 VARCHAR )
What is the score for the 2nd leg when Belasica is team 2?
SELECT 2 AS nd_leg FROM table_name_75 WHERE team_2 = "belasica"
sql_create_context
CREATE TABLE table_204_603 ( id number, "pos" text, "no" number, "rider" text, "bike" text, "laps" number, "time" text, "grid" number, "points" number )
how many racers did not start ?
SELECT COUNT("rider") FROM table_204_603 WHERE "time" = 'did not start'
squall
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuo...
when was the first time until 10/2101 that patient 41816 was prescribed a medication via iv route?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 41816) AND prescriptions.route = 'iv' AND STRFTIME('%y-%m', prescriptions.startdate) <= '2101-10' ORDER BY prescriptions.startdate LIMIT 1
mimic_iii
CREATE TABLE table_25527255_2 ( captain VARCHAR, kit_manufacturer VARCHAR )
Who is the captain of the team whose kit manufacturer is Nike?
SELECT captain FROM table_25527255_2 WHERE kit_manufacturer = "Nike"
sql_create_context
CREATE TABLE table_name_68 ( week_5 VARCHAR, week_2 VARCHAR )
Who is week 5 if week 2 is Jenna Jordan?
SELECT week_5 FROM table_name_68 WHERE week_2 = "jenna jordan"
sql_create_context
CREATE TABLE table_1259 ( "Name" text, "Position" text, "Number" real, "School/Club Team" text, "Season" text, "Acquisition via" text )
Name the position for san beda
SELECT "Position" FROM table_1259 WHERE "School/Club Team" = 'San Beda'
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 ...
在02年7月13日到2009年11月4日内名叫戚雅娴的病人所有检验结果指标记录中的仪器编号以及名称分别都是啥?
SELECT jyjgzbb.YQBH, jyjgzbb.YQMC FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb...
css
CREATE TABLE table_26702204_1 ( us_viewers__million_ VARCHAR, production_code VARCHAR )
What was the u.s. viewers (millions) when the production code was 4alh19?
SELECT us_viewers__million_ FROM table_26702204_1 WHERE production_code = "4ALH19"
sql_create_context
CREATE TABLE table_27955 ( "meas. num." real, "passed" text, "YES votes" real, "NO votes" real, "% YES" text, "Const. Amd.?" text, "type" text, "description" text )
What is the percentage of yes when there were 218846 yes votes
SELECT "% YES" FROM table_27955 WHERE "YES votes" = '218846'
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 female patients have benzodiazepine-based tranquilizers causing adverse effects in therapeutic use diagnoses?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.long_title = "Benzodiazepine-based tranquilizers causing adverse effects in therapeutic use"
mimicsql_data
CREATE TABLE table_name_58 ( surface VARCHAR, date VARCHAR )
Name the surface for february 25, 1996
SELECT surface FROM table_name_58 WHERE date = "february 25, 1996"
sql_create_context
CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE paperfield ( fieldid int, pape...
Which journals did linda shapiro submit papers to ?
SELECT DISTINCT journal.journalid FROM author, journal, paper, writes WHERE author.authorname = 'linda shapiro' AND paper.journalid = journal.journalid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
scholar
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) CREATE TABLE mzjzjlb ( YLJGDM text, JZLSH text, KH text, KLX number, MJZH text, HZXM text, NLS number, NLY number, ZSEBZ number, JZZTDM number, JZZTMC text, JZJSSJ time, TXBZ number,...
在医疗就诊80645619078中给72701230这个病人做检验的科室是哪些?科室编码是什么
SELECT JYKSBM, JYKSMC FROM jybgb WHERE JZLSH = '80645619078'
css
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE icust...
calculate the number of inputs patient 18757 had.
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 = 18757))
mimic_iii
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_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE proce...
how many patients have undergone contr abd arteriogrm nec within 2 months after the previous venous cath nec this year?
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'venous cath...
mimic_iii
CREATE TABLE Transactions ( transaction_id INTEGER, investor_id INTEGER, transaction_type_code VARCHAR(10), date_of_transaction DATETIME, amount_of_transaction DECIMAL(19,4), share_count VARCHAR(40), other_details VARCHAR(255) ) CREATE TABLE Purchases ( purchase_transaction_id INTEGER, ...
For the transaction dates if share count is smaller than 10, bin the dates into the year interval, and count them using a line chart.
SELECT date_of_transaction, COUNT(date_of_transaction) FROM Transactions WHERE share_count < 10
nvbench
CREATE TABLE table_23483182_1 ( original_air_date VARCHAR, us_viewers__million_ VARCHAR )
What was the air date where there were 5.72 million viewers?
SELECT original_air_date FROM table_23483182_1 WHERE us_viewers__million_ = "5.72"
sql_create_context
CREATE TABLE manager ( Manager_ID int, Name text, Country text, Working_year_starts text, Age int, Level int ) CREATE TABLE railway ( Railway_ID int, Railway text, Builder text, Built text, Wheels text, Location text, ObjectNumber text ) CREATE TABLE railway_manage ...
A bar chart for showing the number of the countries that have managers of age above 50 or below 46, I want to rank by the total number in ascending.
SELECT Country, COUNT(Country) FROM manager WHERE Age > 50 OR Age < 46 GROUP BY Country ORDER BY COUNT(Country)
nvbench
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
what is drug code and drug route of drug name isosorbide dinitrate?
SELECT prescriptions.formulary_drug_cd, prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Isosorbide Dinitrate"
mimicsql_data
CREATE TABLE language ( language_id TINYINT UNSIGNED, name CHAR(20), last_update TIMESTAMP ) CREATE TABLE staff ( staff_id TINYINT UNSIGNED, first_name VARCHAR(45), last_name VARCHAR(45), address_id SMALLINT UNSIGNED, picture BLOB, email VARCHAR(50), store_id TINYINT UNSIGNED, ...
Find all the payment dates for the payments with an amount larger than 10 and the payments handled by a staff person with the first name Elsa, and count them by a bar chart, and list total number from low to high order.
SELECT payment_date, COUNT(payment_date) FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa' ORDER BY COUNT(payment_date)
nvbench
CREATE TABLE table_80034 ( "Country" text, "Film title used in nomination" text, "Language" text, "Original name" text, "Director" text )
Which country is the film Tent of Miracles from?
SELECT "Country" FROM table_80034 WHERE "Film title used in nomination" = 'tent of miracles'
wikisql
CREATE TABLE table_38359 ( "Year" real, "Class" text, "Team" text, "Points" real, "Rank" text, "Wins" real )
What is the earliest year associated with 0 wins and 42 points?
SELECT MIN("Year") FROM table_38359 WHERE "Wins" > '0' AND "Points" = '42'
wikisql
CREATE TABLE table_name_49 ( acquired INTEGER, design VARCHAR, name VARCHAR )
What is the average year for Wallenstein with 1a1 design?
SELECT AVG(acquired) FROM table_name_49 WHERE design = "1a1" AND name = "wallenstein"
sql_create_context
CREATE TABLE table_12525 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Results" text )
What is the first elected for Jo Bonner?
SELECT MIN("First elected") FROM table_12525 WHERE "Incumbent" = 'jo bonner'
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
what is the number of living patients diagnosed with suicide and self-inflicted poisoning by analgesics, antipyretics, and antirheumatics?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.long_title = "Suicide and self-inflicted poisoning by analgesics, antipyretics, and antirheumatics"
mimicsql_data
CREATE TABLE table_17289224_1 ( team_name VARCHAR, season VARCHAR, points VARCHAR )
Who started in 2008 with 0 points?
SELECT team_name FROM table_17289224_1 WHERE season = "2008" AND points = 0
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...
give me the number of patients whose year of death is less than or equal to 2131 and lab test name is white blood cells?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2131.0" AND lab.label = "White Blood Cells"
mimicsql_data
CREATE TABLE table_23789 ( "Tournament" text, "Also currently known as" text, "City(s)" text, "Country" text, "Court surface" text, "Tier IV in" text, "Years" real )
What is the city location of the tournament currently known as the Medibank International Sydney?
SELECT "City(s)" FROM table_23789 WHERE "Also currently known as" = 'Medibank International Sydney'
wikisql
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
患者编号为76980404的人在2001年7月25日到2018年6月20日内曾在医院就诊的次数有多少次?
SELECT (SELECT COUNT(*) 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 = '76980404' AND wdmzjzjlb.JZKSRQ BETWEEN '2001-07-25' AND '2018-06-20' UNION SELECT COUNT(*) FROM hz_info JOIN bdmzjzjlb ON hz_info.YLJGDM = bdmzjzjl...
css
CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, ...
Users by minimal reputation on (PSE, SF, SU, SO).
SELECT SFU.Id AS "user_link", CASE WHEN SOU.Reputation < SFU.Reputation AND SOU.Reputation < SUU.Reputation THEN SOU.Reputation WHEN SFU.Reputation < SUU.Reputation AND SFU.Reputation < SOU.Reputation THEN SFU.Reputation ELSE SUU.Reputation END AS minrep, * FROM stackoverflow.dbo.Users AS SOU, serverfault.dbo.Users AS ...
sede
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
患者23602060在医院9638787就诊期间门诊诊断的病名内包含后遗症的门诊就诊记录都啥啊?
SELECT * FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.RYBH = '23602060' AND hz_info.YLJGDM = '9638787' AND mzjzjlb.JZZDSM LIKE '%后遗症%'
css
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
give me the number of patients on replaced route of drug administration who are under 59 years.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "59" AND prescriptions.route = "REPLACE"
mimicsql_data
CREATE TABLE table_77215 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
Who is the player from the United States with a 75-70-68=211 score?
SELECT "Player" FROM table_77215 WHERE "Country" = 'united states' AND "Score" = '75-70-68=211'
wikisql
CREATE TABLE table_name_60 ( outcome VARCHAR, opponents_in_the_final VARCHAR, surface VARCHAR )
What was the outcome when the oppenent was serena williams venus williams and had a hard surface?
SELECT outcome FROM table_name_60 WHERE opponents_in_the_final = "serena williams venus williams" AND surface = "hard"
sql_create_context
CREATE TABLE table_name_81 ( score VARCHAR, player VARCHAR, to_par VARCHAR, money___$__ VARCHAR )
What score has a to par greater than 15, money ($) greater than 116, with billy burke as the player?
SELECT score FROM table_name_81 WHERE to_par > 15 AND money___$__ > 116 AND player = "billy burke"
sql_create_context
CREATE TABLE table_name_58 ( erp_w INTEGER, frequency_mhz VARCHAR )
Which ERP W is the lowest one that has a Frequency MHz of 91.3?
SELECT MIN(erp_w) FROM table_name_58 WHERE frequency_mhz = 91.3
sql_create_context
CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE paperdataset ( paperid int, datase...
Show me some recent papers on Machine Translation ?
SELECT DISTINCT paper.paperid, paper.year FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'Machine Translation' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid ORDER BY paper.year DESC
scholar
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 admission type is elective and primary disease is s/p hanging?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.diagnosis = "S/P HANGING"
mimicsql_data
CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDispl...
Find the 3k rep members who haven't reviewed.
SELECT U.Id AS "user_link", U.Reputation AS "rep" FROM Users AS U WHERE U.Reputation >= 3000 AND NOT EXISTS(SELECT * FROM Badges AS B WHERE B.Name = 'Custodian' AND B.UserId = U.Id) GROUP BY U.Id, U.Reputation ORDER BY U.Reputation
sede
CREATE TABLE table_name_19 ( goals_for INTEGER, played VARCHAR, lost VARCHAR, drawn VARCHAR, goals_against VARCHAR )
What are the average goals for with a drawn higher than 7 and goals against less than 86, as well as more than 11 losses and more than 42 games played?
SELECT AVG(goals_for) FROM table_name_19 WHERE drawn > 7 AND goals_against < 86 AND lost > 11 AND played > 42
sql_create_context
CREATE TABLE table_80301 ( "Year" text, "Winner" text, "Country" text, "Score" text, "Margin" text, "Runner(s)-up" text )
Who was the runner-up when the margin was 1 stroke?
SELECT "Runner(s)-up" FROM table_80301 WHERE "Margin" = '1 stroke'
wikisql
CREATE TABLE table_name_57 ( year VARCHAR )
Which year's label was label?
SELECT year FROM table_name_57 WHERE "label" = "label"
sql_create_context
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propul...
what are the classes of service for AA
SELECT DISTINCT class_of_service.booking_class FROM class_of_service, fare, fare_basis, flight, flight_fare WHERE fare_basis.booking_class = class_of_service.booking_class AND fare.fare_basis_code = fare_basis.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.airline_code = 'AA' AND flight.flight_id = f...
atis
CREATE TABLE table_42689 ( "Spoofed Title" text, "Writer" text, "Artist" text, "Issue" real, "Date" text )
Which issue was the Spoofed title Route 67 for which Mort Drucker was the artist?
SELECT SUM("Issue") FROM table_42689 WHERE "Artist" = 'mort drucker' AND "Spoofed Title" = 'route 67'
wikisql
CREATE TABLE table_66590 ( "Title" text, "Label" text, "Year of Release" real, "Country of Release" text, "Peaches:" text )
Where was the title released in 1977?
SELECT "Country of Release" FROM table_66590 WHERE "Year of Release" = '1977'
wikisql
CREATE TABLE table_name_73 ( ordered VARCHAR, name VARCHAR )
What ordered has algerine (2nd of name) as the name?
SELECT ordered FROM table_name_73 WHERE name = "algerine (2nd of name)"
sql_create_context
CREATE TABLE table_29033869_3 ( venue VARCHAR, opponent VARCHAR, position_on_ladder VARCHAR )
Which venue did collingsworth play essendon in when they had the 3rd position on the ladder?
SELECT venue FROM table_29033869_3 WHERE opponent = "Essendon" AND position_on_ladder = "3rd"
sql_create_context
CREATE TABLE table_1067134_1 ( dvd_name VARCHAR, region_2 VARCHAR )
What DVD season/name for region 2 was released August 22, 2010?
SELECT dvd_name FROM table_1067134_1 WHERE region_2 = "August 22, 2010"
sql_create_context
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
在医院6541262中就诊科室名称不包含正骨科的所有医疗就诊记录有哪些属于患者24171615?
SELECT * FROM t_kc21 WHERE PERSON_ID = '24171615' AND MED_SER_ORG_NO = '6541262' AND NOT MED_ORG_DEPT_NM LIKE '%正骨科%'
css
CREATE TABLE table_name_86 ( event VARCHAR, name VARCHAR )
In what Event did Dorcus Inzikuru compete?
SELECT event FROM table_name_86 WHERE name = "dorcus inzikuru"
sql_create_context
CREATE TABLE table_11446 ( "Date" text, "Winning Team" text, "Losing Team" text, "Score" text, "Venue" text )
Who beat the Marlins with a score of 4-0?
SELECT "Winning Team" FROM table_11446 WHERE "Losing Team" = 'marlins' AND "Score" = '4-0'
wikisql
CREATE TABLE table_204_263 ( id number, "pick" number, "player" text, "country of origin" text, "pba team" text, "college" text )
how many from the philippines ?
SELECT COUNT(*) FROM table_204_263 WHERE "country of origin" = 'philippines'
squall
CREATE TABLE jybgb_jyjgzbb ( JYZBLSH number, YLJGDM text, jyjgzbb_id number ) CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX nu...
检验报告单的编码为44927016411在住院就诊中的对应的患者是谁?
SELECT person_info.XM FROM person_info JOIN hz_info JOIN zyjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND zyjzjlb.YLJGDM = jybgb.YLJGDM_ZYJZJLB AND zyjzjlb.JZLSH = jybgb.JZLSH_ZYJZJLB WHERE jybgb.BGDH = '44927016411'
css
CREATE TABLE sampledata15 ( sample_pk number, state text, year text, month text, day text, site text, commod text, source_id text, variety text, origin text, country text, disttype text, commtype text, claim text, quantity number, growst text, packst t...
How many class of products are there?
SELECT COUNT(DISTINCT variety) FROM sampledata15
pesticide