context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_procedures ( row_i...
until 4 years ago has patient 13473 received any medication?
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13473) AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-4 year')
mimic_iii
CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number ...
Are there PEDDENT courses that are 8 credit ?
SELECT DISTINCT name, number FROM course WHERE department = 'PEDDENT' AND credits = 8
advising
CREATE TABLE table_16421 ( "Condition" text, "Prothrombin time" text, "Partial thromboplastin time" text, "Bleeding time" text, "Platelet count" text )
What were the bleeding times when both the platelet count was unaffected and the partial thromboplastin time was unaffected
SELECT "Bleeding time" FROM table_16421 WHERE "Partial thromboplastin time" = 'Unaffected' AND "Platelet count" = 'Unaffected'
wikisql
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...
Number of posts in Stack Overflow that are over the 30k soft character limit.
SELECT p.Id AS "post_link", (CASE WHEN p.PostTypeId = 1 THEN 'Q' ELSE 'A' END) AS Type, p.Id, LENGTH(p.Body) AS HtmlSize, LENGTH(ph.Text) AS MarkdownSize, p.CreationDate, ph.CreationDate AS LatestRevisionDate FROM Posts AS p INNER JOIN PostHistory AS ph ON ph.PostId = p.Id LEFT OUTER JOIN PostHistory AS phb ON phb.Post...
sede
CREATE TABLE table_26914759_3 ( position_in_table VARCHAR, incoming_manager VARCHAR )
How many teams had gary megson as an incoming manager
SELECT COUNT(position_in_table) FROM table_26914759_3 WHERE incoming_manager = "Gary Megson"
sql_create_context
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, ...
在00年4月27日到07年1月1日这期间就诊于门诊中的患者被开出少于28张检验报告单的是医院4879097的哪些个科室?
SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM zzmzjzjlb JOIN jybgb ON zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE zzmzjzjlb.YLJGDM = '4879097' AND jybgb.BGRQ BETWEEN '2000-04-27' AND '2007-01-01' GROUP BY jybgb.KSBM HAVING COUNT(*) < 28 UNION SELECT jybgb.KSBM FROM fzzmzjzjlb ...
css
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 ReviewTasks ( Id number, ReviewTaskTypeId number, ...
Low quality, low hanging fruit questions.
SELECT * FROM Posts JOIN Users ON Posts.OwnerUserId = Users.Id WHERE Posts.Score = 0 AND Posts.AnswerCount > 5 AND Posts.ParentId IS NULL AND Posts.AcceptedAnswerId IS NULL AND Users.LastAccessDate < DATEADD(year, -2, GETDATE())
sede
CREATE TABLE table_2187 ( "Year" real, "Division" real, "League" text, "Regular Season" text, "Playoffs" text, "Open Cup" text )
What's the team's status in the Open Cup in 2006?
SELECT "Open Cup" FROM table_2187 WHERE "Year" = '2006'
wikisql
CREATE TABLE table_test_22 ( "id" int, "ejection_fraction_ef" int, "pregnancy_or_lactation" bool, "child_pugh_class" string, "hbv" bool, "systolic_blood_pressure_sbp" int, "active_infection" bool, "leukocyte_count" int, "hiv_infection" bool, "left_ventricular_dysfunction" bool, ...
known neutropenia, defined as < 1000 neutrophils / ml;
SELECT * FROM table_test_22 WHERE neutropenia = 1 OR neutrophil_count < 1000
criteria2sql
CREATE TABLE table_name_16 ( call_sign VARCHAR, frequency_mhz VARCHAR, erp_w VARCHAR )
What is the call sign when the frequency is less than 95.5 MHz, and a ERP W is higher than 10?
SELECT call_sign FROM table_name_16 WHERE frequency_mhz < 95.5 AND erp_w > 10
sql_create_context
CREATE TABLE table_name_24 ( player VARCHAR, wins INTEGER )
What is the name of the player with less than 2 wins?
SELECT player FROM table_name_24 WHERE wins < 2
sql_create_context
CREATE TABLE table_1974545_3 ( softball_stadium VARCHAR, school VARCHAR )
What is the name of Rhode Island College's softball stadium?
SELECT softball_stadium FROM table_1974545_3 WHERE school = "Rhode Island College"
sql_create_context
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE Comments ( Id number,...
Number of answers per user.
SELECT TOP(5000) AS owneruserid, COUNT(*) AS answer_count FROM Posts WHERE PostTypeId = 2 GROUP BY OwnerUserId ORDER BY answer_count DESC
sede
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE requirement ( ...
What are good classes to take before enrolling in BIOMEDE 580 ?
SELECT DISTINCT advisory_requirement FROM course WHERE department = 'BIOMEDE' AND number = 580
advising
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, d...
how many drugs were prescribed until 4 years ago for patient 025-50079?
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 = '025-50079')) AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME()...
eicu
CREATE TABLE table_203_547 ( id number, "ship" text, "built" number, "in service for cunard" text, "type" text, "tonnage" text, "notes" text )
what is the only cruise ship listed ?
SELECT "ship" FROM table_203_547 WHERE "type" = 'cruise'
squall
CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
count the number of patients that have been diagnosed with k. pneumoniae pneumonia but did not return to the hospital within 2 months 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 = 'k. pneumon...
mimic_iii
CREATE TABLE table_55257 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
Tell me the sum of rank for when gold is more than 0 and silver less than 23 with total more than 32
SELECT SUM("Rank") FROM table_55257 WHERE "Gold" > '0' AND "Total" > '32' AND "Silver" < '23'
wikisql
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime...
did patient 022-3713 get the vasodilating agent - iv - nitroprusside since 2105?
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-3713')) AND treatment.treatmentname = 'vasodilating agent - iv - nitropr...
eicu
CREATE TABLE table_40198 ( "Round" text, "Date" text, "Matches" real, "Clubs" text, "Prize money" text )
What is the total number of Matches, when Clubs is 588 406?
SELECT COUNT("Matches") FROM table_40198 WHERE "Clubs" = '588 → 406'
wikisql
CREATE TABLE table_name_13 ( episode_count VARCHAR, actor VARCHAR )
How many Episode Counts have an Actor of liz carr?
SELECT COUNT(episode_count) FROM table_name_13 WHERE actor = "liz carr"
sql_create_context
CREATE TABLE table_name_5 ( competition VARCHAR, year VARCHAR, venue VARCHAR )
Which Competition has a Year larger than 1990 in seville , spain?
SELECT competition FROM table_name_5 WHERE year > 1990 AND venue = "seville , spain"
sql_create_context
CREATE TABLE table_11732 ( "Year" real, "Film name" text, "Co-singer" text, "Music director" text, "Lyricist" text )
Which film was released in the year 2002?
SELECT "Film name" FROM table_11732 WHERE "Year" = '2002'
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...
门诊给患者67854437诊断为疾病N63.585,那检测指标342923的结果定量及单位是什么
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jyb...
css
CREATE TABLE table_name_22 ( rank VARCHAR, name VARCHAR )
What rank does Tricia Flores have?
SELECT rank FROM table_name_22 WHERE name = "tricia flores"
sql_create_context
CREATE TABLE table_name_98 ( outcome VARCHAR, opponent VARCHAR )
Name the outcome for opponent of micha lla krajicek eleni daniilidou
SELECT outcome FROM table_name_98 WHERE opponent = "michaëlla krajicek eleni daniilidou"
sql_create_context
CREATE TABLE table_204_823 ( id number, "dates" text, "location" text, "attendance" text, "official guests" text, "notes" text )
how many times was the rosemont convention center used ?
SELECT COUNT(*) FROM table_204_823 WHERE "location" = 'rosemont convention center'
squall
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 male patients had the diagnoses titled pseudomonas infect nos?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.short_title = "Pseudomonas infect NOS"
mimicsql_data
CREATE TABLE editor ( Editor_ID int, Name text, Age real ) CREATE TABLE journal ( Journal_ID int, Date text, Theme text, Sales int ) CREATE TABLE journal_committee ( Editor_ID int, Journal_ID int, Work_Type text )
A bar chart for showing the number of the names of editors that are on the committee of journals with sales bigger than 3000.
SELECT Name, COUNT(Name) FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T3.Sales > 3000 GROUP BY Name
nvbench
CREATE TABLE table_7477 ( "LastDays begin" text, "Startof Christ's Presence" text, "Christ madeKing" text, "Resurrection of144,000" text, "Judgmentof Religion" text, "Separating Sheep &Goats" text, "Great Tribulation" text )
What was the Christ made king date with a great tribulation in 1925?
SELECT "Christ madeKing" FROM table_7477 WHERE "Great Tribulation" = '1925'
wikisql
CREATE TABLE table_45764 ( "Game" real, "Date" text, "Team" text, "Score" text, "Record" text, "Streak" text )
What was the record on January 4?
SELECT "Record" FROM table_45764 WHERE "Date" = 'january 4'
wikisql
CREATE TABLE table_204_690 ( id number, "election" number, "party name" text, "total votes" number, "share of votes" text, "seats" number, "share of seats" text, "party leader(s)" text, "notes" text )
how many times was jan steytler the party leader ?
SELECT COUNT(*) FROM table_204_690 WHERE "party leader(s)" = 'jan steytler'
squall
CREATE TABLE table_57747 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
When the Away team score equaled 15.20 (110) what was the Date of the game?
SELECT "Date" FROM table_57747 WHERE "Away team score" = '15.20 (110)'
wikisql
CREATE TABLE table_72337 ( "Colt model no." text, "Name" text, "Stock" text, "Fire control" text, "Rear sight" text, "Forward assist" text, "Case deflector" text, "Barrel length" text, "Barrel profile" text, "Barrel twist" text, "Hand guards" text, "Bayonet Lug" text, ...
What's the type of muzzle devices on the models with round hand guards?
SELECT "Muzzle device" FROM table_72337 WHERE "Hand guards" = 'Round'
wikisql
CREATE TABLE table_name_15 ( date VARCHAR, away VARCHAR )
What is the Date with an Away that is central blues?
SELECT date FROM table_name_15 WHERE away = "central blues"
sql_create_context
CREATE TABLE table_name_36 ( higher_harmonics VARCHAR, speed VARCHAR )
Which higher harmonics have a speed of 0.0821373?
SELECT higher_harmonics FROM table_name_36 WHERE speed = "0.0821373"
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, ...
在医院5335029中病人45006665看病的科室名称中含有准分子的所有医疗就诊记录都啥啊?
SELECT * FROM t_kc21 WHERE t_kc21.PERSON_ID = '45006665' AND t_kc21.MED_SER_ORG_NO = '5335029' AND t_kc21.MED_ORG_DEPT_NM LIKE '%准分子%'
css
CREATE TABLE table_5614 ( "Rank" real, "Airline" text, "2012" real, "2011" real, "2010" real, "2009" real )
The lowest rank with 2011 less than 80.7 and 2012 less than 73.1 is what?
SELECT MIN("Rank") FROM table_5614 WHERE "2011" < '80.7' AND "2012" < '73.1'
wikisql
CREATE TABLE table_54908 ( "From" text, "Adult Rate" text, "Development Rate" text, "16-17 Year Olds Rate" text, "Apprentice Rate" text )
When was the rate for 16-17 year olds 3.40?
SELECT "From" FROM table_54908 WHERE "16-17 Year Olds Rate" = '£3.40'
wikisql
CREATE TABLE rooms ( roomid text, roomname text, beds number, bedtype text, maxoccupancy number, baseprice number, decor text ) CREATE TABLE reservations ( code number, room text, checkin text, checkout text, rate number, lastname text, firstname text, adults...
How many rooms are there?
SELECT COUNT(*) FROM rooms
spider
CREATE TABLE table_name_49 ( date VARCHAR, score VARCHAR )
Name the date with score of 9-2
SELECT date FROM table_name_49 WHERE score = "9-2"
sql_create_context
CREATE TABLE table_17704 ( "Year" real, "Total Region" real, "Biggenden" real, "Eidsvold" real, "Gayndah" real, "Monto" real, "Mundubbera" real, "Perry" real )
What is the biggended for 1947?
SELECT MAX("Biggenden") FROM table_17704 WHERE "Year" = '1947'
wikisql
CREATE TABLE shop ( shop_id number, shop_name text, location text, open_date text, open_year number ) CREATE TABLE device ( device_id number, device text, carrier text, package_version text, applications text, software_platform text ) CREATE TABLE stock ( shop_id number...
Which locations contains both shops that opened after the year 2012 and shops that opened before 2008?
SELECT location FROM shop WHERE open_year > 2012 INTERSECT SELECT location FROM shop WHERE open_year < 2008
spider
CREATE TABLE table_64292 ( "Year" real, "Political Rights" real, "Civil Liberties" real, "Status" text, "President" text )
What is the year average when not free was the status, and less than 7 was the civil liberties, and less than 6 political rights?
SELECT AVG("Year") FROM table_64292 WHERE "Status" = 'not free' AND "Civil Liberties" < '7' AND "Political Rights" < '6'
wikisql
CREATE TABLE table_203_160 ( id number, "rank" number, "heat" number, "nation" text, "competitors" text, "time" text, "notes" text )
what was the total time by france ?
SELECT "time" FROM table_203_160 WHERE "nation" = 'france'
squall
CREATE TABLE table_name_13 ( tries_for VARCHAR, points_against VARCHAR )
How many tries for does the team with 263 points against have?
SELECT tries_for FROM table_name_13 WHERE points_against = "263"
sql_create_context
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate...
Get list of prospective answerers for a set of 3 Tags : Before a certain Post's CreationDate.
SELECT ParentId, Id, OwnerUserId FROM Posts WHERE ParentId IN (SELECT PostId FROM PostTags WHERE TagId = '5990' INTERSECT SELECT PostId FROM PostTags WHERE TagId = '16' INTERSECT SELECT PostId FROM PostTags WHERE TagId = '12408') AND CreationDate < (SELECT CreationDate FROM Posts WHERE Id = '9299346') ORDER BY ParentId
sede
CREATE TABLE table_28071 ( "Player" text, "Touchdowns" real, "Extra points" real, "Field goals" real, "Points" real )
How many touchdowns did the player with 10 points have?
SELECT MIN("Touchdowns") FROM table_28071 WHERE "Points" = '10'
wikisql
CREATE TABLE table_name_39 ( type VARCHAR, state VARCHAR, royal_house VARCHAR, name VARCHAR )
What type of state was Lu, when Yi was the ruler from the royal house of Ji?
SELECT type FROM table_name_39 WHERE royal_house = "ji" AND name = "yi" AND state = "lu"
sql_create_context
CREATE TABLE dorm ( dormid number, dorm_name text, student_capacity number, gender text ) CREATE TABLE has_amenity ( dormid number, amenid number ) CREATE TABLE lives_in ( stuid number, dormid number, room_number number ) CREATE TABLE student ( stuid number, lname text, ...
What are the first names of all students who live in the dorm with the most amenities?
SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T2.dormid FROM dorm AS T3 JOIN has_amenity AS T4 ON T3.dormid = T4.dormid JOIN dorm_amenity AS T5 ON T4.amenid = T5.amenid GROUP BY T3.dormid ORDER BY COUNT(*) DESC LIMIT 1)
spider
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE SuggestedEdits ( Id number, Pos...
Month wise number of answers by User.
SELECT DATENAME(month, DATEADD(month, MONTH(CreationDate), -1)) AS "month", YEAR(CreationDate) AS "year", COUNT(Id) AS Answers FROM Posts WHERE OwnerUserId = '##UserId##' AND PostTypeId = 2 GROUP BY MONTH(CreationDate), YEAR(CreationDate) ORDER BY YEAR(CreationDate), MONTH(CreationDate)
sede
CREATE TABLE table_name_3 ( opponents VARCHAR, wicket_partnership VARCHAR )
Who was the opponents of the 5th Wicket Partnership?
SELECT opponents FROM table_name_3 WHERE wicket_partnership = "5th"
sql_create_context
CREATE TABLE table_name_34 ( call_sign VARCHAR, format VARCHAR, frequency VARCHAR )
What is the call sign for country station fm 93.1?
SELECT call_sign FROM table_name_34 WHERE format = "country" AND frequency = "fm 93.1"
sql_create_context
CREATE TABLE table_1672976_2 ( wins INTEGER, institution VARCHAR )
How many wins did the Northwestern Wildcats?
SELECT MAX(wins) FROM table_1672976_2 WHERE institution = "Northwestern Wildcats"
sql_create_context
CREATE TABLE table_name_29 ( goals VARCHAR, Game VARCHAR, appearances VARCHAR )
Which goals/game ratio has fewer than 201 goals and fewer than 170 appearances?
SELECT goals / Game AS Ratio FROM table_name_29 WHERE goals < 201 AND appearances < 170
sql_create_context
CREATE TABLE table_name_60 ( opponent VARCHAR, result VARCHAR )
Who was the opponent at the game with a result of w 14 6?
SELECT opponent FROM table_name_60 WHERE result = "w 14–6"
sql_create_context
CREATE TABLE table_name_46 ( year INTEGER, chassis VARCHAR )
What is the year when kurtis kraft 500f was the chassis?
SELECT SUM(year) FROM table_name_46 WHERE chassis = "kurtis kraft 500f"
sql_create_context
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 diagnoses short title is malig neo ascend colon?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Malig neo ascend colon"
mimicsql_data
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...
根据不同的出院诊断疾病编码和科室编码,列出所有医疗就诊记录在医院5248115中患者平均是多大年龄?
SELECT qtb.MED_ORG_DEPT_CD, qtb.OUT_DIAG_DIS_CD, AVG(qtb.PERSON_AGE) FROM qtb WHERE qtb.MED_SER_ORG_NO = '5248115' GROUP BY qtb.MED_ORG_DEPT_CD, qtb.OUT_DIAG_DIS_CD UNION SELECT gyb.MED_ORG_DEPT_CD, gyb.OUT_DIAG_DIS_CD, AVG(gyb.PERSON_AGE) FROM gyb WHERE gyb.MED_SER_ORG_NO = '5248115' GROUP BY gyb.MED_ORG_DEPT_CD, gyb....
css
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
what is the number of patients whose insurance is private and treated with procedure icd9 code 8848?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.icd9_code = "8848"
mimicsql_data
CREATE TABLE table_name_30 ( country VARCHAR, film_title_used_in_nomination VARCHAR )
Where was the film about the garden of the finzi-continis made?
SELECT country FROM table_name_30 WHERE film_title_used_in_nomination = "the garden of the finzi-continis"
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( ...
what were the five medicines most frequently prescribed since 2102?
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE STRFTIME('%y', medication.drugstarttime) >= '2102' GROUP BY medication.drugname) AS t1 WHERE t1.c1 <= 5
eicu
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 procedures ( ...
Out of total number of patients admitted before the year 2150, how many of them had hemodialysis?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2150" AND procedures.long_title = "Hemodialysis"
mimicsql_data
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, ...
知道40049431病人的检验报告单对应的检验结果指标均正常的检验报告单号吗
SELECT jybgb.BGDH FROM hz_info JOIN zzmzjzjlb JOIN jybgb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '40049431' AND NOT jybgb.BGDH IN (SELECT jyjgzbb.BGDH FRO...
css
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, ...
在患者邹宏富的医疗记录中,查一下医疗费总额高过6492.34元的入院诊断疾病名和编码
SELECT t_kc21.OUT_DIAG_DIS_CD, t_kc21.OUT_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_NM = '邹宏富' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 6492.34)
css
CREATE TABLE table_name_81 ( tonnage VARCHAR, date VARCHAR, ship VARCHAR )
Name Tonnage on 27 september 1941 and a Ship of hmsspringbank?
SELECT tonnage FROM table_name_81 WHERE date = "27 september 1941" AND ship = "hmsspringbank"
sql_create_context
CREATE TABLE table_68277 ( "Value" text, "Khmer" text, "Word form" text, "UNGEGN" text, "ALA-LC" text, "Notes" text )
what's the ungegn for the khmer?
SELECT "UNGEGN" FROM table_68277 WHERE "Khmer" = '១០០'
wikisql
CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
在门诊一年里参保人吴诗兰花费了多少医疗费?
SELECT SUM(t_kc21.MED_AMOUT) FROM t_kc21 WHERE t_kc21.PERSON_NM = '吴诗兰' AND t_kc21.CLINIC_TYPE = '门诊'
css
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 locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(...
Give the name of each department and the number of employees in each in a bar chart.
SELECT DEPARTMENT_NAME, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID GROUP BY T2.DEPARTMENT_NAME
nvbench
CREATE TABLE table_40295 ( "Year" real, "Award" text, "Category" text, "Nominee" text, "Result" text )
Which nominee was nominated in the Outstanding Director of a Musical category?
SELECT "Nominee" FROM table_40295 WHERE "Category" = 'outstanding director of a musical'
wikisql
CREATE TABLE table_20649 ( "Province" text, "Map #" real, "ISO 3166-2:AF" text, "Centers" text, "Population" real, "Area (km\u00b2)" real, "Language" text, "Notes" text, "U.N. Region" text )
Name the un region for 3314000 population
SELECT "U.N. Region" FROM table_20649 WHERE "Population" = '3314000'
wikisql
CREATE TABLE table_name_95 ( opponents VARCHAR, year VARCHAR, progress VARCHAR )
What were the Opponents of the team, that made it to the third round, before 2008?
SELECT opponents FROM table_name_95 WHERE year < 2008 AND progress = "third round"
sql_create_context
CREATE TABLE endowment ( endowment_id int, School_id int, donator_name text, amount real ) CREATE TABLE School ( School_id text, School_name text, Location text, Mascot text, Enrollment int, IHSAA_Class text, IHSAA_Football_Class text, County text ) CREATE TABLE budget ...
Please give me a bar chart for the total enrollment in each county, and order by the sum enrollment in desc.
SELECT County, SUM(Enrollment) FROM School GROUP BY County ORDER BY SUM(Enrollment) DESC
nvbench
CREATE TABLE courses ( course_id text, course_name text, course_description text, other_details text ) CREATE TABLE student_course_attendance ( student_id number, course_id number, date_of_attendance time ) CREATE TABLE people ( person_id number, first_name text, middle_name te...
For each course id, how many students are registered and what are the course names?
SELECT T3.course_name, COUNT(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id
spider
CREATE TABLE table_204_757 ( id number, "state" text, "interview" number, "swimsuit" number, "evening gown" number, "average" number )
how many average scores were below 8.700 ?
SELECT COUNT(*) FROM table_204_757 WHERE "average" < 8.700
squall
CREATE TABLE table_name_31 ( year VARCHAR, engine VARCHAR )
Which year has has a Engine of maserati straight-6?
SELECT COUNT(year) FROM table_name_31 WHERE engine = "maserati straight-6"
sql_create_context
CREATE TABLE table_203_600 ( id number, "rank" text, "country" text, "winners" number, "runners-up" number, "finals total" number )
which country came in first place ?
SELECT "country" FROM table_203_600 WHERE "rank" = 1
squall
CREATE TABLE table_12121 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
When Cementarnica is team 2 what is the aggregate score?
SELECT "Agg." FROM table_12121 WHERE "Team 2" = 'cementarnica'
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...
医院9671663中根据出院诊断疾病的名称不同疾病的平均患者年龄分别是多大啊?
SELECT OUT_DIAG_DIS_NM, AVG(PERSON_AGE) FROM t_kc21 WHERE MED_SER_ORG_NO = '9671663' GROUP BY OUT_DIAG_DIS_NM
css
CREATE TABLE table_name_91 ( indoor_track VARCHAR, tennis VARCHAR, golf VARCHAR )
What is the indoor track status for the school that has yes for tennis and no for golf?
SELECT indoor_track FROM table_name_91 WHERE tennis = "yes" AND golf = "no"
sql_create_context
CREATE TABLE Invoice_Line_Items ( order_item_id INTEGER, invoice_number INTEGER, product_id INTEGER, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19,4), derived_product_cost DECIMAL(19,4), derived_vat_payable DECIMAL(19,4), derived_total_cost DECIMAL...
Visualize a bar chart for what are total transaction amounts for each transaction type?, rank by the y-axis in descending.
SELECT transaction_type, SUM(transaction_amount) FROM Financial_Transactions GROUP BY transaction_type ORDER BY SUM(transaction_amount) DESC
nvbench
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
provide the number of patients whose marital status is married and diagnoses long title is acute on chronic diastolic heart failure?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "MARRIED" AND diagnoses.long_title = "Acute on chronic diastolic heart failure"
mimicsql_data
CREATE TABLE table_46105 ( "Rider" text, "Manufacturer" text, "Laps" real, "Time/Retired" text, "Grid" real )
Which lap has more than 17 grids with tetsuya harada?
SELECT "Laps" FROM table_46105 WHERE "Grid" > '17' AND "Rider" = 'tetsuya harada'
wikisql
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...
在0三年九月三十日到一五年二月四日这段时间内,医院8063652门诊看病的病人共有多少
SELECT COUNT(*) FROM mzb WHERE mzb.MED_TYPE = '8063652' AND mzb.IN_HOSP_DAYS BETWEEN '2003-09-30' AND '2015-02-04'
css
CREATE TABLE table_46797 ( "Reserve" text, "District" text, "IUCN" text, "Co-management" text, "Est." real, "Description" text )
Which district has an IUCN of iii and was established in 1998?
SELECT "District" FROM table_46797 WHERE "IUCN" = 'iii' AND "Est." = '1998'
wikisql
CREATE TABLE table_name_45 ( overall INTEGER, round VARCHAR, name VARCHAR )
In Round 10, what was the Overall for Ed Tomlin?
SELECT AVG(overall) FROM table_name_45 WHERE round = 10 AND name = "ed tomlin"
sql_create_context
CREATE TABLE table_name_35 ( home_team VARCHAR, year VARCHAR, venue VARCHAR )
Which Home team has a Year of 2002/03, and a Venue of tahnoun bin mohamed stadium?
SELECT home_team FROM table_name_35 WHERE year = "2002/03" AND venue = "tahnoun bin mohamed stadium"
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, ...
count the number of patients whose lab test name is rbc, joint fluid?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "RBC, Joint Fluid"
mimicsql_data
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...
在2012年8月24日到2020年5月4日内病人尤云霞被开出的所有检验报告单的检验报告单号都有哪些?
SELECT jybgb.BGDH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb 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 = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = '尤云霞' AND jybg...
css
CREATE TABLE table_51002 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
Who was the opponent before week 8 when the result was l 28-17?
SELECT "Opponent" FROM table_51002 WHERE "Week" < '8' AND "Result" = 'l 28-17'
wikisql
CREATE TABLE table_name_33 ( played VARCHAR, goals_conceded VARCHAR, goals_scored VARCHAR, draw VARCHAR )
When goals scored is more than 18, draw is less than 4, and goals conceded is more than 24, what is the sum of played?
SELECT COUNT(played) FROM table_name_33 WHERE goals_scored > 18 AND draw < 4 AND goals_conceded > 24
sql_create_context
CREATE TABLE Ref_Address_Types ( address_type_code VARCHAR(15), address_type_description VARCHAR(80) ) CREATE TABLE Assessment_Notes ( notes_id INTEGER, student_id INTEGER, teacher_id INTEGER, date_of_notes DATETIME, text_of_notes VARCHAR(255), other_details VARCHAR(255) ) CREATE TABLE...
Find the number of the dates of assessment notes for students with first name 'Fanny', and display total number from high to low order.
SELECT date_of_notes, COUNT(date_of_notes) FROM Assessment_Notes AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.first_name = "Fanny" ORDER BY COUNT(date_of_notes) DESC
nvbench
CREATE TABLE table_19908313_2 ( _number VARCHAR, listed_owner_s_ VARCHAR )
What number truck is owned by Stephen Germain?
SELECT _number FROM table_19908313_2 WHERE listed_owner_s_ = "Stephen Germain"
sql_create_context
CREATE TABLE table_name_46 ( variant_id VARCHAR )
Which 5 UTR splice has a Variant ID at sftpa1 variant 2?
SELECT 5 AS ’utr_splice FROM table_name_46 WHERE variant_id = "sftpa1 variant 2"
sql_create_context
CREATE TABLE table_27734286_7 ( high_points VARCHAR, date VARCHAR )
How many games did they play on january 7?
SELECT COUNT(high_points) FROM table_27734286_7 WHERE date = "January 7"
sql_create_context
CREATE TABLE table_name_89 ( polling_firm VARCHAR, green VARCHAR, date_of_polling VARCHAR )
What june 21 22, 2011 polling has green smaller than 13?
SELECT polling_firm FROM table_name_89 WHERE green < 13 AND date_of_polling = "june 21–22, 2011"
sql_create_context
CREATE TABLE table_56169 ( "Rd #" real, "Pick #" real, "Player" text, "Team (League)" text, "Reg GP" real, "Pl GP" real )
What is the sum of the number of regular games played by Morgan Clark with the number of road games less than 7?
SELECT SUM("Reg GP") FROM table_56169 WHERE "Player" = 'morgan clark' AND "Rd #" < '7'
wikisql
CREATE TABLE table_name_85 ( away_team VARCHAR, tie_no VARCHAR, home_team VARCHAR )
Which away team played against Peterborough United, with a tie no of replay?
SELECT away_team FROM table_name_85 WHERE tie_no = "replay" AND home_team = "peterborough united"
sql_create_context
CREATE TABLE table_name_14 ( bronze INTEGER, silver VARCHAR, total VARCHAR )
What is the total number of bronze medals when the silver is greater than 0, and the total medals 5?
SELECT SUM(bronze) FROM table_name_14 WHERE silver > 0 AND total = 5
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions...
How many patients of american indian/alaska native ethnicity are diagnosed with unspecified erythematous condition?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND diagnoses.long_title = "Unspecified erythematous condition"
mimicsql_data