context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_41315 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
What is the Week number with a result of l 31 28?
SELECT COUNT("Week") FROM table_41315 WHERE "Result" = 'l 31–28'
wikisql
CREATE TABLE table_2784232_1 ( approximate_translation VARCHAR, morphological_category VARCHAR )
What are the approximate translations when the morphological category is masc. sing. active participle?
SELECT approximate_translation FROM table_2784232_1 WHERE morphological_category = "masc. sing. active participle"
sql_create_context
CREATE TABLE zyb ( CLINIC_ID text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, IN...
看看在医疗机构1539337的记录里,这位窦霞月的患者在06年6月24日到13年2月13日期间接受了多少次检查
SELECT COUNT(*) FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_NM = '窦霞月' AND t_kc22.STA_DATE BETWEEN '2006-06-24' AND '2013-02-13' AND qtb.MED_SER_ORG_NO = '1539337' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' UNION SELECT COUNT(*) FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLIN...
css
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 decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25...
Please show me how many employees working on different countries using a pie chart.
SELECT COUNTRY_NAME, COUNT(COUNTRY_NAME) FROM countries GROUP BY COUNTRY_NAME
nvbench
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 jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city var...
Which classes will the next 6 semesters have ?
SELECT DISTINCT course.name, course.number, semester.semester, semester.year FROM course, course_offering, semester WHERE ((semester.semester = 'FA' AND semester.year = 2016) OR (semester.semester = 'FA' AND semester.year = 2017) OR (semester.semester = 'FA' AND semester.year = 2018) OR (semester.semester = 'WN' AND se...
advising
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
What section after 10:45 A.M. is in PSYCH 513 ?
SELECT DISTINCT course_offering.end_time, course_offering.section_number, course_offering.start_time FROM course, course_offering, semester WHERE course_offering.start_time > '10:45' AND course.course_id = course_offering.course_id AND course.department = 'PSYCH' AND course.number = 513 AND semester.semester = 'WN' AND...
advising
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 jybgb ( BBCJBW text, BBDM tex...
医疗机构4226388的就诊记录里,住院天数超过30天的有多少人数
SELECT COUNT(hz_info.RYBH) FROM hz_info JOIN zyjzjlb JOIN hz_info_zyjzjlb ON hz_info.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND hz_info_zyjzjlb.JZLSH = zyjzjlb.JZLSH AND hz_info_zyjzjlb.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info_zyjzjlb.JZLSH = zyjzjlb.JZLSH AND hz_in...
css
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 patients whose ethnicity is white and diagnoses icd9 code is 56210?
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 = "56210"
mimicsql_data
CREATE TABLE table_65202 ( "Rank" real, "Heat" real, "Lane" real, "Name" text, "Nationality" text, "Time" text )
What is Anna Khlistunova's Nationality?
SELECT "Nationality" FROM table_65202 WHERE "Name" = 'anna khlistunova'
wikisql
CREATE TABLE table_name_17 ( date VARCHAR, tournament VARCHAR )
When has a Tournament of palermo , italy?
SELECT date FROM table_name_17 WHERE tournament = "palermo , italy"
sql_create_context
CREATE TABLE table_79604 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text )
Which home team had the away team Southport?
SELECT "Home team" FROM table_79604 WHERE "Away team" = 'southport'
wikisql
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions...
what is the number of discharged patients at disc-tran cancer/chldrn h with procedure icd9 code 8841?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "DISC-TRAN CANCER/CHLDRN H" AND procedures.icd9_code = "8841"
mimicsql_data
CREATE TABLE table_41667 ( "Date" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real )
What was the date of the game held at the A venue with a result of 0-1 against the Rangers?
SELECT "Date" FROM table_41667 WHERE "Venue" = 'a' AND "Result" = '0-1' AND "Opponent" = 'rangers'
wikisql
CREATE TABLE table_name_12 ( nationality VARCHAR, name VARCHAR )
What nationality is Erin Donohue?
SELECT nationality FROM table_name_12 WHERE name = "erin donohue"
sql_create_context
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
Show me about the distribution of ACC_Road and the sum of Team_ID , and group by attribute ACC_Road in a bar chart, show from low to high by the Y.
SELECT ACC_Road, SUM(Team_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY SUM(Team_ID)
nvbench
CREATE TABLE table_51135 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is Score, when To Par is 'E'?
SELECT "Score" FROM table_51135 WHERE "To par" = 'e'
wikisql
CREATE TABLE table_39015 ( "Start month" text, "End month" text, "Cover" text, "Spine" text, "Indicia" text, "Masthead" text, "Number of issues" real )
What is the Spine that has fantastic stories science fiction & fantasy with and end month in aug-72?
SELECT "Spine" FROM table_39015 WHERE "Indicia" = 'fantastic' AND "Cover" = 'fantastic stories science fiction & fantasy' AND "End month" = 'aug-72'
wikisql
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
For those employees who did not have any job in the past, return a scatter chart about the correlation between salary and manager_id .
SELECT SALARY, MANAGER_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
nvbench
CREATE TABLE gwyjzb ( 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, ...
医疗机构1195150的患者对医疗项目自付比例的平均值在2003年2月4日到2004年12月30日内都是多少?
SELECT AVG(t_kc22.SELF_PAY_PRO) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.MED_SER_ORG_NO = '1195150' AND t_kc22.STA_DATE BETWEEN '2003-02-04' AND '2004-12-30' UNION SELECT AVG(t_kc22.SELF_PAY_PRO) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE fg...
css
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,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 decimal(6,0), MAX_SALARY decimal(6,...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, a scatter chart shows the correlation between salary and commission_pct .
SELECT SALARY, COMMISSION_PCT FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
nvbench
CREATE TABLE Students ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40) ) CREATE TABLE Student_Tests_Taken ( registration_id IN...
What are the number of the dates of the latest logon of the students with family name 'Jaskolski' or 'Langosh'?
SELECT date_of_latest_logon, COUNT(date_of_latest_logon) FROM Students WHERE family_name = "Jaskolski" OR family_name = "Langosh"
nvbench
CREATE TABLE table_2182654_6 ( original_air_date VARCHAR, no_in_season VARCHAR )
What date was episode 10 in the season originally aired?
SELECT original_air_date FROM table_2182654_6 WHERE no_in_season = 10
sql_create_context
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...
在2019-07-16之前,患者任斯伯有哪些住院就诊的检验报告单?看一下住院就诊的流水号
SELECT zyjzjlb.JZLSH FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE hz_info.person_info_XM = '任斯伯' AND NOT zyjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ >= '2019-07-16')
css
CREATE TABLE table_name_67 ( t__µm_ VARCHAR, technology VARCHAR )
What is the total number of t ( m), when Technology is u c-si?
SELECT COUNT(t__µm_) FROM table_name_67 WHERE technology = "u c-si"
sql_create_context
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, ...
is the phosphate value of patient 027-165214 last measured on the current hospital visit greater than the value of the patient first measured on the current hospital visit?
SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-165214' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'phos...
eicu
CREATE TABLE table_1543845_63 ( stolen_ends VARCHAR, locale VARCHAR, Sweden VARCHAR )
How many stolen ends were there when the locale was Sweden?
SELECT stolen_ends FROM table_1543845_63 WHERE locale = Sweden
sql_create_context
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...
count the number of patients whose primary disease is aortic valve insuffiency\aortic valve replacement /sda and year of birth is less than 2049?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" AND demographic.dob_year < "2049"
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...
what is the number of patients who have diagnoses icd9 code 2875?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.icd9_code = "2875"
mimicsql_data
CREATE TABLE table_24706337_1 ( ottoman_sultan VARCHAR, treaty_at_the_end_of_the_war VARCHAR )
Who was the Ottoman Sultan where the treaty at the end of the war was the Treaty of Constantinople (1590)?
SELECT ottoman_sultan FROM table_24706337_1 WHERE treaty_at_the_end_of_the_war = "Treaty of Constantinople (1590)"
sql_create_context
CREATE TABLE table_6670 ( "Mission" text, "Resident Country" text, "Local Location" text, "Local Mission" text, "Local Position" text )
What is the local mission that has kingstown as a local location?
SELECT "Local Mission" FROM table_6670 WHERE "Local Location" = 'kingstown'
wikisql
CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as ...
How many years has RUSSIAN 316 been available ?
SELECT DISTINCT semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'RUSSIAN' AND course.number = 316 AND semester.semester_id = course_offering.semester ORDER BY semester.year LIMIT 1
advising
CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE PROFESSOR ( EMP_N...
How many courses each teacher taught? Show me a stacked bar chart. The x-axis is the teacher's first name and group by course description.
SELECT EMP_FNAME, COUNT(EMP_FNAME) 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 GROUP BY CRS_DESCRIPTION, EMP_FNAME
nvbench
CREATE TABLE table_name_12 ( route INTEGER, elevation VARCHAR )
Elevation of 12,183 feet 3713 m is what average route?
SELECT AVG(route) FROM table_name_12 WHERE elevation = "12,183 feet 3713 m"
sql_create_context
CREATE TABLE table_name_12 ( date VARCHAR, winner VARCHAR )
What date did Lanny Wadkins (6) win?
SELECT date FROM table_name_12 WHERE winner = "lanny wadkins (6)"
sql_create_context
CREATE TABLE table_62532 ( "Name / Generation" text, "Model" text, "Frequency [MHz]" text, "Architecture version" text, "Cores" text, "Process [nm]" text )
What is the name of the architecture version of the MIPS-III 64-bit, and model 2b?
SELECT "Name / Generation" FROM table_62532 WHERE "Architecture version" = 'mips-iii 64-bit' AND "Model" = '2b'
wikisql
CREATE TABLE table_name_57 ( maximum_diameter VARCHAR, name__year_commissioned_ VARCHAR )
What is the maximum diameter of the Mid West Gas Pipeline (1999)?
SELECT maximum_diameter FROM table_name_57 WHERE name__year_commissioned_ = "mid west gas pipeline (1999)"
sql_create_context
CREATE TABLE table_name_29 ( town VARCHAR, structural_type VARCHAR, country VARCHAR )
Which Town has a Structural type of guyed mast and a Country of belgium?
SELECT town FROM table_name_29 WHERE structural_type = "guyed mast" AND country = "belgium"
sql_create_context
CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int ) CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text )
What is the total number of ships with different nationalities and ship types?, and sort X in desc order please.
SELECT Nationality, COUNT(Nationality) FROM ship GROUP BY Type, Nationality ORDER BY Nationality DESC
nvbench
CREATE TABLE table_61945 ( "English name" text, "Thai name" text, "Transcription" text, "Color" text, "Sanskrit word" text, "Planet" text )
Which Planet has a Sanskrit word of budha?
SELECT "Planet" FROM table_61945 WHERE "Sanskrit word" = 'budha'
wikisql
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )...
is the value of the heartrate of patient 006-2586 last measured on the first icu visit less than first measured on the first icu visit?
SELECT (SELECT vitalperiodic.heartrate FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-2586') AND NOT patient.unitdischargetime IS N...
eicu
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 average age of male for different job title. Visualize by bar chart.
SELECT job, AVG(age) FROM Person WHERE gender = 'male' GROUP BY job
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...
从03年5月9日到08年7月26日,医院5071294一共有多少住院医疗记录
SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '5071294' AND t_kc21.IN_HOSP_DATE BETWEEN '2003-05-09' AND '2008-07-26' AND t_kc21.CLINIC_TYPE = '住院'
css
CREATE TABLE table_18464 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
Name the number of party with the incubent james william trimble
SELECT COUNT("Party") FROM table_18464 WHERE "Incumbent" = 'James William Trimble'
wikisql
CREATE TABLE table_64319 ( "Rider" text, "Bike" text, "Laps" real, "Time" text, "Grid" real )
What bike has a grid greater than 17, laps less than 8, with milos cihak as the rider?
SELECT "Bike" FROM table_64319 WHERE "Grid" > '17' AND "Laps" < '8' AND "Rider" = 'milos cihak'
wikisql
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time,...
how much is the other craniectomy cost?
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'procedures_icd' AND cost.event_id IN (SELECT procedures_icd.row_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'other craniectomy'))
mimic_iii
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
how many patients of white ethnicity had drug type as additive?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE" AND prescriptions.drug_type = "ADDITIVE"
mimicsql_data
CREATE TABLE table_62191 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What is the home team when the Tie no is 1?
SELECT "Home team" FROM table_62191 WHERE "Tie no" = '1'
wikisql
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE compartment_cla...
what flights go from BOSTON to PITTSBURGH after 1205 in the afternoon
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.departure_time > 1205 AND flight.to_airport = AIRPORT_SERVICE_1.ai...
atis
CREATE TABLE table_40693 ( "Region" text, "Host" text, "Venue" text, "City" text, "State" text )
The University of Colorado hosted what region?
SELECT "Region" FROM table_40693 WHERE "Host" = 'university of colorado'
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...
Count the number of patients whose diagnosis short title is surg compl-body syst nec and procedure short title is tonsil and adenoid biopsy.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE diagnoses.short_title = "Surg compl-body syst NEC" AND procedures.short_title = "Tonsil&adenoid biopsy"
mimicsql_data
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 PostsWithDeleted ( Id number, PostTypeId number, ...
Top 100 Answers for a User.
SELECT Other.Title AS "Question Title", Other.Body AS "Question Body", Answers.Body AS "Answer" FROM Posts AS Answers INNER JOIN Posts AS Other ON Answers.ParentId = Other.Id WHERE Answers.OwnerUserId = @UserId AND Answers.ParentId != 0 ORDER BY Answers.Score DESC LIMIT 100
sede
CREATE TABLE table_69214 ( "Rank (CSA)" text, "State(s)" text, "2007 Estimate" text, "2000 Population" text, "Percent Change (1990\u20132000)" text )
What is the 1990-2000 percent change of a result that is estimated to be 45,393 in 2007?
SELECT "Percent Change (1990\u20132000)" FROM table_69214 WHERE "2007 Estimate" = '45,393'
wikisql
CREATE TABLE table_name_64 ( drawn INTEGER, difference VARCHAR, points VARCHAR )
What is the average number of drawn with a difference of 17 and 22 points?
SELECT AVG(drawn) FROM table_name_64 WHERE difference = "17" AND points = 22
sql_create_context
CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varcha...
AA from DENVER to MILWAUKEE
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 = 'MILWAUKEE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DEN...
atis
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...
how many patients whose diagnoses long title is unspecified gastritis and gastroduodenitis, without mention of hemorrhage and drug type is base?
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.long_title = "Unspecified gastritis and gastroduodenitis, without mention of hemorrhage" AND prescription...
mimicsql_data
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE l...
what is the daily minimum amount of output (ml)-external urethral device that patient 002-41152 had last month?
SELECT MIN(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-41152')) AND intakeoutput.celllabel = 'outpu...
eicu
CREATE TABLE table_27312 ( "Region" text, "Preschool (0\u20135 years)" text, "Primary (6\u201313 years)" text, "Secondary (14\u201317 years)" text, "Tertiary (18\u201324 years)" text )
In what region is the enrollment ratio in primary 94.40?
SELECT "Region" FROM table_27312 WHERE "Primary (6\u201313 years)" = '94.40'
wikisql
CREATE TABLE table_46249 ( "Date" text, "Home team" text, "Score" text, "Away team" text, "Venue" text, "Crowd" real, "Box Score" text, "Report" text )
Name the Report of 7 february with an Away team of new zealand breakers?
SELECT "Report" FROM table_46249 WHERE "Date" = '7 february' AND "Away team" = 'new zealand breakers'
wikisql
CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE flight_far...
what is the price of a one way fare from BOSTON to DENVER on CO
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 = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city...
atis
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREA...
since 1 year ago, what were the admission times of patient 006-172277 at the hospital?
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '006-172277' AND DATETIME(patient.hospitaladmittime) >= DATETIME(CURRENT_TIME(), '-1 year')
eicu
CREATE TABLE table_name_43 ( team VARCHAR, rank VARCHAR )
Which team has a rank of 6?
SELECT team FROM table_name_43 WHERE rank = 6
sql_create_context
CREATE TABLE table_57735 ( "Game" real, "Date" text, "Location" text, "Time" text, "Attendance" real )
Where Date is october 14 what is the attendance?
SELECT "Attendance" FROM table_57735 WHERE "Date" = 'october 14'
wikisql
CREATE TABLE table_1940012_2 ( winning_score VARCHAR, runner_s__up VARCHAR )
What was the winning score in the tournament, ending with Birdie Kim as a runner-up?
SELECT winning_score FROM table_1940012_2 WHERE runner_s__up = "Birdie Kim"
sql_create_context
CREATE TABLE table_12886178_5 ( try_bonus VARCHAR, tries_against VARCHAR )
How many clubs have a tries against count of 41?
SELECT COUNT(try_bonus) FROM table_12886178_5 WHERE tries_against = "41"
sql_create_context
CREATE TABLE shop ( Shop_ID int, Address text, Num_of_staff text, Score real, Open_Year text ) CREATE TABLE happy_hour ( HH_ID int, Shop_ID int, Month text, Num_of_shaff_in_charge int ) CREATE TABLE member ( Member_ID int, Name text, Membership_card text, Age int, ...
A bar chart showing the average purchase time for each coffee shop address.
SELECT Address, AVG(Time_of_purchase) FROM member GROUP BY Address ORDER BY Time_of_purchase
nvbench
CREATE TABLE table_204_336 ( id number, "operators" text, "named trains" text, "destination" text, "year begun" text, "year discontinued" number )
how many trains were discontinued in 1958 ?
SELECT COUNT("named trains") FROM table_204_336 WHERE "year discontinued" = 1958
squall
CREATE TABLE table_62915 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
What is the Result of the game on November 6, 1966?
SELECT "Result" FROM table_62915 WHERE "Date" = 'november 6, 1966'
wikisql
CREATE TABLE table_60416 ( "Knight" text, "Weapon/item" text, "External weapon" text, "Shield animal" text, "Cart" text )
What is the external weapon of knight zeke?
SELECT "External weapon" FROM table_60416 WHERE "Knight" = 'zeke'
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...
provide the number of patients whose diagnoses long title is hypoxemia and drug route is iv?
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.long_title = "Hypoxemia" AND prescriptions.route = "IV"
mimicsql_data
CREATE TABLE table_17061 ( "Player" text, "Position" text, "School" text, "Hometown" text, "MLB Draft" text )
The catcher went to what school?
SELECT "School" FROM table_17061 WHERE "Position" = 'Catcher'
wikisql
CREATE TABLE table_22186 ( "Year" real, "Car number" real, "Start" real, "Qual. speed" text, "Speed rank" real, "Finish" real, "Laps completed" real, "Laps led" real, "Race status" text, "Chassis" text )
What year(s) was the race status piston?
SELECT "Year" FROM table_22186 WHERE "Race status" = 'Piston'
wikisql
CREATE TABLE table_4054 ( "Executed person" text, "Date of execution" text, "Place of execution" text, "Crime" text, "Method" text, "Under President" text )
who was executed during president charles de gaulle's reign for thr crime of child murder after rape?
SELECT "Executed person" FROM table_4054 WHERE "Under President" = 'Charles de Gaulle' AND "Crime" = 'Child murder after rape'
wikisql
CREATE TABLE table_test_3 ( "id" int, "gender" string, "pregnancy_or_lactation" bool, "severe_hemodynamic_instability" bool, "consent" bool, "hemoglobin_a1c_hba1c" float, "metallic_implants" bool, "allergy_to_aspirin" bool, "creatinine_clearance_cl" float, "post_menopausal" bool,...
pregnancy , lactation or plan to be pregnant.
SELECT * FROM table_test_3 WHERE pregnancy_or_lactation = 1 OR pregnancy_or_lactation = 1
criteria2sql
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 less than 58 years who were discharged home?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "HOME" AND demographic.age < "58"
mimicsql_data
CREATE TABLE table_78683 ( "Tournament" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text )
What is 2010, when 2009 is '1'?
SELECT "2010" FROM table_78683 WHERE "2009" = '1'
wikisql
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE patient ( ...
until 2103, what were the three most frequently prescribed drugs for patients 50s?
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 50 AND 59) AND STRFTIME('%y', medication.drugstarttime) <= '2103' GROUP BY medication.drugn...
eicu
CREATE TABLE table_62668 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
Which golfer had a score of 69-71=140?
SELECT "Player" FROM table_62668 WHERE "Score" = '69-71=140'
wikisql
CREATE TABLE table_76903 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Record" text )
What date is the record 4-3-0?
SELECT "Date" FROM table_76903 WHERE "Record" = '4-3-0'
wikisql
CREATE TABLE table_name_72 ( score VARCHAR, date VARCHAR )
What was the final score for the game on May 1?
SELECT score FROM table_name_72 WHERE date = "may 1"
sql_create_context
CREATE TABLE table_38088 ( "Week" real, "Date" text, "Opponent" text, "Location" text, "Time ( ET )" text, "Result" text, "Record" text )
Which Result has a Record of 5 4?
SELECT "Result" FROM table_38088 WHERE "Record" = '5–4'
wikisql
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 ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
look for the birthdate and gender of kelly gallardo.
SELECT demographic.dob, demographic.gender FROM demographic WHERE demographic.name = "Kelly Gallardo"
mimicsql_data
CREATE TABLE table_13657883_2 ( to_winning_team VARCHAR, tu_winning_team VARCHAR )
What was the to winnning team when the tu winning team was #16 2002?
SELECT to_winning_team FROM table_13657883_2 WHERE tu_winning_team = "#16 2002"
sql_create_context
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) CREATE TABLE food_service ( meal_...
no i want to go from DENVER to OAKLAND
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 = 'OAKLAND...
atis
CREATE TABLE table_name_70 ( total VARCHAR, rank_by_average VARCHAR, place VARCHAR )
What is the total with a 74 rank by average for 8th place?
SELECT total FROM table_name_70 WHERE rank_by_average = "74" AND place = "8th"
sql_create_context
CREATE TABLE race ( Race_ID int, Name text, Class text, Date text, Track_ID text ) CREATE TABLE track ( Track_ID int, Name text, Location text, Seating real, Year_Opened real )
Create a bar chart showing how many class across class, could you order Y-axis in desc order?
SELECT Class, COUNT(Class) FROM race GROUP BY Class ORDER BY COUNT(Class) DESC
nvbench
CREATE TABLE table_name_17 ( points VARCHAR, goals_for VARCHAR, draws VARCHAR, wins VARCHAR )
What is Points, when Draws is less than 7, when Wins is less than 16, and when Goals For is '35'?
SELECT points FROM table_name_17 WHERE draws < 7 AND wins < 16 AND goals_for = 35
sql_create_context
CREATE TABLE table_name_42 ( year INTEGER, owner VARCHAR )
What year was owner Michael E. Pegram's last win?
SELECT MAX(year) FROM table_name_42 WHERE owner = "michael e. pegram"
sql_create_context
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
how many products are there for each manufacturer?
SELECT T2.Name, COUNT(*) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name
nvbench
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, Crea...
Top 150 users from Bangladesh.
SELECT Id, DisplayName, Reputation, WebsiteUrl, Location FROM Users WHERE Location LIKE '%Bangladesh%' ORDER BY Reputation DESC LIMIT 150
sede
CREATE TABLE table_name_78 ( leading_scorer VARCHAR, date VARCHAR )
Who was the leading scorer on 23 February 2008?
SELECT leading_scorer FROM table_name_78 WHERE date = "23 february 2008"
sql_create_context
CREATE TABLE table_name_61 ( year VARCHAR, color_commentator_s_ VARCHAR )
For how many years combined were Frank Gifford and Dan Dierdorf color commentators?
SELECT COUNT(year) FROM table_name_61 WHERE color_commentator_s_ = "frank gifford and dan dierdorf"
sql_create_context
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, ...
Users with highest average answer score.
SELECT Posts.OwnerUserId AS UserId, AVG(1.0 * Posts.Score) AS AverageScore FROM Posts WHERE Posts.PostTypeId = 2 AND NOT Posts.OwnerUserId IS NULL GROUP BY Posts.OwnerUserId ORDER BY AverageScore DESC LIMIT 20
sede
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
Who 's the professor for next semester 's UC 176 ?
SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN course_offering ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN course ON course.course_id = course_offering.course_id INNER JOIN semester...
advising
CREATE TABLE table_68424 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
Which Score has an Attendance larger than 13,175 and a Record of 18-16?
SELECT "Score" FROM table_68424 WHERE "Attendance" > '13,175' AND "Record" = '18-16'
wikisql
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal bool...
What are my highest rated comments?. What are my 25 comments for which I got the highest score, and their respective post IDs.
SELECT PostId AS "post_link", 'text', Score FROM Comments WHERE UserId = @UserId ORDER BY Score DESC LIMIT 100
sede
CREATE TABLE table_12134383_1 ( end_of_term VARCHAR, age_at_inauguration VARCHAR )
how many end of term with age at inauguration being 64-066 64years, 66days
SELECT COUNT(end_of_term) FROM table_12134383_1 WHERE age_at_inauguration = "64-066 64years, 66days"
sql_create_context
CREATE TABLE table_name_1 ( points VARCHAR, artist VARCHAR )
How many points does mia martini have?
SELECT COUNT(points) FROM table_name_1 WHERE artist = "mia martini"
sql_create_context
CREATE TABLE table_name_24 ( position VARCHAR, competition VARCHAR, venue VARCHAR )
What Position was achieved in the World Championships Competition in Tokyo, Japan?
SELECT position FROM table_name_24 WHERE competition = "world championships" AND venue = "tokyo, japan"
sql_create_context
CREATE TABLE table_name_97 ( date VARCHAR, away_team VARCHAR )
If the Away team was carlton, what Date did they play?
SELECT date FROM table_name_97 WHERE away_team = "carlton"
sql_create_context
CREATE TABLE table_63445 ( "Locks & Dam" text, "Location [L ]" text, "River Mile" real, "Lock Side" text, "Lock Lift/Drop (in feet)" text, "Pool Length (miles)" text )
What is the total of the River Mile in Greenup, Kentucky?
SELECT SUM("River Mile") FROM table_63445 WHERE "Location [L ]" = 'greenup, kentucky'
wikisql