context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments ...
Can you list all of Prof. Megan Gilster 's clases , past , future and current ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Megan Gilster%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id =...
advising
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
what is drug name and drug route of drug code prismab22k45000?
SELECT prescriptions.drug, prescriptions.route FROM prescriptions WHERE prescriptions.formulary_drug_cd = "PRISMAB22K45000"
mimicsql_data
CREATE TABLE table_name_42 ( score VARCHAR, opponent VARCHAR, result VARCHAR )
What is the score where Saint-Amant lost the match?
SELECT score FROM table_name_42 WHERE opponent = "saint-amant" AND result = "lost"
sql_create_context
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...
The 13 -credit CHEM classes are which ones ?
SELECT DISTINCT name, number FROM course WHERE department = 'CHEM' AND credits = 13
advising
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, ...
for patient id 2560, specify the type and location of admission
SELECT demographic.admission_type, demographic.admission_location FROM demographic WHERE demographic.subject_id = "2560"
mimicsql_data
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodici...
how much is the cost of a drug called maalox?
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'maalox')
eicu
CREATE TABLE table_name_66 ( basin VARCHAR, in_state_area VARCHAR )
What is the name of the basin with an in-state area of 071 238km 2 92mi 2?
SELECT basin FROM table_name_66 WHERE in_state_area = "071 238km 2 92mi 2"
sql_create_context
CREATE TABLE txmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZ...
从0一年七月二十七日开始,截止到一一年六月十八日,将近十年间找医生59717906医治的门诊病人有多少
SELECT COUNT(hz_info.RYBH) FROM hz_info JOIN txmzjzjlb ON hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX WHERE txmzjzjlb.ZZYSGH = '59717906' AND txmzjzjlb.JZKSRQ BETWEEN '2001-07-27' AND '2011-06-18' UNION SELECT COUNT(hz_info.RYBH) FROM hz_info JOIN ftxmzjzjlb ON hz_inf...
css
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
provide the number of patients whose primary disease is hypoxia and procedure short title is coronar arteriogr-1 cath.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "HYPOXIA" AND procedures.short_title = "Coronar arteriogr-1 cath"
mimicsql_data
CREATE TABLE table_30527 ( "Name of Rivalry" text, "Rival" text, "Games Played" real, "First Meeting" real, "Last Meeting" real, "AU Won" real, "AU Lost" real, "Ties" real, "Streak" text, "Latest win" text )
what is the length where the time is 2009
SELECT "Streak" FROM table_30527 WHERE "Last Meeting" = '2009'
wikisql
CREATE TABLE table_10090 ( "Number" real, "Name" text, "Year Built" text, "Boat Builder" text, "Current Status" text )
What is the boat builder for a boat built in 1994 and a number greater than 93?
SELECT "Boat Builder" FROM table_10090 WHERE "Number" > '93' AND "Year Built" = '1994'
wikisql
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 VoteTypes ( Id number, Name text ) C...
Tag wikis with HTTP links.
SELECT t.TagName, p.LastEditDate, 'site://edit-tag-wiki/' + CAST(t.Id AS TEXT) AS "Link" FROM Posts AS p INNER JOIN Tags AS t ON p.Id = t.WikiPostId WHERE p.Body LIKE '%http://apple.stackexchange.com/%' ORDER BY p.LastEditDate
sede
CREATE TABLE table_name_94 ( imperative VARCHAR, måcha VARCHAR )
What imperative has m cha as 3.sg?
SELECT imperative FROM table_name_94 WHERE måcha = "3.sg"
sql_create_context
CREATE TABLE table_name_63 ( Id VARCHAR )
What is the sum of 1891(s), when 1872 is less than 685, and when 1881 is less than 348?
SELECT SUM(1891) FROM table_name_63 WHERE 1872 < 685 AND 1881 < 348
sql_create_context
CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int...
Show the number of courses for each office in a stacked bar chart The x-axis is office name and group by course description, order X-axis in ascending order.
SELECT PROF_OFFICE, COUNT(PROF_OFFICE) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY CRS_DESCRIPTION, PROF_OFFICE ORDER BY PROF_OFFICE
nvbench
CREATE TABLE table_10818 ( "Pick" real, "Round" text, "Player" text, "Free Agent Class" text, "New Team" text )
What was the pick number for the compensation-a round, for player Frank Catalanotto?
SELECT "Pick" FROM table_10818 WHERE "Round" = 'compensation-a' AND "Player" = 'frank catalanotto'
wikisql
CREATE TABLE table_name_74 ( letter VARCHAR, british VARCHAR )
What is the letter for the Brisish ?
SELECT letter FROM table_name_74 WHERE british = "ɒ"
sql_create_context
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Tags ( Id number, TagName text, C...
Find identical titles (no closed questions). 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 (SELECT COUNT(*) FROM PostHistory WHERE PostHistoryTypeId = 18 AND (PostId = a.Id OR PostId = b.Id)) = 0
sede
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid num...
count the number of times patient 002-75209 was prescribed with sodium chloride 0.9% 1000 ml pb in the last hospital visit.
SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-75209' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hosp...
eicu
CREATE TABLE table_name_97 ( player VARCHAR, college VARCHAR )
What player has a college named san sebastian?
SELECT player FROM table_name_97 WHERE college = "san sebastian"
sql_create_context
CREATE TABLE table_name_2 ( tournament VARCHAR )
Which 2008 has a 2009 of A, and a 2010 of A, and a 2012 of 1r, and a Tournament of cincinnati masters?
SELECT 2008 FROM table_name_2 WHERE 2009 = "a" AND 2010 = "a" AND 2012 = "1r" AND tournament = "cincinnati masters"
sql_create_context
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
头孢丙烯片(薄膜衣)的使用频次和每次剂量在医疗就诊46098253524期间为多少量?
SELECT USE_FRE, EACH_DOSAGE FROM t_kc22 WHERE MED_CLINIC_ID = '46098253524' AND SOC_SRT_DIRE_NM = '头孢丙烯片(薄膜衣)'
css
CREATE TABLE table_204_334 ( id number, "opposition" text, "matches" number, "won" number, "drawn" number, "lost" number, "for" number, "against" number, "win%" text )
which was the only team that the comets did not win a match against ?
SELECT "opposition" FROM table_204_334 WHERE "won" = 0
squall
CREATE TABLE table_75460 ( "High School" text, "Location" text, "Founded" real, "Affiliation" text, "Enrollment" real, "Nickname" text, "Division" text )
What is the affiliation of a high school in Issaquah that was founded in less than 1965?
SELECT "Affiliation" FROM table_75460 WHERE "Founded" < '1965' AND "High School" = 'issaquah'
wikisql
CREATE TABLE table_name_25 ( overs INTEGER, player VARCHAR )
What did Xavier Doherty (Tasmania) set as his highest Overs?
SELECT MAX(overs) FROM table_name_25 WHERE player = "xavier doherty (tasmania)"
sql_create_context
CREATE TABLE table_1108 ( "Rank" real, "Country" text, "International tourist arrivals (2011)" text, "International tourist arrivals (2010)" text, "Change (2010 to 2011)" text, "Change (2009 to 2010)" text )
Name the change 2009 to 2010 where international tourist arrivals is 9.4 million
SELECT "Change (2009 to 2010)" FROM table_1108 WHERE "International tourist arrivals (2011)" = '9.4 million'
wikisql
CREATE TABLE table_45519 ( "Poll Source" text, "Dates administered" text, "Democrat: Tom Harkin" text, "Republican: Christopher Reed" text, "Lead Margin" real )
What were the dates administered in the Survey USA poll source where Republican Christopher Reed received 37%?
SELECT "Dates administered" FROM table_45519 WHERE "Poll Source" = 'survey usa' AND "Republican: Christopher Reed" = '37%'
wikisql
CREATE TABLE table_69234 ( "Rank" text, "Mine" text, "County" text, "Operator" text, "Capacity (thousands of metric tons)" text )
What rank is the Silver Bell mine of Pima county?
SELECT "Rank" FROM table_69234 WHERE "County" = 'pima' AND "Mine" = 'silver bell'
wikisql
CREATE TABLE table_68597 ( "Outcome" text, "Year" real, "Tournament" text, "Partner" text, "Opponent" text, "Score" text )
What score resulted in a winner after 2008?
SELECT "Score" FROM table_68597 WHERE "Outcome" = 'winner' AND "Year" > '2008'
wikisql
CREATE TABLE table_28976 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (millions)" text )
How many entries for number in series when director is Bryan Cranston?
SELECT COUNT("No. in series") FROM table_28976 WHERE "Directed by" = 'Bryan Cranston'
wikisql
CREATE TABLE table_name_52 ( week VARCHAR, date VARCHAR )
November 25, 2001 was what week of the season?
SELECT COUNT(week) FROM table_name_52 WHERE date = "november 25, 2001"
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime t...
is the calcium of patient 004-2373 last measured on the last hospital visit less than second to last measured on the last hospital visit is it?
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 = '004-2373' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospit...
eicu
CREATE TABLE table_train_98 ( "id" int, "mini_mental_state_examination_mmse" int, "stroke" bool, "lyperlipidemia_ldl" int, "allergy_to_milk" bool, "allergy_to_soy" bool, "body_mass_index_bmi" float, "NOUSE" float )
body mass index ( bmi ) range between 20 _ 40 kg / m2
SELECT * FROM table_train_98 WHERE body_mass_index_bmi >= 20 AND body_mass_index_bmi <= 40
criteria2sql
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
查询在2000年4月22日到2014年2月2日的这段时间里医院5633728的检验科科室涉及的医疗费总额
SELECT SUM(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc21_t_kc24.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '5633728' AND t_kc21.MED_ORG_DEPT_NM = '检验科') AND t_kc24.CLINIC_SLT_DATE BETWEEN '2000-04-22' AND '2014-02-02'
css
CREATE TABLE table_48491 ( "Date" text, "Opponent#" text, "Site" text, "Result" text, "Attendance" text )
What was the result for 10/04/1947?
SELECT "Result" FROM table_48491 WHERE "Date" = '10/04/1947'
wikisql
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE...
For those employees who did not have any job in the past, give me the comparison about the average of salary over the hire_date bin hire_date by weekday by a bar chart, show in asc by the y-axis.
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(SALARY)
nvbench
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE...
what is the cost for albumin, body fluid lab testing?
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'labevents' AND cost.event_id IN (SELECT labevents.row_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'albumin, body fluid'))
mimic_iii
CREATE TABLE table_name_25 ( points INTEGER, entrant VARCHAR, year VARCHAR )
What is the most points when the entrant was Jaguar racing earlier than 2001?
SELECT MAX(points) FROM table_name_25 WHERE entrant = "jaguar racing" AND year < 2001
sql_create_context
CREATE TABLE table_name_36 ( opponent VARCHAR, venue VARCHAR )
Which team did the Boston Beaneaters host at the South End Grounds?
SELECT opponent FROM table_name_36 WHERE venue = "south end grounds"
sql_create_context
CREATE TABLE table_name_79 ( player VARCHAR, school VARCHAR )
Who is the player from La Costa Canyon High School?
SELECT player FROM table_name_79 WHERE school = "la costa canyon high school"
sql_create_context
CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credi...
Are the JAZZ classes that I have taken amongst the most difficult ones ?
SELECT DISTINCT course.department, course.name, course.number, program_course.workload FROM course INNER JOIN student_record ON student_record.course_id = course.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.department = 'JAZZ' AND program_course.workload = (SELECT MAX(...
advising
CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INTEGER, Price INTEGER, Score INTEGER, Cases INTEGER, Drink TEXT ) CREATE TABLE appellations ( No...
What is the maximum price of wines in each year?, sort by the X-axis from low to high.
SELECT Year, MAX(Price) FROM wine GROUP BY Year ORDER BY Year
nvbench
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostFeedback ( Id nu...
progress towards Self Learner badge. Shows the scores for answers you've given to your own questions
SELECT Answer.Id AS "post_link", Answer.Score FROM Posts AS Answer LEFT JOIN Posts AS Question ON Question.Id = Answer.ParentId WHERE Answer.PostTypeId = 2 AND Answer.OwnerUserId = @user AND Question.OwnerUserId = @user ORDER BY Score DESC
sede
CREATE TABLE table_name_18 ( authority VARCHAR, roll VARCHAR )
Which authority had a role of 651?
SELECT authority FROM table_name_18 WHERE roll = 651
sql_create_context
CREATE TABLE table_name_84 ( december INTEGER, record VARCHAR, game VARCHAR )
What is the average day in December with a Record of 16-3-4 and a Game smaller than 23?
SELECT AVG(december) FROM table_name_84 WHERE record = "16-3-4" AND game < 23
sql_create_context
CREATE TABLE table_name_1 ( name VARCHAR, left_office VARCHAR )
Who left office in June 2011?
SELECT name FROM table_name_1 WHERE left_office = "june 2011"
sql_create_context
CREATE TABLE table_name_97 ( score VARCHAR, home_team VARCHAR )
What is the score for the home team Notts County?
SELECT score FROM table_name_97 WHERE home_team = "notts county"
sql_create_context
CREATE TABLE table_name_35 ( result VARCHAR, opponent VARCHAR )
What was the result when the San Francisco 49ers were the opponents?
SELECT result FROM table_name_35 WHERE opponent = "san francisco 49ers"
sql_create_context
CREATE TABLE table_27919 ( "meas. num" real, "passed" text, "YES votes" real, "NO votes" real, "% YES" text, "Const. Amd.?" text, "type" text, "description" text )
What numbered measure had a 58.29% yes%?
SELECT "meas. num" FROM table_27919 WHERE "% YES" = '58.29%'
wikisql
CREATE TABLE table_49508 ( "Teams" text, "Finals appearances" real, "Championships" real, "Runners-up" real, "Years won" text, "Years runners-up" text )
Who won the ABA Championship in 1971?
SELECT MIN("Championships") FROM table_49508 WHERE "Years won" = '1971'
wikisql
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
when did the last time patient 3369 have a potassium lab test until 20 months ago?
SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'potassium') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3369) AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '-20 m...
mimic_iii
CREATE TABLE table_name_60 ( local_name VARCHAR, network VARCHAR )
Which Local name has a Network of nova tv?
SELECT local_name FROM table_name_60 WHERE network = "nova tv"
sql_create_context
CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text ) CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text )
Show the total number from each rank
SELECT Rank, COUNT(*) FROM captain GROUP BY Rank
nvbench
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
Top 10 Users by Reputation.
SELECT * FROM Users ORDER BY Reputation DESC LIMIT 10
sede
CREATE TABLE has_allergy ( stuid number, allergy text ) CREATE TABLE allergy_type ( allergy text, allergytype text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text )
Show all student IDs who have at least two allergies.
SELECT stuid FROM has_allergy GROUP BY stuid HAVING COUNT(*) >= 2
spider
CREATE TABLE table_25427 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Opponent in the final" text, "Score in the final" text )
Who is the opponent in the match with final score 3 6, 4 6, 7 5, 4 6?
SELECT "Opponent in the final" FROM table_25427 WHERE "Score in the final" = '3–6, 4–6, 7–5, 4–6'
wikisql
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
该医院8738214在2000-02-09到2015-04-09内出现入院诊断疾病结果与出院诊断疾病结果不一致的情况有多少次
SELECT (SELECT COUNT(*) FROM t_kc21 WHERE MED_SER_ORG_NO = '8738214' AND IN_HOSP_DATE BETWEEN '2000-02-09' AND '2015-04-09') - (SELECT COUNT(*) FROM t_kc21 WHERE MED_SER_ORG_NO = '8738214' AND IN_HOSP_DATE BETWEEN '2000-02-09' AND '2015-04-09' AND IN_DIAG_DIS_CD = OUT_DIAG_DIS_CD)
css
CREATE TABLE performance ( LOCATION VARCHAR )
Show the locations that have at least two performances.
SELECT LOCATION FROM performance GROUP BY LOCATION HAVING COUNT(*) >= 2
sql_create_context
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, ...
Questions which have the given tag (including the editor who added it).
WITH firstrev_cte AS (SELECT MIN(ph.Id) AS MinId, p.Id FROM Posts AS p JOIN PostHistory AS ph ON ph.PostId = p.Id WHERE ph.Text LIKE '%<##tagName##>%' AND p.Tags LIKE '%<##tagName##>%' GROUP BY p.Id) SELECT PostId AS "post_link", url = 'site://posts/' + CAST(PostId AS TEXT) + '/revisions', UserId AS "user_link", UserDi...
sede
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 who are still alive and have had c-reactive protein lab test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.expire_flag = "0" AND lab.label = "C-Reactive Protein"
mimicsql_data
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 (...
count the number of patients diagnosed with acute diastolic heart failure who had ascitic fluid lab test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Acute diastolic heart failure" AND lab.fluid = "Ascites"
mimicsql_data
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 demographic (...
what is the discharge time and procedure for the patient id 8990?
SELECT demographic.dischtime, procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "8990"
mimicsql_data
CREATE TABLE table_name_31 ( house VARCHAR, boarding_day VARCHAR )
Which house has a Boarding/Day value of Day?
SELECT house FROM table_name_31 WHERE boarding_day = "day"
sql_create_context
CREATE TABLE table_20960 ( "Solution" text, "Other Name" text, "[Na + ](mmol/L)" real, "[Cl - ](mmol/L)" real, "[Glucose](mmol/L)" real, "[Glucose](mg/dl)" real )
Name the most glucolse where cl is 154
SELECT MAX("[Glucose](mg/dl)") FROM table_20960 WHERE "[Cl - ](mmol/L)" = '154'
wikisql
CREATE TABLE table_name_77 ( country VARCHAR, series_premiere VARCHAR )
Which country had a series that premiered on September 4, 2006?
SELECT country FROM table_name_77 WHERE series_premiere = "september 4, 2006"
sql_create_context
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
Draw a scatter chart about the correlation between Team_ID and School_ID , and group by attribute All_Neutral.
SELECT Team_ID, School_ID FROM basketball_match GROUP BY All_Neutral
nvbench
CREATE TABLE table_11649 ( "State" text, "Interview" real, "Swimsuit" real, "Evening Gown" real, "Average" real )
What is the Average for South Carolina with an Interview less than 9.626?
SELECT SUM("Average") FROM table_11649 WHERE "State" = 'south carolina' AND "Interview" < '9.626'
wikisql
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, va...
calculate the length of stay of the first stay of patient 27392 in the icu.
SELECT STRFTIME('%j', icustays.outtime) - STRFTIME('%j', icustays.intime) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27392) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1
mimic_iii
CREATE TABLE table_name_97 ( money___ INTEGER, score VARCHAR )
What was the average money when the score was 68-69-68-72=277?
SELECT AVG(money___) AS $__ FROM table_name_97 WHERE score = 68 - 69 - 68 - 72 = 277
sql_create_context
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code te...
what was the number of patients that were tested during the last year for bone marrow microbiology?
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT microbiologyevents.hadm_id FROM microbiologyevents WHERE microbiologyevents.spec_type_desc = 'bone marrow' AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year'))
mimic_iii
CREATE TABLE table_26452 ( "Name" text, "Nationality" text, "Position" text, "Appearances" real, "Starts" real, "Minutes" real, "Goals" real )
What is the most amount of goals any of the players had?
SELECT MAX("Goals") FROM table_26452
wikisql
CREATE TABLE table_262476_1 ( enrollment VARCHAR, nickname VARCHAR )
Name the enrollment for tomcats
SELECT enrollment FROM table_262476_1 WHERE nickname = "Tomcats"
sql_create_context
CREATE TABLE table_name_87 ( longitude VARCHAR, latitude VARCHAR, name VARCHAR )
Which Longitude has a Latitude of 73.0s, and a Name of aibarchin planitia?
SELECT longitude FROM table_name_87 WHERE latitude = "73.0s" AND name = "aibarchin planitia"
sql_create_context
CREATE TABLE table_10420426_1 ( team VARCHAR, series VARCHAR )
What was the team where series is formula renault 2.0 nec?
SELECT team FROM table_10420426_1 WHERE series = "Formula Renault 2.0 NEC"
sql_create_context
CREATE TABLE table_22514845_5 ( reporters VARCHAR, s_analyst VARCHAR )
Name the reporters for howard cosell
SELECT reporters FROM table_22514845_5 WHERE s_analyst = "Howard Cosell"
sql_create_context
CREATE TABLE table_24925945_3 ( previous_school VARCHAR, _number VARCHAR )
What was the previous school of #22?
SELECT previous_school FROM table_24925945_3 WHERE _number = 22
sql_create_context
CREATE TABLE table_5447 ( "Pos." real, "Car #" real, "Driver" text, "Make" text, "Team" text )
What was Stacy Compton's position?
SELECT "Pos." FROM table_5447 WHERE "Driver" = 'stacy compton'
wikisql
CREATE TABLE table_48122 ( "Date" text, "Opponent" text, "Venue" text, "Score" text, "Attendance" text, "Scorers" text )
What is the number of people in attendance when Tonbridge Angels is the opponent?
SELECT "Attendance" FROM table_48122 WHERE "Opponent" = 'tonbridge angels'
wikisql
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 demographic ...
provide the number of male patients who underwent other percutaneous procedures on biliary tract.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "M" AND procedures.long_title = "Other percutaneous procedures on biliary tract"
mimicsql_data
CREATE TABLE table_5961 ( "County" text, "Bush #" real, "Bush %" text, "Kerry #" real, "Kerry %" text, "Others #" real, "Others %" text, "Total" real )
What was the other number with 63.98% bush?
SELECT "Others #" FROM table_5961 WHERE "Bush %" = '63.98%'
wikisql
CREATE TABLE table_58495 ( "Name" text, "Years" text, "Area" text, "Authority" text, "Decile" text, "Roll" text )
What is the roll number of the school with a state authority in Waiotira?
SELECT "Roll" FROM table_58495 WHERE "Authority" = 'state' AND "Area" = 'waiotira'
wikisql
CREATE TABLE table_59932 ( "Draw" real, "Language" text, "Artist" text, "Song" text, "English translation" text, "Place" real, "Points" real )
What is the lowest draw that has We The Lovers for the english translation, with a place greater than 1?
SELECT MIN("Draw") FROM table_59932 WHERE "English translation" = 'we the lovers' AND "Place" > '1'
wikisql
CREATE TABLE table_name_37 ( record VARCHAR, date VARCHAR )
What is Record, when Date is October 31?
SELECT record FROM table_name_37 WHERE date = "october 31"
sql_create_context
CREATE TABLE table_19763199_3 ( total_votes VARCHAR, artist VARCHAR )
How many votes does Carlos Ferrer Eai have?
SELECT total_votes FROM table_19763199_3 WHERE artist = "Carlos Ferrer EAI"
sql_create_context
CREATE TABLE table_45785 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" text )
WHAT IS THE TO PAR FOR ERNIE ELS?
SELECT "To par" FROM table_45785 WHERE "Player" = 'ernie els'
wikisql
CREATE TABLE table_27973 ( "#" real, "Airdate" text, "No. of couples" real, "First couple" text, "Second couple" text, "Third couple" text, "Fourth couple" text, "Viewers (millions)" text, "ITV1 weekly ranking" real )
Who was the second couple for the episode having an ITV1 ranking of 29?
SELECT "Second couple" FROM table_27973 WHERE "ITV1 weekly ranking" = '29'
wikisql
CREATE TABLE event ( Event_ID int, Date text, Venue text, Name text, Event_Attendance int ) CREATE TABLE journalist ( journalist_ID int, Name text, Nationality text, Age text, Years_working int ) CREATE TABLE news_report ( journalist_ID int, Event_ID int, Work_Type ...
Show the different nationalities and the number of journalists of each nationality Visualize by bar chart, order y axis in descending order.
SELECT Nationality, COUNT(*) FROM journalist GROUP BY Nationality ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_30024 ( "Year" real, "Location" text, "Distance (miles)" real, "Rider Names" text, "Horse Name" text, "Best-Conditioned Horse" text )
What are all the Riders whose best-conditioned horse is Basia?
SELECT "Rider Names" FROM table_30024 WHERE "Best-Conditioned Horse" = 'Basia'
wikisql
CREATE TABLE table_name_83 ( score VARCHAR, date VARCHAR )
What was the score on 20/6/97?
SELECT score FROM table_name_83 WHERE date = "20/6/97"
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
how many patients are admitted under elective type and diagnosed with icd9 code 70703?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND diagnoses.icd9_code = "70703"
mimicsql_data
CREATE TABLE table_name_93 ( score VARCHAR, date VARCHAR )
What is Score, when Date is '2000-05-23'?
SELECT score FROM table_name_93 WHERE date = "2000-05-23"
sql_create_context
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
For the attribute ACC_Road and the sum of School_ID, show their proportion by a pie chart.
SELECT ACC_Road, SUM(School_ID) FROM basketball_match GROUP BY ACC_Road
nvbench
CREATE TABLE table_24990183_5 ( country VARCHAR, name VARCHAR )
Which country is akiko suzuki from?
SELECT country FROM table_24990183_5 WHERE name = "Akiko Suzuki"
sql_create_context
CREATE TABLE table_name_79 ( points VARCHAR, opponent VARCHAR, february VARCHAR, game VARCHAR )
How many points did the Flyers have against the New York Islanders with a February bigger than 12, and a game smaller than 60?
SELECT COUNT(points) FROM table_name_79 WHERE february > 12 AND game < 60 AND opponent = "new york islanders"
sql_create_context
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 procedures ( ...
count the number of patients whose diagnosis long title is nonspecific elevation of levels of transaminase or lactic acid dehydrogenase [ldh] and whose lab test category is hematology
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Nonspecific elevation of levels of transaminase or lactic acid dehydrogenase [LDH]" AND lab."CATEGORY" = "Hemat...
mimicsql_data
CREATE TABLE table_name_35 ( team VARCHAR, score VARCHAR )
What is the Team with a Score that is l 79 92 (ot)?
SELECT team FROM table_name_35 WHERE score = "l 79–92 (ot)"
sql_create_context
CREATE TABLE table_name_11 ( horse VARCHAR, faults VARCHAR, total VARCHAR )
Tell me the horse when the faults are 9 and the total is 46.36
SELECT horse FROM table_name_11 WHERE faults = "9" AND total = 46.36
sql_create_context
CREATE TABLE table_22068 ( "Position" real, "Club" text, "Games played" real, "Wins" real, "Draws" real, "Loses" real, "Goals scored" real, "Goals conceded" real, "Points" real )
In the game with 31 points, how many goals were conceded?
SELECT COUNT("Goals conceded") FROM table_22068 WHERE "Points" = '31'
wikisql
CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostLinks ( Id num...
ID questions to nominate for deletion.
SELECT p.Id, 'http://movies.stackexchange.com/questions/' + CAST(p.Id AS VARCHAR(20)) AS Link, p.Title, p.Score FROM Posts AS p LEFT OUTER JOIN (SELECT PostId, ROW_NUMBER() OVER (PARTITION BY PostId ORDER BY CreationDate DESC) AS rn FROM PostHistory AS ph WHERE PostHistoryTypeId = 10 AND Comment = '101') AS cdph ON p.I...
sede
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
How many patients have been diagnosed with seroma complicating a procedure and are categorized under the hematology lab test?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Seroma complicting proc" AND lab."CATEGORY" = "Hematology"
mimicsql_data