context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_71892 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
What was the location of the match that ended before round 2, against Hikaru Sato?
SELECT "Location" FROM table_71892 WHERE "Round" < '2' AND "Opponent" = 'hikaru sato'
wikisql
CREATE TABLE table_name_57 ( silver VARCHAR, gold VARCHAR, total VARCHAR )
How many silver medals for the nation with fewer than 1 golds and total less than 1?
SELECT COUNT(silver) FROM table_name_57 WHERE gold < 1 AND total < 1
sql_create_context
CREATE TABLE table_name_35 ( date VARCHAR, opponent VARCHAR, attendance VARCHAR )
When did the Rockies play the Giants with an attendance over 24,100?
SELECT date FROM table_name_35 WHERE opponent = "giants" AND attendance > 24 OFFSET 100
sql_create_context
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 all employees who have the letters D or S in their first name, give me the comparison about the sum of manager_id over the hire_date bin hire_date by time by a bar chart.
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
nvbench
CREATE TABLE table_204_210 ( id number, "rnd" number, "circuit" text, "lmp1 winning team\nlmp1 winning drivers" text, "lmp2 winning team\nlmp2 winning drivers" text, "gt1 winning team\ngt1 winning drivers" text, "gt2 winning team\ngt2 winning drivers" text, "results" text )
how many races were there total ?
SELECT COUNT(DISTINCT "circuit") FROM table_204_210
squall
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id ...
what was the amount of cerebral drain r ventricular drain output patient 8016 had had on last month/22?
SELECT SUM(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8016)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'cere...
mimic_iii
CREATE TABLE table_78600 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Event" text, "Time" real )
What Position has a Time of 20.66?
SELECT "Position" FROM table_78600 WHERE "Time" = '20.66'
wikisql
CREATE TABLE table_26196 ( "Year" real, "Division" real, "League" text, "Regular Season" text, "Playoffs" text, "Open Cup" text )
Name the regular season for usisl d-3 pro league did not qualify
SELECT "Regular Season" FROM table_26196 WHERE "League" = 'USISL D-3 Pro League' AND "Playoffs" = 'Did not qualify'
wikisql
CREATE TABLE table_name_15 ( final_year INTEGER, notes VARCHAR )
What is the total of Final year that has a Notes of replaced by i-96?
SELECT SUM(final_year) FROM table_name_15 WHERE notes = "replaced by i-96"
sql_create_context
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE fzzmzjzjlb ( HXPLC number, HZ...
列出患者65243829所有检验报告单的审核日期在在18年7月3日到20年2月16日内是哪天?
SELECT jybgb.SHSJ FROM hz_info JOIN zzmzjzjlb JOIN jybgb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '65243829' AND jybgb.BGRQ BETWEEN '2018-07-03' AND '2020-...
css
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY...
For employees with first names that end with the letter m, give me a bar chart to show their total salary, I want to display by the bar in ascending.
SELECT FIRST_NAME, SUM(SALARY) FROM employees WHERE FIRST_NAME LIKE '%m' GROUP BY FIRST_NAME ORDER BY FIRST_NAME
nvbench
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
Create a bar chart showing maximal revenue across headquarter
SELECT Headquarter, MAX(Revenue) FROM Manufacturers GROUP BY Headquarter
nvbench
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE procedures_icd ( ...
how much difference is there in pt levels among patient 58928 last measured on the first hospital visit compared to the value first measured on the first hospital visit?
SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 58928 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label ...
mimic_iii
CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) CREATE TABLE COURSE ...
How many courses for each course description? Show me a stacked bar chart The x-axis is course description and group by office name, order from low to high by the Y-axis.
SELECT CRS_DESCRIPTION, COUNT(CRS_DESCRIPTION) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY PROF_OFFICE, CRS_DESCRIPTION ORDER BY COUNT(CRS_DESCRIPTION)
nvbench
CREATE TABLE table_45753 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text )
What is Replaced By, when Outgoing Manager is ' nal Karaman'?
SELECT "Replaced by" FROM table_45753 WHERE "Outgoing manager" = 'ünal karaman'
wikisql
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE Comments ( Id number, PostId number, ...
Approved synonyms (exclude moderators and CM).
SELECT CreationDate, SourceTagName, TargetTagName, OwnerUserId AS "user_link", ApprovedByUserId AS "user_link", Score FROM TagSynonyms WHERE NOT ApprovalDate IS NULL AND ApprovedByUserId = -1 ORDER BY SourceTagName
sede
CREATE TABLE table_26040604_1 ( dram_type VARCHAR, sm_count VARCHAR )
What was the DRAM type of an SM Count of 6?
SELECT dram_type FROM table_26040604_1 WHERE sm_count = 6
sql_create_context
CREATE TABLE table_18602462_22 ( round_of_16 VARCHAR, athlete VARCHAR )
What is the round of 16 result for Jiske Griffioen Esther Vergeer?
SELECT round_of_16 FROM table_18602462_22 WHERE athlete = "Jiske Griffioen Esther Vergeer"
sql_create_context
CREATE TABLE table_30877 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text )
Name the opponents for anabel medina garrigues
SELECT COUNT("Opponents") FROM table_30877 WHERE "Partner" = 'Anabel Medina Garrigues'
wikisql
CREATE TABLE table_name_57 ( number_of_households INTEGER, per_capita_income VARCHAR, population VARCHAR )
What is the highest Number of Households, when Per Capita Income is '$25,557', and when Population is less than '22,330'?
SELECT MAX(number_of_households) FROM table_name_57 WHERE per_capita_income = "$25,557" AND population < 22 OFFSET 330
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...
编号是89718939232的医疗就诊用的是哪个门诊号或住院号
SELECT gwyjzb.CLINIC_ID FROM gwyjzb WHERE gwyjzb.MED_CLINIC_ID = '89718939232' UNION SELECT fgwyjzb.CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.MED_CLINIC_ID = '89718939232'
css
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
look for the long title of diagnoses for diagnoses icd9 code 920.
SELECT diagnoses.long_title FROM diagnoses WHERE diagnoses.icd9_code = "920"
mimicsql_data
CREATE TABLE Documents ( document_id INTEGER, document_type_code VARCHAR(10), grant_id INTEGER, sent_date DATETIME, response_received_date DATETIME, other_details VARCHAR(255) ) CREATE TABLE Research_Outcomes ( outcome_code VARCHAR(10), outcome_description VARCHAR(255) ) CREATE TABLE P...
Plot how many date from by grouped by date from as a bar graph, and I want to list in descending by the total number.
SELECT date_from, COUNT(date_from) FROM Project_Staff ORDER BY COUNT(date_from) DESC
nvbench
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 average age of patients whose marital status is married and age is greater than or equal to 43?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.age >= "43"
mimicsql_data
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
how many patients whose diagnoses icd9 code is 81201 and drug route is ih?
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 = "81201" AND prescriptions.route = "IH"
mimicsql_data
CREATE TABLE table_19520 ( "Station Name" text, "2002\u201303" real, "2004\u201305" real, "2005\u201306" real, "2006\u201307" real, "2007\u201308" real, "2008\u201309" real, "2009\u201310" real, "2010\u201311" real, "2011\u201312" real )
How many stations in 2011-12 had volume of 11580 in 2008-09?
SELECT COUNT("2011\u201312") FROM table_19520 WHERE "2008\u201309" = '11580'
wikisql
CREATE TABLE table_43088 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Giants' points" text, "Opponents' Points" text, "Record" text, "TV Time" text, "Attendance" text )
What was the result when the opponents got 15 points?
SELECT "Result" FROM table_43088 WHERE "Opponents' Points" = '15'
wikisql
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, Last...
Evolution of the up-/downvote ratio.. Look at the Graph, to see the evolution of the upvote/downvote ratio.
SELECT CreationDate, SUM(CASE WHEN VoteTypeId = 1 THEN 1 ELSE 0 END) AS Upvotes FROM Votes GROUP BY CreationDate ORDER BY CreationDate
sede
CREATE TABLE station ( Station_ID int, Name text, Annual_entry_exit real, Annual_interchanges real, Total_Passengers real, Location text, Main_Services text, Number_of_Platforms int ) CREATE TABLE train_station ( Train_ID int, Station_ID int ) CREATE TABLE train ( Train_ID ...
Create a bar chart showing total number of number of platforms across location, and show total number in asc order.
SELECT Location, SUM(Number_of_Platforms) FROM station GROUP BY Location ORDER BY SUM(Number_of_Platforms)
nvbench
CREATE TABLE table_name_36 ( issue_price VARCHAR, mintage VARCHAR )
A mintage of 31,997 has what issue price?
SELECT issue_price FROM table_name_36 WHERE mintage = "31,997"
sql_create_context
CREATE TABLE table_203_800 ( id number, "#" number, "president" text, "president's party" text, "senate with" number, "senate opposed" number, "house with" number, "house opposed" number, "years served" number, "elections won" number )
what is the difference in senate opposed between john quincy adams and james garfield ?
SELECT ABS((SELECT "senate opposed" FROM table_203_800 WHERE "president" = 'john quincy adams') - (SELECT "senate opposed" FROM table_203_800 WHERE "president" = 'james garfield'))
squall
CREATE TABLE table_66083 ( "Frequency" text, "Call sign" text, "Branding" text, "Format" text, "Owner" text )
What is the branding for fm 88.9?
SELECT "Branding" FROM table_66083 WHERE "Frequency" = 'fm 88.9'
wikisql
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
how many patients whose primary disease is pneumonia;human immunodefiency virus;rule out tuberculosis and age is less than 62?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "PNEUMONIA;HUMAN IMMUNODEFIENCY VIRUS;RULE OUT TUBERCULOSIS" AND demographic.age < "62"
mimicsql_data
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 diagnoses ( ...
find out the procedure icd9 code for patient paul edwards.
SELECT procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Paul Edwards"
mimicsql_data
CREATE TABLE table_1341577_10 ( result VARCHAR, first_elected VARCHAR )
what's result of first elected being 1980
SELECT result FROM table_1341577_10 WHERE first_elected = 1980
sql_create_context
CREATE TABLE table_name_26 ( performer_2 VARCHAR, episode VARCHAR )
Which Performer 2 has an Episode of 5?
SELECT performer_2 FROM table_name_26 WHERE episode = 5
sql_create_context
CREATE TABLE table_19711 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Game Site" text, "Attendance" real )
How many games had the attendance of 60225?
SELECT COUNT("Result") FROM table_19711 WHERE "Attendance" = '60225'
wikisql
CREATE TABLE table_name_71 ( area VARCHAR, name VARCHAR, years VARCHAR, decile VARCHAR )
Which area has Years of 1 8, a Decile smaller than 7, and a Name of waikari school?
SELECT area FROM table_name_71 WHERE years = "1–8" AND decile < 7 AND name = "waikari school"
sql_create_context
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TA...
User List: Top N - Australia - with false positive exclusions.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, Location, LastAccessDate, UpVotes, DownVotes FROM Users WHERE (LOWER(Location) LIKE LOWER('%Australia%') OR LOWER(Location) LIKE LOWER('%##AbbreviationRight##')) AND NOT (LOWER(Location) = LOWER('Australia') OR LOWER(Location) LI...
sede
CREATE TABLE diagnoses ( 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 ) C...
give me the number of patients whose days of hospital stay is greater than 4 and lab test category is blood gas?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "4" AND lab."CATEGORY" = "Blood Gas"
mimicsql_data
CREATE TABLE table_10848177_1 ( song VARCHAR, picturization VARCHAR )
Which song has picturization by only vijay?
SELECT song FROM table_10848177_1 WHERE picturization = "Vijay"
sql_create_context
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, a...
what were the hospital hospital admission times of patient 22973 in 2102?
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 22973 AND STRFTIME('%y', admissions.admittime) = '2102'
mimic_iii
CREATE TABLE table_1432 ( "Year" text, "Event" text, "Pole position time" text, "107% time" text, "Driver" text, "Team" text, "Time" text, "% of pole" text, "Allowed to race?" text )
How many events have a time of 1:48.322?
SELECT "Event" FROM table_1432 WHERE "Time" = '1:48.322'
wikisql
CREATE TABLE table_name_27 ( erp_w INTEGER, frequency_mhz VARCHAR )
What is the least ERP W when the freguency MHz is 89.3 fm?
SELECT MIN(erp_w) FROM table_name_27 WHERE frequency_mhz = "89.3 fm"
sql_create_context
CREATE TABLE table_name_34 ( overall INTEGER, pick INTEGER )
Which average overall has a Pick smaller than 5?
SELECT AVG(overall) FROM table_name_34 WHERE pick < 5
sql_create_context
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, ...
has ns ivf ever been administered to patient 004-64091 on the current icu visit?
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 = '004-64091') AND patient.unitdischargetime IS NULL) AND intakeoutput.ce...
eicu
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE requirement ( ...
Does 399 have a project assigned to it ?
SELECT DISTINCT has_projects FROM course WHERE department = 'EECS' AND number = 399
advising
CREATE TABLE weather ( date text, max_temperature_f number, mean_temperature_f number, min_temperature_f number, max_dew_point_f number, mean_dew_point_f number, min_dew_point_f number, max_humidity number, mean_humidity number, min_humidity number, max_sea_level_pressure_inc...
How many trips stated from a station in Mountain View and ended at one in Palo Alto?
SELECT COUNT(*) FROM station AS T1 JOIN trip AS T2 JOIN station AS T3 JOIN trip AS T4 ON T1.id = T2.start_station_id AND T2.id = T4.id AND T3.id = T4.end_station_id WHERE T1.city = "Mountain View" AND T3.city = "Palo Alto"
spider
CREATE TABLE Student_Course_Enrolment ( registration_id INTEGER, student_id INTEGER, course_id INTEGER, date_of_enrolment DATETIME, date_of_completion DATETIME ) CREATE TABLE Courses ( course_id INTEGER, author_id INTEGER, subject_id INTEGER, course_name VARCHAR(120), course_des...
Find the enrollment date for all the tests that have 'Pass' result, and count them by a bar chart, and I want to display in asc by the Y.
SELECT date_of_enrolment, COUNT(date_of_enrolment) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Pass" ORDER BY COUNT(date_of_enrolment)
nvbench
CREATE TABLE table_name_66 ( year VARCHAR, result VARCHAR, series VARCHAR )
What year gave a nominated result for the room 222 series?
SELECT COUNT(year) FROM table_name_66 WHERE result = "nominated" AND series = "room 222"
sql_create_context
CREATE TABLE table_66343 ( "Rank" real, "Heat" real, "Lane" real, "Name" text, "Nationality" text, "Time" text )
Serbia has a heat less than 2 and what sum of rank?
SELECT COUNT("Rank") FROM table_66343 WHERE "Nationality" = 'serbia' AND "Heat" < '2'
wikisql
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
Give me the comparison about Team_ID over the ACC_Road , and group by attribute ACC_Home, list by the x-axis from low to high.
SELECT ACC_Road, Team_ID FROM basketball_match GROUP BY ACC_Home, ACC_Road ORDER BY ACC_Road
nvbench
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
give me the number of patients whose admission type is elective and lab test name is polys?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.label = "Polys"
mimicsql_data
CREATE TABLE product ( product_id int, product text, dimensions text, dpi real, pages_per_minute_color real, max_page_size text, interface text ) CREATE TABLE store ( Store_ID int, Store_Name text, Type text, Area_size real, Number_of_product_category real, Ranking i...
Find the name and population of districts with population between 200000 and 200000. Show a bar chart.
SELECT District_name, City_Population FROM district WHERE City_Population BETWEEN 200000 AND 2000000
nvbench
CREATE TABLE table_name_91 ( original_title VARCHAR, film_title_used_in_nomination VARCHAR )
What was the original title for the film used in nomination of street days?
SELECT original_title FROM table_name_91 WHERE film_title_used_in_nomination = "street days"
sql_create_context
CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_40...
Bar chart x axis nationality y axis how many nationality, and sort in desc by the bar.
SELECT Nationality, COUNT(Nationality) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC
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...
Get me the number of patients with bradycardia primary disease who died in or before 2131.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "BRADYCARDIA" AND demographic.dod_year <= "2131.0"
mimicsql_data
CREATE TABLE hz_info_mzjzjlb ( JZLSH number, YLJGDM number, mzjzjlb_id number ) CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, ...
查一下门诊就诊84028994033中病患的详细信息,包括身高、体重、体温、收缩压、舒张压、心率、呼吸频率、脉率
SELECT mzjzjlb.SG, mzjzjlb.TZ, mzjzjlb.TW, mzjzjlb.SSY, mzjzjlb.SZY, mzjzjlb.XL, mzjzjlb.HXPLC, mzjzjlb.ML FROM mzjzjlb WHERE mzjzjlb.JZLSH = '84028994033'
css
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
想知道患者94188667在二00四年六月十四日到二0一九年六月二十九日期间被开出谷维素片的总次数是多少
SELECT COUNT(*) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_ID = '94188667' AND t_kc22.STA_DATE BETWEEN '2004-06-14' AND '2019-06-29' AND t_kc22.SOC_SRT_DIRE_NM = '谷维素片'
css
CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, ...
on the first hospital encounter, what was the monthly maximum value of the wbc, ascites of patient 19175?
SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19175 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = '...
mimic_iii
CREATE TABLE table_10729 ( "Player" text, "Position" text, "School" text, "Hometown" text, "College" text )
What college did the player with a school of huntsville high school go to?
SELECT "College" FROM table_10729 WHERE "School" = 'huntsville high school'
wikisql
CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
在07年4月13日到11年3月11日这段时间里,参保人61225965门诊检查费用是多少?
SELECT SUM(t_kc22.AMOUNT) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_ID = '61225965' AND t_kc21.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2007-04-13' AND '2011-03-11' AND t_kc22.MED_INV_ITEM_TYPE = '检查费'
css
CREATE TABLE table_53303 ( "D 50 O" text, "D 49 \u221a" text, "D 48 \u221a" text, "D 47 \u221a" text, "D 46 \u221a" text, "D 45 \u221a" text, "D 44 \u221a" text, "D 43 \u221a" text, "D 42 \u221a" text, "D 41 \u221a" text )
Name the D 42 for when it has D 49 of r 12
SELECT "D 42 \u221a" FROM table_53303 WHERE "D 49 \u221a" = 'r 12'
wikisql
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...
哪几次医疗记录中云云亭患者开出的药品均低于4528.81块钱?排列出医疗就诊编号分别是多少?
SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_NM = '云云亭' AND NOT MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc22 WHERE AMOUNT >= 4528.81)
css
CREATE TABLE table_65743 ( "Original NFL team" text, "Player" text, "Pos." text, "College" text, "Conf." text )
What Player is from the College of memphis?
SELECT "Player" FROM table_65743 WHERE "College" = 'memphis'
wikisql
CREATE TABLE table_79953 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the largest silver with Gold larger than 4, a Nation of united states, and a Total larger than 26?
SELECT MAX("Silver") FROM table_79953 WHERE "Gold" > '4' AND "Nation" = 'united states' AND "Total" > '26'
wikisql
CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, ...
潘天蓝患者在医院0395177做过的出院诊断结果中,把出院诊断医生姓柳的诊断记录列出来
SELECT t_kc21.OUT_DIAG_DIS_CD, t_kc21.OUT_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_NM = '潘天蓝' AND t_kc21.MED_SER_ORG_NO = '0395177' AND t_kc21.OUT_DIAG_DOC_NM LIKE '柳%'
css
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, ...
Recent short questions containing multiple common typos and links needing embedding. Posts containing a body that is less than 8 chars long
SELECT TagName FROM Tags WHERE WikiPostId = 1 AND Id > 17000000 AND Id < 18000000 ORDER BY Id DESC
sede
CREATE TABLE table_name_47 ( name VARCHAR, transfer_window VARCHAR )
What is the name when winter is the transfer window?
SELECT name FROM table_name_47 WHERE transfer_window = "winter"
sql_create_context
CREATE TABLE table_34662 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
Which Constructor has a Grid of 17?
SELECT "Constructor" FROM table_34662 WHERE "Grid" = '17'
wikisql
CREATE TABLE table_name_50 ( place VARCHAR, bronze VARCHAR, silver VARCHAR, year VARCHAR )
In which Place was the Silver won by valeri postoianov ( urs ) later than 1969 and the Bronze won by alexander gazov ( urs )?
SELECT place FROM table_name_50 WHERE silver = "valeri postoianov ( urs )" AND year > 1969 AND bronze = "alexander gazov ( urs )"
sql_create_context
CREATE TABLE table_47479 ( "Track" real, "Title" text, "Songwriter(s)" text, "Producer(s)" text, "Length" text )
What is track 6's title?
SELECT "Title" FROM table_47479 WHERE "Track" = '6'
wikisql
CREATE TABLE table_44234 ( "Round" real, "Pick" real, "Player" text, "Position" text, "School/Club Team" text )
Which Pick has a Position of offensive guard, a Player of reggie mckenzie, and a Round larger than 2?
SELECT COUNT("Pick") FROM table_44234 WHERE "Position" = 'offensive guard' AND "Player" = 'reggie mckenzie' AND "Round" > '2'
wikisql
CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, star...
NATIVEAM 333 will be taught by which instructor this Fall ?
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN semester...
advising
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 who was hired before 2002-06-21, a bar chart shows the distribution of job_id and the sum of manager_id , and group by attribute job_id, and list total number of manager id in ascending order please.
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID)
nvbench
CREATE TABLE table_9872 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" text )
What is the Country of the Player with a Score of 70-72-70-73=285 and Money ( $ ) of 5,500?
SELECT "Country" FROM table_9872 WHERE "Money ( $ )" = '5,500' AND "Score" = '70-72-70-73=285'
wikisql
CREATE TABLE table_48907 ( "Episode #" real, "Title" text, "Directed by" text, "Written by" text, "Originalairdate" text )
What is Written By, when Originalairdate is 25 April 1993?
SELECT "Written by" FROM table_48907 WHERE "Originalairdate" = '25 april 1993'
wikisql
CREATE TABLE table_23637 ( "County" text, "Obama %" text, "Obama #" real, "McCain %" text, "McCain #" real, "Others %" text, "Others #" real )
What percentage of people voted for Obama in Burlington?
SELECT "Obama %" FROM table_23637 WHERE "County" = 'Burlington'
wikisql
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...
RAW answer score rankings (to match All Time rankings in Top Users).
SELECT Users.DisplayName, SUM(Answers.Score) AS "raw-3.5" FROM Posts AS Answers INNER JOIN Users ON Answers.OwnerUserId = Users.Id INNER JOIN (SELECT Posts.Id AS "id" FROM Posts WHERE PostTypeId = 1 AND NOT Tags LIKE '%rules-as-written%' AND Tags LIKE '%dnd-5e%') AS Questions ON Answers.ParentId = Questions.Id WHERE An...
sede
CREATE TABLE table_61885 ( "Tie no" text, "Home team" text, "Score 1" text, "Away team" text, "Attendance" text )
What is the Score 1 of the game with Attendance of 2,571?
SELECT "Score 1" FROM table_61885 WHERE "Attendance" = '2,571'
wikisql
CREATE TABLE table_train_262 ( "id" int, "gender" string, "hemoglobin_a1c_hba1c" float, "obesity" bool, "diabetic" string, "hba1c" float, "body_mass_index_bmi" float, "age" float, "NOUSE" float )
obese patients ( bmi greater than 35 ) .
SELECT * FROM table_train_262 WHERE obesity = 1 OR body_mass_index_bmi > 35
criteria2sql
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE lab ( labid numb...
has patient 027-140654 had any procedure on their current hospital encounter.
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-140654' AND patient.hospitaldischargetime IS NULL))
eicu
CREATE TABLE table_25470 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Who did the high rebounds in the game in which Brandon Jennings (8) did the high assists?
SELECT "High rebounds" FROM table_25470 WHERE "High assists" = 'Brandon Jennings (8)'
wikisql
CREATE TABLE table_name_28 ( Callback VARCHAR, date VARCHAR )
What was the callback date for the auditions held on July 29, 2008?
SELECT Callback AS date FROM table_name_28 WHERE date = "july 29, 2008"
sql_create_context
CREATE TABLE table_55208 ( "Year" real, "Category" text, "Character" text, "For The Show" text, "Result" text )
What is the character for 2005?
SELECT "Character" FROM table_55208 WHERE "Year" = '2005'
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...
which patients have prescription for send 500 mg vial drug?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Send 500mg Vial"
mimicsql_data
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE swimme...
Draw a bar chart of name versus meter_100, and rank by the total number in ascending.
SELECT name, meter_100 FROM swimmer ORDER BY meter_100
nvbench
CREATE TABLE table_10764 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the away teams score at Princes Park?
SELECT "Away team score" FROM table_10764 WHERE "Venue" = 'princes park'
wikisql
CREATE TABLE table_name_16 ( time VARCHAR, jockey VARCHAR, trainer VARCHAR )
What is Time, when Jockey is John Velazquez, and when Trainer is Todd A. Pletcher?
SELECT time FROM table_name_16 WHERE jockey = "john velazquez" AND trainer = "todd a. pletcher"
sql_create_context
CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ) CREATE TABLE Activity ( actid INTEGER, activity_name varchar(25) ) CREATE TABLE Faculty_Participates_in ( Fac...
Show all the ranks and the number of male and female faculty for each rank in a bar chart, I want to show in desc by the the total number .
SELECT Rank, COUNT(*) FROM Faculty GROUP BY Sex, Rank ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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 te...
医疗就诊18272921840中申请超过29份检验报告单的有哪些人?列出这些申请人工号和姓名分别是?
SELECT jybgb.SQRGH, jybgb.SQRXM FROM jybgb WHERE jybgb.JZLSH = '18272921840' GROUP BY jybgb.SQRGH HAVING COUNT(*) > 29
css
CREATE TABLE d_icd_procedures ( 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, icd9_code text, charttime time ) CREATE TABLE labevents ( row_id number, subject_id number, ...
was there any organism found in the previous year in patient 8324's first sputum test?
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8324) AND microbiologyevents.spec_type_desc = 'sputum' AND NOT microbiologyevents.org_name IS NULL AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETI...
mimic_iii
CREATE TABLE table_204_647 ( id number, "year" number, "film" text, "role" text, "language" text )
what number of films were made in telugu ?
SELECT COUNT("film") FROM table_204_647 WHERE "language" = 'telugu'
squall
CREATE TABLE table_name_16 ( gender VARCHAR, decile VARCHAR, name VARCHAR )
Which gender had a decile of more than 1 and featured the South Auckland Seventh-Day Adventist School?
SELECT gender FROM table_name_16 WHERE decile > 1 AND name = "south auckland seventh-day adventist school"
sql_create_context
CREATE TABLE table_31640 ( "Census year" real, "Total" real, "Macedonians" real, "Albanians" real, "Turks" real, "Roma" real, "Vlachs" real, "Serbs" real, "Bosniaks" real, "Other" real )
Tell me the lowest other for albanians more than 8793 and Roma less than 1030
SELECT MIN("Other") FROM table_31640 WHERE "Albanians" > '8793' AND "Roma" < '1030'
wikisql
CREATE TABLE table_25689740_2 ( w INTEGER )
What is the highest number for W?
SELECT MAX(w) FROM table_25689740_2
sql_create_context
CREATE TABLE exhibition ( Exhibition_ID int, Year int, Theme text, Artist_ID int, Ticket_Price real ) CREATE TABLE artist ( Artist_ID int, Name text, Country text, Year_Join int, Age int ) CREATE TABLE exhibition_record ( Exhibition_ID int, Date text, Attendance int...
Stacked bar of year and the number of year colored by Theme, and sort from low to high by the y-axis.
SELECT Year, COUNT(Year) FROM exhibition GROUP BY Theme ORDER BY COUNT(Year)
nvbench
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...
how many patients whose gender is f and insurance is medicare?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.insurance = "Medicare"
mimicsql_data
CREATE TABLE table_8254 ( "Channel" real, "Video" text, "Aspect" text, "PSIP Short Name" text, "Programming" text )
Name the highest Channel with an Aspect of 4:3, and a PSIP Short Name of ibc-tv?
SELECT MAX("Channel") FROM table_8254 WHERE "Aspect" = '4:3' AND "PSIP Short Name" = 'ibc-tv'
wikisql
CREATE TABLE departments ( department_id number, department_name text, manager_id number, location_id number ) CREATE TABLE locations ( location_id number, street_address text, postal_code text, city text, state_province text, country_id text ) CREATE TABLE employees ( empl...
What the full names, ids of each employee and the name of the country they are in?
SELECT T1.first_name, T1.last_name, T1.employee_id, T4.country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id JOIN countries AS T4 ON T3.country_id = T4.country_id
spider