context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE course_offering ( offering_id int, course_id int, semes...
What is the schedule of 564 next semester ?
SELECT DISTINCT course_offering.end_time, course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.start_time, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM course, course_offering, semester WHERE course.course_id = course_offe...
advising
CREATE TABLE table_name_14 ( driver VARCHAR, chassis___engine VARCHAR )
Who is the driver of the chassis-engine porsche 956 gti?
SELECT driver FROM table_name_14 WHERE chassis___engine = "porsche 956 gti"
sql_create_context
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 minimum age of patients whose insurance is government and days of hospital stay is 2?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.insurance = "Government" AND demographic.days_stay = "2"
mimicsql_data
CREATE TABLE table_name_35 ( strain VARCHAR, genes VARCHAR )
Which species of bacteria has 5,566 genes?
SELECT strain FROM table_name_35 WHERE genes = "5,566"
sql_create_context
CREATE TABLE table_204_358 ( id number, "species" text, "common name" text, "ncbi accession #" text, "ncbi name" text, "length" text, "sequence identity" text, "sequence similarity" text, "years since divergence from human (mya)" number )
whats the percentage of difference between the frog and zebra fish ?
SELECT (SELECT "sequence identity" FROM table_204_358 WHERE "common name" = 'frog') - (SELECT "sequence identity" FROM table_204_358 WHERE "common name" = 'zebra fish')
squall
CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE program ( program_id int, name varchar, college varc...
What is the prerequisite for THTREMUS 342 ?
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT...
advising
CREATE TABLE table_204_107 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
nation that earned the most total medals after spain
SELECT "nation" FROM table_204_107 WHERE "total" < (SELECT "total" FROM table_204_107 WHERE "nation" = 'spain') ORDER BY "total" DESC LIMIT 1
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
provide the number of catholic religious background patients for whom absolute cd3 count lab test was ordered.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "CATHOLIC" AND lab.label = "Absolute CD3 Count"
mimicsql_data
CREATE TABLE table_73122 ( "Group 7" text, "Group 8" text, "Group 9" text, "Group 10" text, "Group 11" text, "Group 12" text )
Who played in group 12 when Group 9 played psid jombang?
SELECT "Group 12" FROM table_73122 WHERE "Group 9" = 'PSID Jombang'
wikisql
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
患者24804917曾在医院就诊从2006年6月9日开始直到2010年8月30日结束次数有多少次?
SELECT (SELECT COUNT(*) FROM hz_info JOIN mzjzjlb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND person_info_hz_info.KH = hz_info.KH AND person_info_hz_info.KLX = hz_info.KLX AND person_info_hz_info.YLJGDM = hz_info.YLJGDM AND p...
css
CREATE TABLE table_20617 ( "#" real, "Series Sorted" text, "Title" text, "Author" text, "Doctor" text, "Featuring" text, "Released" text )
Name the author for peri and april 2010
SELECT "Author" FROM table_20617 WHERE "Featuring" = 'Peri' AND "Released" = 'April 2010'
wikisql
CREATE TABLE Ref_Address_Types ( address_type_code VARCHAR(15), address_type_description VARCHAR(80) ) CREATE TABLE Ref_Detention_Type ( detention_type_code VARCHAR(10), detention_type_description VARCHAR(80) ) CREATE TABLE Students ( student_id INTEGER, address_id INTEGER, first_name VARC...
Give me the trend about monthly_rental over date_address_from .
SELECT date_address_from, monthly_rental FROM Student_Addresses ORDER BY monthly_rental DESC
nvbench
CREATE TABLE table_203_239 ( id number, "year" number, "title" text, "chinese title" text, "role" text, "notes" text )
after never say goodbye , what was the title of the next movie she was in chronologically ?
SELECT "title" FROM table_203_239 WHERE id = (SELECT id FROM table_203_239 WHERE "title" = 'never say goodbye') + 1
squall
CREATE TABLE table_name_69 ( resting_potential__mv_ VARCHAR, ap_duration__ms_ VARCHAR, cell_type VARCHAR )
What was the resting potential with an AP duration of 1.0 and a median giant fiber cell type?
SELECT resting_potential__mv_ FROM table_name_69 WHERE ap_duration__ms_ = "1.0" AND cell_type = "median giant fiber"
sql_create_context
CREATE TABLE table_36254 ( "Date" text, "State" text, "George H.W. Bush" text, "Bob Dole" text, "Pat Robertson" text, "Jack Kemp" text, "Pete du Pont" text )
At what percent was Pat Robertson when George H.W. Bush had 76%?
SELECT "Pat Robertson" FROM table_36254 WHERE "George H.W. Bush" = '76%'
wikisql
CREATE TABLE table_name_30 ( father VARCHAR, date_of_birth VARCHAR )
Who is the father that was born on January 2, 1842?
SELECT father FROM table_name_30 WHERE date_of_birth = "january 2, 1842"
sql_create_context
CREATE TABLE table_44266 ( "Date" text, "Home team" text, "Score" text, "Away team" text, "Venue" text, "Box Score" text, "Report" text )
What was the report for the game with the home team of the Townsville Crocodiles?
SELECT "Report" FROM table_44266 WHERE "Home team" = 'townsville crocodiles'
wikisql
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...
how many hours have passed since the last time that patient 14467 has had an d5w intake on the current intensive care unit visit?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', inputevents_cv.charttime)) 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 = 14467) AND icustays.outtime IS NULL)...
mimic_iii
CREATE TABLE table_name_8 ( result VARCHAR, location VARCHAR, year VARCHAR )
Tell me the result for warsaw 1929
SELECT result FROM table_name_8 WHERE location = "warsaw" AND year = 1929
sql_create_context
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) 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 swimme...
A bar chart shows the distribution of meter_500 and ID .
SELECT meter_500, ID FROM swimmer
nvbench
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id ...
when was the first time patient 32163 had a microbiology test, since 79 months ago?
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 32163) AND DATETIME(microbiologyevents.charttime) >= DATETIME(CURRENT_TIME(), '-79 month') ORDER BY microbiologyevents.charttime LIMIT 1
mimic_iii
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
provide the number of patients whose admission year is less than 2175 and diagnoses long title is diverticulosis of colon with hemorrhage?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2175" AND diagnoses.long_title = "Diverticulosis of colon with hemorrhage"
mimicsql_data
CREATE TABLE table_name_94 ( earnings___ VARCHAR, events VARCHAR, wins VARCHAR )
What is the total number of earnings for golfers who have 28 events and more than 2 wins?
SELECT COUNT(earnings___) AS $__ FROM table_name_94 WHERE events = 28 AND wins > 2
sql_create_context
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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,...
For all employees who have the letters D or S in their first name, find job_id and the average of manager_id , and group by attribute job_id, and visualize them by a bar chart, I want to list in desc by the y axis.
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(MANAGER_ID) DESC
nvbench
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, ...
which patients have order for nonsquamous epithelial cell lab test?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "NonSquamous Epithelial Cell"
mimicsql_data
CREATE TABLE table_18135 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Results" text, "Candidates" text )
What year was the first election in the district whose election now was won by Ron Kind?
SELECT MIN("First elected") FROM table_18135 WHERE "Incumbent" = 'Ron Kind'
wikisql
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...
来医院2171159就诊的医疗记录中显示入院时诊断为D38.070的最低和最高医疗费用总额是多少?
SELECT MIN(t_kc24.MED_AMOUT), MAX(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT qtb.MED_CLINIC_ID FROM qtb WHERE qtb.MED_SER_ORG_NO = '2171159' AND qtb.IN_DIAG_DIS_CD = 'D38.070' UNION SELECT gyb.MED_CLINIC_ID FROM gyb WHERE gyb.MED_SER_ORG_NO = '2171159' AND gyb.IN_DIAG_DIS_CD = 'D38.070' UNION S...
css
CREATE TABLE table_name_99 ( rank INTEGER, year VARCHAR, studio_s_ VARCHAR )
Name the lowest rank for red chillies entertainment for 2013
SELECT MIN(rank) FROM table_name_99 WHERE year = 2013 AND studio_s_ = "red chillies entertainment"
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(...
Compare the total salary by each hire date (bin it into the day of week interval) of employees using a bar chart.
SELECT HIRE_DATE, SUM(SALARY) FROM employees
nvbench
CREATE TABLE weather ( date VARCHAR, mean_sea_level_pressure_inches INTEGER )
What are the dates in which the mean sea level pressure was between 30.3 and 31?
SELECT date FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31
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...
药品排序在团伙成员何欣欣最常开的中,有什么?
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_NM = '何欣欣' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLI...
css
CREATE TABLE table_name_62 ( nickname VARCHAR, institution VARCHAR )
What is the nickname of Columbia University?
SELECT nickname FROM table_name_62 WHERE institution = "columbia university"
sql_create_context
CREATE TABLE table_name_42 ( league INTEGER, scottish_cup INTEGER )
Which League Cup has a Scottish Cup larger than 69?
SELECT SUM(league) AS Cup FROM table_name_42 WHERE scottish_cup > 69
sql_create_context
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE...
Find identical titles (no closed questions) by the same user. We also show the creation date of the posts.
SELECT a.Id AS "post_link", a.CreationDate AS "First Date", b.Id AS "post_link", b.CreationDate AS "Second Date" FROM Posts AS a JOIN Posts AS b ON a.Title = b.Title WHERE a.Id < b.Id AND a.ClosedDate IS NULL AND b.ClosedDate IS NULL AND a.OwnerUserId = b.OwnerUserId
sede
CREATE TABLE table_36231 ( "Air Date" text, "Rating" real, "Share" real, "18-49" text, "Viewers [Live] (m)" real, "Viewers [DVR+7] (m)" text )
What is the sum of the live viewers for episodes with share over 5?
SELECT SUM("Viewers [Live] (m)") FROM table_36231 WHERE "Share" > '5'
wikisql
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, ...
does patient 31325 have a arterial bp [systolic] greater than 107.0, in 06/last year?
SELECT COUNT(*) > 0 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 = 31325)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [syst...
mimic_iii
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) 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 )...
in 04/2104 did patient 65309 excret any urine out foley?
SELECT COUNT(*) > 0 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 = 65309)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine out fole...
mimic_iii
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE zyjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, ...
列出在2005-01-17到2018-07-17内患者许兰梦所有检验报告单中有哪些标本采集部位?
SELECT zyjybgb.BBCJBW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN zyjybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZJZJLB WHERE person_info.XM = '许兰梦...
css
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 me the number of patients who were on prescription drug glucagon and admitted before the year 2137.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2137" AND prescriptions.drug = "Glucagon"
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 ( ...
what is the patient name and icu stay id of the patient id 76446?
SELECT demographic.name, prescriptions.icustay_id FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "76446"
mimicsql_data
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
what is admission location and admission time of subject id 9271?
SELECT demographic.admission_location, demographic.admittime FROM demographic WHERE demographic.subject_id = "9271"
mimicsql_data
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, ...
SO - Total Posts per Month.
SELECT CONCAT(YEAR(P.CreationDate), '-', MONTH(P.CreationDate)) AS YearMonth, COUNT(*) AS PostCount FROM Posts AS P GROUP BY YEAR(P.CreationDate), MONTH(P.CreationDate) ORDER BY YEAR(P.CreationDate) DESC, MONTH(P.CreationDate) DESC
sede
CREATE TABLE table_name_48 ( place VARCHAR, player VARCHAR )
What place has jack renner as the player?
SELECT place FROM table_name_48 WHERE player = "jack renner"
sql_create_context
CREATE TABLE table_71567 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
Name the opponent with a record of 60-61
SELECT "Opponent" FROM table_71567 WHERE "Record" = '60-61'
wikisql
CREATE TABLE table_56449 ( "Player" text, "Tackles" real, "Solo" real, "Assisted" real, "Sack" real, "Yards" real, "TD's" real )
What is the total number of Solo with a Player with sean mcinerney, and Yards larger than 0?
SELECT COUNT("Solo") FROM table_56449 WHERE "Player" = 'sean mcinerney' AND "Yards" > '0'
wikisql
CREATE TABLE table_name_89 ( notes VARCHAR, time VARCHAR )
What were the notes for the time 45.74?
SELECT notes FROM table_name_89 WHERE time = "45.74"
sql_create_context
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...
医疗记录中对于潘莹玉患者医疗费总额高于2220.31元的所以出院诊断疾病编码和名称都分别是什么呢?
SELECT t_kc24.t_kc21_OUT_DIAG_DIS_CD, t_kc24.t_kc21_OUT_DIAG_DIS_NM FROM t_kc24 WHERE t_kc24.t_kc21_PERSON_NM = '潘莹玉' AND t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 2220.31)
css
CREATE TABLE table_name_39 ( visitor VARCHAR, home VARCHAR )
Who was the visiting team when the Suns were the home team?
SELECT visitor FROM table_name_39 WHERE home = "suns"
sql_create_context
CREATE TABLE table_name_82 ( manufacturer VARCHAR, quantity_made VARCHAR, quantity_preserved VARCHAR )
What manufacturer made 6 and preserved 1?
SELECT manufacturer FROM table_name_82 WHERE quantity_made = "6" AND quantity_preserved = "1"
sql_create_context
CREATE TABLE table_204_496 ( id number, "pos" number, "no" number, "driver" text, "team" text, "laps" number, "time/retired" text, "grid" number, "points" number )
at the 2006 gran premio telmex , how many drivers completed less than 60 laps ?
SELECT COUNT("driver") FROM table_204_496 WHERE "laps" < 60
squall
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, draw a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id, rank in ascending by the Y.
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(SALARY)
nvbench
CREATE TABLE table_12792876_3 ( tries_against VARCHAR, drawn VARCHAR )
What was the tries against when the drawn was 2?
SELECT tries_against FROM table_12792876_3 WHERE drawn = "2"
sql_create_context
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, ...
零八年的二月二十七号到二一年九月三号这段时间里医疗机构7969204患者是未就业人员的就诊记录数
SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '7969204' AND t_kc21.IN_HOSP_DATE BETWEEN '2008-02-27' AND '2021-09-03' AND t_kc21.INSURED_STS = '未就业'
css
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE transfers ( row_id number, subject_id number, had...
when did patient 2127 until 2102 for the first time be admitted to the hospital?
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 2127 AND STRFTIME('%y', admissions.admittime) <= '2102' ORDER BY admissions.admittime LIMIT 1
mimic_iii
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden ...
Last 3 months unanswered questions.
SELECT * FROM Posts INNER JOIN Users ON Users.Id = OwnerUserId WHERE Posts.PostTypeId = 1 AND Posts.CreationDate BETWEEN DATEADD(MONTH, -3, CURRENT_TIMESTAMP()) AND CURRENT_TIMESTAMP() AND AcceptedAnswerId IS NULL AND AnswerCount = 0 AND Score > -1 AND CommentCount = 0 AND Users.Reputation > 100
sede
CREATE TABLE table_name_5 ( player VARCHAR, cfl_team VARCHAR )
Which player was drafted by the Saskatchewan Roughriders?
SELECT player FROM table_name_5 WHERE cfl_team = "saskatchewan roughriders"
sql_create_context
CREATE TABLE table_name_21 ( start VARCHAR, finish INTEGER )
Name the total number of start when finish is less than 4
SELECT COUNT(start) FROM table_name_21 WHERE finish < 4
sql_create_context
CREATE TABLE table_36953 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Event" text )
that was held in 1964?
SELECT "Event" FROM table_36953 WHERE "Year" = '1964'
wikisql
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose...
count the number of patients who had had a open incis hern-grft nec procedure done two or more times since 2104.
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 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 = 'open incis hern-grft ...
mimic_iii
CREATE TABLE country ( Country_id int, Country_name text, Capital text, Official_native_language text ) CREATE TABLE team ( Team_id int, Name text ) CREATE TABLE match_season ( Season real, Player text, Position text, Country int, Team int, Draft_Pick_Number int, Dr...
Group and count the years played to draw a bar chart, sort how many years played from low to high order please.
SELECT Years_Played, COUNT(Years_Played) FROM player GROUP BY Years_Played ORDER BY COUNT(Years_Played)
nvbench
CREATE TABLE table_204_383 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
number of gold medals earned by kazakhstan , uzbekistan , and thailand
SELECT SUM("gold") FROM table_204_383 WHERE "nation" IN ('kazakhstan', 'uzbekistan', 'thailand')
squall
CREATE TABLE table_203_574 ( id number, "track number" number, "russian title" text, "english title" text, "music" text, "lyrics" text )
which lyricist has the largest amount of tracks ?
SELECT "lyrics" FROM table_203_574 GROUP BY "lyrics" ORDER BY COUNT("track number") DESC LIMIT 1
squall
CREATE TABLE Trained_In ( Physician INTEGER, Treatment INTEGER, CertificationDate DATETIME, CertificationExpires DATETIME ) CREATE TABLE Appointment ( AppointmentID INTEGER, Patient INTEGER, PrepNurse INTEGER, Physician INTEGER, Start DATETIME, End DATETIME, ExaminationRoom ...
A bar chart for finding the number of the physicians who are trained in a procedure that costs more than 5000.
SELECT T1.Name, COUNT(T1.Name) FROM Physician AS T1 JOIN Trained_In AS T2 ON T1.EmployeeID = T2.Physician JOIN Procedures AS T3 ON T3.Code = T2.Treatment WHERE T3.Cost > 5000 GROUP BY T1.Name
nvbench
CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, ...
what airlines are AC and AS
SELECT DISTINCT airline_code FROM airline WHERE airline_code = 'AC' OR airline_code = 'AS'
atis
CREATE TABLE table_name_17 ( party VARCHAR, left_office VARCHAR, portfolio VARCHAR )
What is Party, when Left Office is '23 April 2005', when Portfolio is 'Minister of Reforms and Devolutions'?
SELECT party FROM table_name_17 WHERE left_office = "23 april 2005" AND portfolio = "minister of reforms and devolutions"
sql_create_context
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto 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 admissions ( ...
what was the first drug being prescribed for patient 26262 during the last hospital visit?
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26262 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) ORDER BY prescriptions.startdate LIMIT 1
mimic_iii
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, ...
患有疾病L29.482的病患开出的药品的编号和名称分别都是什么?
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.IN_DIAG_DIS_CD = 'L29.482' UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE fgwyjzb.IN_DIAG_...
css
CREATE TABLE table_61277 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is the To Par score for the player with an overall score of 71-68-69=208?
SELECT "To par" FROM table_61277 WHERE "Score" = '71-68-69=208'
wikisql
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 )
Show different types of ships and the average tonnage of ships of each type Show bar chart, and show from low to high by the bar.
SELECT Type, AVG(Tonnage) FROM ship GROUP BY Type ORDER BY Type
nvbench
CREATE TABLE table_204_807 ( id number, "date" text, "winner" text, "runner-up" text, "result" text, "site" text, "attendance" number )
what is the difference in attendees for maryland on february 10 , 1979 to february 11 , 1978 ?
SELECT ABS((SELECT "attendance" FROM table_204_807 WHERE "date" = 'february 10, 1979') - (SELECT "attendance" FROM table_204_807 WHERE "date" = 'february 11, 1978'))
squall
CREATE TABLE Financial_transactions ( invoice_number VARCHAR )
Show the invoice number and the number of transactions for each invoice.
SELECT invoice_number, COUNT(*) FROM Financial_transactions GROUP BY invoice_number
sql_create_context
CREATE TABLE table_71725 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
Which opponent had a time of 0:29?
SELECT "Opponent" FROM table_71725 WHERE "Time" = '0:29'
wikisql
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...
列出在医院5127443中出院科室名称包含遗传的患者76594941的住院就诊记录有什么?
SELECT * 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.RYBH = '76594941' AND hz_info.YLJGDM = '5127443' AND zyjzjlb.CYKSMC LIKE '%遗传%'
css
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, ...
统计年龄低于9岁的患者医疗记录的平均医疗费总额有多少?
SELECT AVG(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_AGE < 9 UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_AGE < 9)
css
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 lab test name is uptake ratio?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "Uptake Ratio"
mimicsql_data
CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Dorm_amenity ( amenid INTEGER, amenit...
How many students are from each city, and which cities have more than one cities. Plot them as bar chart.
SELECT city_code, COUNT(*) FROM Student GROUP BY city_code
nvbench
CREATE TABLE table_name_34 ( school_club_team VARCHAR, player VARCHAR )
Which School/Club Team has a Player of deandre liggins?
SELECT school_club_team FROM table_name_34 WHERE player = "deandre liggins"
sql_create_context
CREATE TABLE mzb ( 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...
根据不同的入院诊断疾病编码和科室编码,列出所有医疗就诊记录中患者在医院7880116中的平均年龄有多大?
SELECT qtb.MED_ORG_DEPT_CD, qtb.IN_DIAG_DIS_CD, AVG(qtb.PERSON_AGE) FROM qtb WHERE qtb.MED_SER_ORG_NO = '7880116' GROUP BY qtb.MED_ORG_DEPT_CD, qtb.IN_DIAG_DIS_CD UNION SELECT gyb.MED_ORG_DEPT_CD, gyb.IN_DIAG_DIS_CD, AVG(gyb.PERSON_AGE) FROM gyb WHERE gyb.MED_SER_ORG_NO = '7880116' GROUP BY gyb.MED_ORG_DEPT_CD, gyb.IN_...
css
CREATE TABLE table_203_541 ( id number, "games" text, "host city" text, "dates" text, "nations" number, "participants" number, "events" number )
how many events were at the 1980 winter olympics ?
SELECT "events" FROM table_203_541 WHERE "games" = '1980 winter olympics'
squall
CREATE TABLE table_15870 ( "Player" text, "No." real, "Nationality" text, "Position" text, "Years in Toronto" text, "School/Club Team" text )
What's Dell Curry nationality?
SELECT "Nationality" FROM table_15870 WHERE "Player" = 'Dell Curry'
wikisql
CREATE TABLE table_6660 ( "Tournament" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text )
Name the 2012 for 2009 of a and 2010 of a and 2011 of a
SELECT "2012" FROM table_6660 WHERE "2009" = 'a' AND "2010" = 'a' AND "2011" = 'a'
wikisql
CREATE TABLE table_name_73 ( w_l__doubles_ VARCHAR, debut VARCHAR )
Tell me the WL doubles with a debut of 1999
SELECT w_l__doubles_ FROM table_name_73 WHERE debut = 1999
sql_create_context
CREATE TABLE table_name_73 ( month VARCHAR, sort_restore VARCHAR, deaths VARCHAR )
Which month had a sort value under 39 and 2 deaths?
SELECT month FROM table_name_73 WHERE sort_restore < 39 AND deaths = "2"
sql_create_context
CREATE TABLE table_203_729 ( id number, "township" text, "fips" number, "population\ncenter" text, "population" number, "population\ndensity\n/km2 (/sq mi)" text, "land area\nkm2 (sq mi)" text, "water area\nkm2 (sq mi)" text, "water %" text, "geographic coordinates" text )
how many more people live in clear creek township than columbia township in ellsworth county , kansas ?
SELECT (SELECT "population" FROM table_203_729 WHERE "township" = 'clear creek') - (SELECT "population" FROM table_203_729 WHERE "township" = 'columbia')
squall
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, ...
what were the five most common diagnoses for patients who had been previously diagnosed with splenic trauma within 2 months, since 2 years ago?
SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'splenic trauma' AND DATETIME(diagnosis.d...
eicu
CREATE TABLE table_54145 ( "Race" text, "Dist (f)" real, "Course" text, "Class" text, "Prize (\u00a3K)" real, "Odds" text, "Runners" real, "Placing" real, "Margin" text, "Time" text, "Jockey" text, "Trainer" text )
What is the lowest Prize amount for the Irish Derby Race?
SELECT MIN("Prize (\u00a3K)") FROM table_54145 WHERE "Race" = 'irish derby'
wikisql
CREATE TABLE table_name_14 ( week VARCHAR, date VARCHAR )
What was the total number of weeks with a date of bye?
SELECT COUNT(week) FROM table_name_14 WHERE date = "bye"
sql_create_context
CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1...
How many faculty members do we have for each gender? Draw a bar chart, could you order in desc by the Sex?
SELECT Sex, COUNT(*) FROM Faculty GROUP BY Sex ORDER BY Sex DESC
nvbench
CREATE TABLE table_71304 ( "Representative" text, "Title" text, "Presentation of Credentials" text, "Termination of Mission" text, "Appointed by" text )
Who was appointed with the title of envoy extraordinary and minister plenipotentiary, and a termination of mission of march 16, 1905?
SELECT "Appointed by" FROM table_71304 WHERE "Title" = 'envoy extraordinary and minister plenipotentiary' AND "Termination of Mission" = 'march 16, 1905'
wikisql
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 jyjgzbb ( BGDH text, BGRQ tim...
患者90065090为帕金森病性痴呆(震颤麻痹性痴呆),门诊诊断的免疫球蛋白M(敏感)的结果定量及其单位分别是什么?
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb...
css
CREATE TABLE table_name_54 ( _number___county VARCHAR, enrollment VARCHAR, school VARCHAR )
What's the county of Eastern Pekin school with fewer than 774 enrolled?
SELECT _number___county FROM table_name_54 WHERE enrollment < 774 AND school = "eastern pekin"
sql_create_context
CREATE TABLE table_7644 ( "Draw" real, "Song" text, "Performer" text, "Points" real, "Rank" text )
Who scored 57 points?
SELECT "Performer" FROM table_7644 WHERE "Points" = '57'
wikisql
CREATE TABLE city ( Census_Ranking VARCHAR, Status VARCHAR )
Show the census ranking of cities whose status are not 'Village'.
SELECT Census_Ranking FROM city WHERE Status <> "Village"
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...
among patients treated with drug meto10i, how many of them were aged below 89?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "89" AND prescriptions.formulary_drug_cd = "METO10I"
mimicsql_data
CREATE TABLE table_name_62 ( yards INTEGER, player VARCHAR, rec VARCHAR )
How many yards did Davin Meggett have with more than 9 Rec.?
SELECT SUM(yards) FROM table_name_62 WHERE player = "davin meggett" AND rec > 9
sql_create_context
CREATE TABLE table_name_91 ( location VARCHAR, stadium VARCHAR )
Where is the Stadium of Gortakeegan located?
SELECT location FROM table_name_91 WHERE stadium = "gortakeegan"
sql_create_context
CREATE TABLE table_name_36 ( Id VARCHAR )
What was the 2008 result associated with a 2009 of A and a 2011 of 2R?
SELECT 2008 FROM table_name_36 WHERE 2009 = "a" AND 2011 = "2r"
sql_create_context
CREATE TABLE table_60645 ( "Year" real, "Total Horses" real, "Working Horses" text, "Total Cattle" real, "Oxen" real, "Bulls" text, "Cows" real, "Pigs" real, "Sheep and Goats" real )
What is the lowest number of sheep and goats after 1931, with fewer than 2518 cows and more than 2604.8 horses?
SELECT MIN("Sheep and Goats") FROM table_60645 WHERE "Year" > '1931' AND "Cows" < '2518' AND "Total Horses" > '2604.8'
wikisql
CREATE TABLE table_2503102_2 ( driver_s_ VARCHAR, primary_sponsor VARCHAR )
Who drives the abc supply sponsored cor?
SELECT driver_s_ FROM table_2503102_2 WHERE primary_sponsor = "ABC Supply"
sql_create_context
CREATE TABLE table_6062 ( "Venue" text, "Home" text, "Guest" text, "Score" text, "Attendance" real )
How many Attendance in a match which scores 0:0 - 4:1 (pen)
SELECT AVG("Attendance") FROM table_6062 WHERE "Score" = '0:0 - 4:1 (pen)'
wikisql