context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_10050 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
Who is the player with an E to par and a 68-73-69=210?
SELECT "Player" FROM table_10050 WHERE "To par" = 'e' AND "Score" = '68-73-69=210'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) 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, ...
how many patients are with death status 0 and procedure icd9 code 9744?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.icd9_code = "9744"
mimicsql_data
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
在8814772号医院就诊的患者出院时查出的疾病编码,患上不同疾病的患者们的平均年龄是多少岁啊?
SELECT qtb.OUT_DIAG_DIS_CD, AVG(qtb.PERSON_AGE) FROM qtb WHERE qtb.MED_SER_ORG_NO = '8814772' GROUP BY qtb.OUT_DIAG_DIS_CD UNION SELECT gyb.OUT_DIAG_DIS_CD, AVG(gyb.PERSON_AGE) FROM gyb WHERE gyb.MED_SER_ORG_NO = '8814772' GROUP BY gyb.OUT_DIAG_DIS_CD UNION SELECT zyb.OUT_DIAG_DIS_CD, AVG(zyb.PERSON_AGE) FROM zyb WHERE...
css
CREATE TABLE table_train_111 ( "id" int, "mini_mental_state_examination_mmse" int, "liver_disease" bool, "geriatric_depression_scale_gds" int, "rosen_modified_hachinski_ischemic_score" int, "plasma_creatinine" float, "NOUSE" float )
mini _ mental state examination ( mmse ) score between 8 - 20
SELECT * FROM table_train_111 WHERE mini_mental_state_examination_mmse >= 8 AND mini_mental_state_examination_mmse <= 20
criteria2sql
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...
what is primary disease and lab test name of subject name wilbur braatz?
SELECT demographic.diagnosis, lab.label FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Wilbur Braatz"
mimicsql_data
CREATE TABLE table_26980923_2 ( total INTEGER, team VARCHAR )
What is the total attended for kilmarnock?
SELECT MIN(total) FROM table_26980923_2 WHERE team = "Kilmarnock"
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...
how many of the patients on government insurance had parenteral infusion of concentrated nutritional substances?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Government" AND procedures.long_title = "Parenteral infusion of concentrated nutritional substances"
mimicsql_data
CREATE TABLE table_name_59 ( rookie VARCHAR, week VARCHAR )
Who was the rookie that played week 6?
SELECT rookie FROM table_name_59 WHERE week = 6
sql_create_context
CREATE TABLE table_name_79 ( goals_scored INTEGER, points VARCHAR, wins VARCHAR )
Which Goals scored has Points larger than 26 and Wins larger than 11?
SELECT SUM(goals_scored) FROM table_name_79 WHERE points > 26 AND wins > 11
sql_create_context
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,...
彭丽泽这个病患在02年5月5日到11年10月16日之中主要看的病有哪些?
SELECT IN_DIAG_DIS_CD, IN_DIAG_DIS_NM FROM t_kc21 WHERE PERSON_NM = '彭丽泽' AND IN_HOSP_DATE BETWEEN '2002-05-05' AND '2011-10-16' GROUP BY IN_DIAG_DIS_CD ORDER BY COUNT(*) DESC LIMIT 1
css
CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, ...
give me the list of flights for CO between BOSTON and DENVER
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 = 'BOSTON...
atis
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, chart...
has since 29 months ago cepacol (menthol), azithromycin or metoprolol tartrate been prescribed to patient 43959?
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 43959) AND prescriptions.drug IN ('cepacol (menthol)', 'azithromycin', 'metoprolol tartrate') AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-29 month')
mimic_iii
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE PostHistoryTypes ( Id number, Name te...
Count of answers by user over time, by month.
SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0) AS "month", COUNT(*) AS Count FROM Posts WHERE OwnerUserId = @UserId GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0) ORDER BY 'month' DESC
sede
CREATE TABLE table_47330 ( "Round" real, "Pick" real, "Player" text, "Position" text, "School" text )
How many picks had less than 11 rounds and a player of Charley Casey?
SELECT SUM("Pick") FROM table_47330 WHERE "Round" < '11' AND "Player" = 'charley casey'
wikisql
CREATE TABLE table_78430 ( "Track" real, "Recorded" text, "Catalogue" text, "Release Date" text, "Song Title" text, "Time" text )
What is the highest track for Burning Love?
SELECT MAX("Track") FROM table_78430 WHERE "Song Title" = 'burning love'
wikisql
CREATE TABLE table_24651 ( "Year" real, "Starts" real, "Wins" real, "Top 5" real, "Top 10" real, "Poles" real, "Avg. Start" text, "Avg. Finish" text, "Winnings" text, "Position" text, "Team(s)" text )
What are the top 5 average finishes equalling 40.3?
SELECT "Top 5" FROM table_24651 WHERE "Avg. Finish" = '40.3'
wikisql
CREATE TABLE table_27003186_3 ( other VARCHAR, no_party_preference VARCHAR )
What is other when no party preference is 19.1%?
SELECT other FROM table_27003186_3 WHERE no_party_preference = "19.1%"
sql_create_context
CREATE TABLE table_8382 ( "Pick" real, "Player" text, "Pos." text, "Nationality" text, "Team" text, "Previous team" text, "NBA years [a ]" text, "Career with the franchise [b ]" text )
What is Player, when Pick is greater than 24, and when NBA years [a ] is '9'?
SELECT "Player" FROM table_8382 WHERE "Pick" > '24' AND "NBA years [a ]" = '9'
wikisql
CREATE TABLE table_name_13 ( surface VARCHAR, partner VARCHAR )
Name the surface when the partner is carlos berlocq
SELECT surface FROM table_name_13 WHERE partner = "carlos berlocq"
sql_create_context
CREATE TABLE table_29278 ( "District" text, "Counties Represented" text, "Delegate" text, "Party" text, "First Elected" real, "Committee" text )
Where delegate is feldman, brian j. brian j. feldman, please specify all the party
SELECT "Party" FROM table_29278 WHERE "Delegate" = 'Feldman, Brian J. Brian J. Feldman'
wikisql
CREATE TABLE table_5169 ( "Series Ep." text, "Episode" real, "Netflix" text, "Segment A" text, "Segment B" text, "Segment C" text, "Segment D" text )
What's the segment A in episode 42?
SELECT "Segment A" FROM table_5169 WHERE "Episode" = '42'
wikisql
CREATE TABLE table_59154 ( "Aircraft" text, "1990" real, "destroyed" real, "damaged" real, "to Iran" real, "survived" real )
What's the average survived with a to Iran less than 1, more than 1 destroyed, and a brazil tucano aircraft?
SELECT AVG("survived") FROM table_59154 WHERE "to Iran" < '1' AND "Aircraft" = 'brazil tucano' AND "destroyed" > '1'
wikisql
CREATE TABLE table_2505 ( "Year (Ceremony)" text, "Film title used in nomination" text, "Language(s)" text, "Director" text, "Result" text )
Name the result for japanese
SELECT "Result" FROM table_2505 WHERE "Language(s)" = 'Japanese'
wikisql
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) 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 ) ...
when patient 1819 was admitted to the hospital via the phys referral/normal deli for the last time this year?
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 1819 AND admissions.admission_location = 'phys referral/normal deli' AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY admissions.admittime DESC LIMIT 1
mimic_iii
CREATE TABLE fgwyjzb ( 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, ...
按照出院诊断的疾病编号不同以及科室的不同显示出医院7279066所有的记录里个人自费的花费与全部医疗费用相比比值的最小值然后按升序的顺序来排列
SELECT gwyjzb.MED_ORG_DEPT_NM, gwyjzb.OUT_DIAG_DIS_CD, MIN(t_kc24.PER_EXP) FROM gwyjzb JOIN t_kc24 ON gwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE gwyjzb.MED_SER_ORG_NO = '7279066' GROUP BY gwyjzb.MED_ORG_DEPT_NM, gwyjzb.OUT_DIAG_DIS_CD ORDER BY MIN(t_kc24.PER_EXP / t_kc24.MED_AMOUT) UNION SELECT fgwyjzb.MED_ORG_D...
css
CREATE TABLE table_train_18 ( "id" int, "with_cardiac_pacemaker" bool, "neuromuscular_disease" bool, "diabetic_polyneuropathy" bool, "body_mass_index_bmi" float, "age" float, "NOUSE" float )
without diagnosis of neuromuscular diseases,
SELECT * FROM table_train_18 WHERE neuromuscular_disease = 0
criteria2sql
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 Allergy_Type ( Allergy VARCHAR(20), AllergyType VARCHAR(20) ) CREATE TABLE Has_Allergy ( StuID INTEGE...
What is the number of each allergie the girl named Lisa has? Plot them as bar chart, and sort by the total number in asc.
SELECT T1.Allergy, COUNT(T1.Allergy) FROM Allergy_Type AS T1 JOIN Has_Allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = "Lisa" GROUP BY T1.Allergy ORDER BY T1.Allergy
nvbench
CREATE TABLE table_name_85 ( other VARCHAR, firefox VARCHAR )
What is the other that has 20.80% as the firefox?
SELECT other FROM table_name_85 WHERE firefox = "20.80%"
sql_create_context
CREATE TABLE table_32734 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What date was the Home team fitzroy?
SELECT "Date" FROM table_32734 WHERE "Home team" = 'fitzroy'
wikisql
CREATE TABLE table_name_94 ( goals_scored INTEGER, goals_conceded VARCHAR, draw VARCHAR, lost VARCHAR )
What is the lowest number of goals scored for the entry with goals conceded larger than 30, lost larger than 3, and fewer than 6 draws?
SELECT MIN(goals_scored) FROM table_name_94 WHERE draw < 6 AND lost > 3 AND goals_conceded > 30
sql_create_context
CREATE TABLE Settlements ( Settlement_ID INTEGER, Claim_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settled INTEGER, Customer_Policy_ID INTEGER ) CREATE TABLE Customers ( Customer_ID INTEGER, Customer_Details VARCHAR(255) ) CREATE TABLE...
How many total amounts of payments by each method code? You can give me a bar chart, and order x-axis in ascending order.
SELECT Payment_Method_Code, SUM(Amount_Payment) FROM Payments GROUP BY Payment_Method_Code ORDER BY Payment_Method_Code
nvbench
CREATE TABLE table_21600 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What game was on May 25?
SELECT "Game" FROM table_21600 WHERE "Date" = 'May 25'
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...
count the number of patients whose admission year is less than 2158 and lab test name is myelocytes?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2158" AND lab.label = "Myelocytes"
mimicsql_data
CREATE TABLE table_17625749_1 ( won VARCHAR, tries_against VARCHAR )
Name the won when tries against is 72
SELECT won FROM table_17625749_1 WHERE tries_against = "72"
sql_create_context
CREATE TABLE table_2248784_3 ( rank_world VARCHAR )
Name the 2011 gdp for 65 rank world
SELECT 2011 AS _gdp__ppp__billions_of_usd FROM table_2248784_3 WHERE rank_world = 65
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 Plays_Games ( StuID INTEGER, GameID INTEGER, Hours_Played INTEGER ) CREATE TABLE SportsInfo ( Stu...
What are the last names for all scholarship students, and count them by a bar chart, and rank by the y axis from low to high please.
SELECT LName, COUNT(LName) FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.OnScholarship = 'Y' GROUP BY LName ORDER BY COUNT(LName)
nvbench
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,...
在医疗就诊44616393029里,患者陶乐容所有开具医疗项目的医师的编号和姓名均为什么?
SELECT HOSP_DOC_CD, HOSP_DOC_NM FROM t_kc22 WHERE MED_CLINIC_ID = '44616393029'
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,...
在记录51659566599里,算一下医疗费明细药物的数量乘以单价
SELECT QTY * UNIVALENT FROM t_kc22 WHERE MED_EXP_DET_ID = '51659566599'
css
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 patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE i...
count the number of patients who have been diagnosed with hyperpotassemia, who did not come back to the hospital within the same month in 2100.
SELECT (SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'hyperpotas...
mimic_iii
CREATE TABLE table_name_78 ( notes VARCHAR, displacement VARCHAR )
What is the notes when the displacement is 220cid (3,604cc)?
SELECT notes FROM table_name_78 WHERE displacement = "220cid (3,604cc)"
sql_create_context
CREATE TABLE table_37689 ( "Round" real, "Pick" real, "Player" text, "Position" text, "School" text )
What pick was roger holdinsky?
SELECT "Pick" FROM table_37689 WHERE "Player" = 'roger holdinsky'
wikisql
CREATE TABLE table_name_53 ( pick VARCHAR, round VARCHAR, player VARCHAR )
What was the pick for Bill Gramatica after round 2?
SELECT pick FROM table_name_53 WHERE round > 2 AND player = "bill gramatica"
sql_create_context
CREATE TABLE table_name_44 ( wins VARCHAR, points VARCHAR )
How many wins does the driver with 217 points have?
SELECT wins FROM table_name_44 WHERE points = 217
sql_create_context
CREATE TABLE Customers ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_ci...
How many different products correspond to each order id. Plot them as scatter chart.
SELECT order_id, COUNT(DISTINCT product_id) FROM Order_Items
nvbench
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, ...
number of answers per day.
SELECT CAST(TIME_TO_STR(CreationDate, '%Y-%m-%d %H:%M:%S') AS TEXT(10)) AS date, COUNT(1) FROM Posts WHERE PostTypeId = 2 GROUP BY CAST(TIME_TO_STR(CreationDate, '%Y-%m-%d %H:%M:%S') AS TEXT(10)) ORDER BY date
sede
CREATE TABLE table_61542 ( "Date" text, "Opponents" text, "H / A" text, "Result F \u2013 A" text, "Attendance" real )
What is the result F-A with an H/A of h and more than 31,727 attending?
SELECT "Result F \u2013 A" FROM table_61542 WHERE "H / A" = 'h' AND "Attendance" > '31,727'
wikisql
CREATE TABLE Tourist_Attractions ( Tourist_Attraction_ID INTEGER, Attraction_Type_Code CHAR(15), Location_ID INTEGER, How_to_Get_There VARCHAR(255), Name VARCHAR(255), Description VARCHAR(255), Opening_Hours VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Visitors ( Tourist_...
What are the names and ids of the tourist attractions that are visited at most once Visualize by bar chart, rank by the Y-axis in descending.
SELECT T1.Name, T1.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN Visits AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID ORDER BY T1.Tourist_Attraction_ID DESC
nvbench
CREATE TABLE table_27786 ( "Position" real, "Race number" text, "Sail number" text, "Yacht" text, "State/country" text, "Yacht type" text, "LOA (Metres)" text, "Skipper" text, "Elapsed time d:hh:mm:ss" text )
How many elapsed times were posted for the yacht with 27.38 LOA meters?
SELECT COUNT("Elapsed time d:hh:mm:ss") FROM table_27786 WHERE "LOA (Metres)" = '27.38'
wikisql
CREATE TABLE table_name_92 ( position VARCHAR, college VARCHAR )
What is the position of the player from the college of western michigan?
SELECT position FROM table_name_92 WHERE college = "western michigan"
sql_create_context
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
列出患者37982575门诊诊断名称包含龈炎的在医院3085666中有什么门诊就诊记录?
SELECT * 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 person_info_hz_i...
css
CREATE TABLE table_2268216_1 ( date VARCHAR, race_time VARCHAR )
What is the date for the race that had the time of 2:43:19?
SELECT date FROM table_2268216_1 WHERE race_time = "2:43:19"
sql_create_context
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
calculate the duration of patient 002-56853's stay in the last icu.
SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-56853') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1
eicu
CREATE TABLE table_name_78 ( tournament VARCHAR, surface VARCHAR, date VARCHAR )
What tournament had a hard surface on February 25, 1996?
SELECT tournament FROM table_name_78 WHERE surface = "hard" AND date = "february 25, 1996"
sql_create_context
CREATE TABLE PRODUCTS ( Product_Name VARCHAR, Product_Price INTEGER )
What are the different product names? What is the average product price for each of them?
SELECT Product_Name, AVG(Product_Price) FROM PRODUCTS GROUP BY Product_Name
sql_create_context
CREATE TABLE fgwyjzb ( 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, ...
在医疗记录中那个病号蒋蕴藉购买了金额超过8634.98元的药品几次?记录的就诊编号是多些?
SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_NM = '蒋蕴藉' AND gwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT > 8634.98) UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '蒋蕴藉' AND fgwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22...
css
CREATE TABLE table_name_2 ( score VARCHAR, date VARCHAR )
What was the game score on april 2, 2008?
SELECT score FROM table_name_2 WHERE date = "april 2, 2008"
sql_create_context
CREATE TABLE table_75254 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Series" text )
Which Date has a Game smaller than 4, and an Opponent of calgary flames, and a Score of 4 5?
SELECT "Date" FROM table_75254 WHERE "Game" < '4' AND "Opponent" = 'calgary flames' AND "Score" = '4–5'
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, draw a bar chart about the distribution of job_id and the sum of salary , and group by attribute job_id, and rank X in desc order.
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID DESC
nvbench
CREATE TABLE exhibition_record ( Exhibition_ID int, Date text, Attendance int ) CREATE TABLE artist ( Artist_ID int, Name text, Country text, Year_Join int, Age int ) CREATE TABLE exhibition ( Exhibition_ID int, Year int, Theme text, Artist_ID int, Ticket_Price real...
Show the average of artists' age by country.
SELECT Country, AVG(Age) FROM artist GROUP BY Country
nvbench
CREATE TABLE table_13553701_1 ( mens_singles VARCHAR, womens_singles VARCHAR )
Who is the mens singles and womens singlses is wang shixian?
SELECT mens_singles FROM table_13553701_1 WHERE womens_singles = "Wang Shixian"
sql_create_context
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, Deletio...
Average score for questions and answers.
SELECT CASE PostTypeId WHEN 1 THEN 'Question' ELSE 'Answer' END AS "post_type", AVG(CAST(Score AS FLOAT)) AS "average_score" FROM Posts WHERE OwnerUserId = '##UserId##' AND PostTypeId <= 2 GROUP BY PostTypeId
sede
CREATE TABLE table_36525 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
Date of april 9 had what score?
SELECT "Score" FROM table_36525 WHERE "Date" = 'april 9'
wikisql
CREATE TABLE table_78151 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
On what date the footscray's away game?
SELECT "Date" FROM table_78151 WHERE "Away team" = 'footscray'
wikisql
CREATE TABLE Ref_calendar ( calendar_date VARCHAR, day_Number VARCHAR )
Show all calendar dates and day Numbers.
SELECT calendar_date, day_Number FROM Ref_calendar
sql_create_context
CREATE TABLE table_1281200_1 ( winners_from_previous_round VARCHAR, clubs_involved VARCHAR )
Clubs involved is 8, what number would you find from winners from previous round?
SELECT winners_from_previous_round FROM table_1281200_1 WHERE clubs_involved = 8
sql_create_context
CREATE TABLE table_name_96 ( player VARCHAR, college VARCHAR )
Which player plays for the college of manitoba?
SELECT player FROM table_name_96 WHERE college = "manitoba"
sql_create_context
CREATE TABLE table_name_12 ( home_team VARCHAR, away_team VARCHAR )
who is the home team when the away team is bolton wanderers?
SELECT home_team FROM table_name_12 WHERE away_team = "bolton wanderers"
sql_create_context
CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text...
what 's the latest flight from SAN FRANCISCO to ATLANTA
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = ...
atis
CREATE TABLE table_13188 ( "Date" text, "Ship" text, "Tonnage" text, "Nationality" text, "Fate" text )
Name Nationality is on 6 july 1942?
SELECT "Nationality" FROM table_13188 WHERE "Date" = '6 july 1942'
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
how many patients whose procedure long title is non-invasive mechanical ventilation?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Non-invasive mechanical ventilation"
mimicsql_data
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
医疗就诊71644479467中,患者购买药品812035653开出的医疗发票项目类别属什么类别
SELECT t_kc22.MED_INV_ITEM_TYPE FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '71644479467' AND t_kc22.SOC_SRT_DIRE_CD = '812035653'
css
CREATE TABLE table_204_135 ( id number, "position" number, "club" text, "played" number, "points" number, "wins" number, "draws" number, "losses" number, "goals for" number, "goals against" number, "goal difference" number )
which team finished top of the league ?
SELECT "club" FROM table_204_135 ORDER BY "position" LIMIT 1
squall
CREATE TABLE loan ( loan_ID varchar(3), loan_type varchar(15), cust_ID varchar(3), branch_ID varchar(3), amount int ) CREATE TABLE customer ( cust_ID varchar(3), cust_name varchar(20), acc_type char(1), acc_bal int, no_of_loans int, credit_score int, branch_ID int, s...
Draw a bar chart for what is the average account balance of customers with credit score below 50 for the different account types?
SELECT acc_type, AVG(acc_bal) FROM customer WHERE credit_score < 50 GROUP BY acc_type
nvbench
CREATE TABLE table_name_67 ( institutional_authority VARCHAR, rocket_launch VARCHAR )
Which Institutional authority has a Rocket launch of rehnuma-10?
SELECT institutional_authority FROM table_name_67 WHERE rocket_launch = "rehnuma-10"
sql_create_context
CREATE TABLE table_14404 ( "City" text, "Province/Region" text, "Country" text, "IATA" text, "ICAO" text, "Airport" text )
Which city's IATA is KUL?
SELECT "City" FROM table_14404 WHERE "IATA" = 'kul'
wikisql
CREATE TABLE table_11543 ( "Year" real, "Date" text, "Location" text, "Score" text, "Result" text )
What day was the result a win, the score 2-1, and the year before 2012?
SELECT "Date" FROM table_11543 WHERE "Result" = 'win' AND "Score" = '2-1' AND "Year" < '2012'
wikisql
CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_p...
What courses will be offered this Fall ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND semester.semester = 'Fall' AND semester.semester_id = course_offering.semester AND semester.year = 2016
advising
CREATE TABLE table_name_97 ( year VARCHAR, driver VARCHAR )
How many years did Wilson Fittipaldi race?
SELECT COUNT(year) FROM table_name_97 WHERE driver = "wilson fittipaldi"
sql_create_context
CREATE TABLE table_14457 ( "Week" text, "Opponent" text, "Result" text, "Game site" text, "Attendance" text )
What was the score when 50,514 people were in attendance?
SELECT "Result" FROM table_14457 WHERE "Attendance" = '50,514'
wikisql
CREATE TABLE table_204_786 ( id number, "riding" text, "candidate" text, "gender" text, "residence" text, "occupation" text, "votes" number, "%" number, "rank" text, "biographical notes" text )
what is the first riding ?
SELECT "riding" FROM table_204_786 WHERE id = 1
squall
CREATE TABLE table_name_42 ( judge VARCHAR, state VARCHAR )
Who was the judge for the state SD?
SELECT judge FROM table_name_42 WHERE state = "sd"
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 Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1...
A bar chart about how many faculty members do we have for each faculty rank?, and display by the Y in ascending.
SELECT Rank, COUNT(*) FROM Faculty GROUP BY Rank ORDER BY COUNT(*)
nvbench
CREATE TABLE table_11303072_9 ( player VARCHAR, rank VARCHAR )
What are the players whose rank is 2?
SELECT player FROM table_11303072_9 WHERE rank = 2
sql_create_context
CREATE TABLE table_18275 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
what is the party for district ohio 11?
SELECT "Party" FROM table_18275 WHERE "District" = 'Ohio 11'
wikisql
CREATE TABLE table_24216139_2 ( enrollment INTEGER, sport VARCHAR )
Name the least enrollment for field hockey, men's swimming
SELECT MIN(enrollment) FROM table_24216139_2 WHERE sport = "Field hockey, men's swimming"
sql_create_context
CREATE TABLE table_38828 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What is the location attendance of the game on February 25?
SELECT "Location Attendance" FROM table_38828 WHERE "Date" = 'february 25'
wikisql
CREATE TABLE table_name_35 ( popular_votes INTEGER, percentage VARCHAR, year VARCHAR )
Name the average popular votes in years after 1990 with percentage of 4.94%
SELECT AVG(popular_votes) FROM table_name_35 WHERE percentage = "4.94%" AND year > 1990
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
what is the number of patients whose age is beow 74 and diagnosed for non specific elavation of transaminase level or lactic acid dehydrogenase?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "74" AND diagnoses.long_title = "Nonspecific elevation of levels of transaminase or lactic acid dehydrogenase [LDH]"
mimicsql_data
CREATE TABLE table_6605 ( "Player" text, "Rating" real, "Cmp." real, "Att." real, "Cmp. %" real, "Yards" real, "Int." real, "Long" real )
How many Atts that have Yards of 43 and a Long larger than 43?
SELECT SUM("Att.") FROM table_6605 WHERE "Yards" = '43' AND "Long" > '43'
wikisql
CREATE TABLE table_47918 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text, "Position in table" text )
Who is the outgoing manager who was replaced by j rgen klopp?
SELECT "Outgoing manager" FROM table_47918 WHERE "Replaced by" = 'jürgen klopp'
wikisql
CREATE TABLE table_18901 ( "Rnd" real, "Circuit" text, "GTO Winning Team" text, "GTU Winning Team" text, "TO Winning Team" text, "TU Winning Team" text, "Results" text )
What round was the gto winning team #48 greenwood racing?
SELECT "Rnd" FROM table_18901 WHERE "GTO Winning Team" = '#48 Greenwood Racing'
wikisql
CREATE TABLE table_36577 ( "Player" text, "Touchdowns (5 points)" real, "Extra points 1 point" real, "Field goals (5 points)" real, "Total Points" real )
Which Extra points 1 point has a Total Points smaller than 30, and Touchdowns (5 points) of 5?
SELECT AVG("Extra points 1 point") FROM table_36577 WHERE "Total Points" < '30' AND "Touchdowns (5 points)" = '5'
wikisql
CREATE TABLE table_52792 ( "Analog Channel" text, "Digital Channel" text, "Call sign" text, "Name" text, "Network" text )
Which analog channel has a digital channel of 4.1?
SELECT "Analog Channel" FROM table_52792 WHERE "Digital Channel" = '4.1'
wikisql
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREAT...
how many times has patient 033-7332 visit the hospital the previous year?
SELECT COUNT(DISTINCT patient.patienthealthsystemstayid) FROM patient WHERE patient.uniquepid = '033-7332' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
eicu
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
自09年9月22日起,到11年5月20日为止,医疗机构0695523的转诊门诊有多少就诊记录
SELECT COUNT(*) FROM fzzmzjzjlb WHERE fzzmzjzjlb.YLJGDM = '0695523' AND fzzmzjzjlb.JZKSRQ BETWEEN '2009-09-22' AND '2011-05-20'
css
CREATE TABLE table_1554 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Attendance" real, "Record" text, "Points" real )
How many records were made on March 27, 2009?
SELECT COUNT("Record") FROM table_1554 WHERE "Date" = 'March 27, 2009'
wikisql
CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_proje...
How many credits is EECS 438 ?
SELECT DISTINCT credits FROM course WHERE department = 'EECS' AND number = 438
advising
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
03652738号患者在02年3月6日到04月10月25日期间其所有检验结果指标记录中的检测方法是啥呢?
SELECT jyjgzbb.JCFF FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND ...
css
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime ti...
give me patient 74523's yearly maximum pt until 4 years ago.
SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 74523) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'pt') AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '-4 year...
mimic_iii
CREATE TABLE table_name_22 ( round INTEGER, pick VARCHAR, player VARCHAR )
What was the latest round that Derek Pagel was selected with a pick higher than 50?
SELECT MAX(round) FROM table_name_22 WHERE pick > 50 AND player = "derek pagel"
sql_create_context