context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_20058 ( "Position" real, "Team" text, "Points" real, "Played" real, "Won" real, "Drawn" real, "Lost" real, "For" real, "Against" real, "Difference" text )
Name the most against for minas gerais
SELECT MAX("Against") FROM table_20058 WHERE "Team" = 'Minas Gerais'
wikisql
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE...
tell me the maximum hospital cost that includes c.a.t. scan of thorax this year?
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'c.a.t. scan of thorax')) AND DATETIME(cost.chargetime, 's...
mimic_iii
CREATE TABLE Order_Items ( order_item_id INTEGER, order_id INTEGER, product_id INTEGER, order_quantity VARCHAR(80) ) CREATE TABLE Customers ( customer_id INTEGER, payment_method_code VARCHAR(15), customer_number VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), ...
Show the total number from each state province county, and list in desc by the the total number .
SELECT state_province_county, COUNT(*) FROM Addresses GROUP BY state_province_county ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_75661 ( "Rank" real, "Municipality" text, "Province" text, "Status" text, "Area (km 2 )" real )
What is the highest Area (KM 2) for the Province of Ontario, that has the Status of Town, a Municipality of Minto, and a Rank that's smaller than 84?
SELECT MAX("Area (km 2 )") FROM table_75661 WHERE "Province" = 'ontario' AND "Status" = 'town' AND "Municipality" = 'minto' AND "Rank" < '84'
wikisql
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswer...
WHO'S YOUR BIGGEST FAN? (Who's favourite'd your posts the most?). (includes fav's on your questions) and (fav's on questions after you answered them) including you fav'ing your own posts. QUERY HAS 2 TABS: Tab#1 = Summary, Tab#2 = Detail, Tab#3 + CHART = Fav's by month/year, Tab#4 = Fav's by Type
SELECT CASE WHEN p.OwnerUserId = v.UserId THEN 'You fav''d your own Q' ELSE 'User fav''d your question' END AS "type", v.CreationDate, p.OwnerUserId, v.UserId, v.PostId FROM Votes AS v LEFT OUTER JOIN Posts AS p ON v.PostId = p.Id WHERE p.OwnerUserId = '##UserID##' AND VoteTypeId = 5 UNION SELECT CASE WHEN p.OwnerUserI...
sede
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( ...
how many patients survived and were diagnosed with icd9 code 5680?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "1" AND diagnoses.icd9_code = "5680"
mimicsql_data
CREATE TABLE table_6990 ( "Administrative Panel" real, "Agricultural Panel" real, "Cultural and Educational Panel" real, "Industrial and Commercial Panel" real, "Labour Panel" real, "National University of Ireland" real, "University of Dublin" real, "Nominated by the Taoiseach" real, ...
What is the highest labour panel value with a cultural and educational panel greater than 1, a University of Dublin value greater than 0, and a total value less than 60?
SELECT MAX("Labour Panel") FROM table_6990 WHERE "Cultural and Educational Panel" > '1' AND "University of Dublin" > '0' AND "Total" < '60'
wikisql
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 ) ...
how many patients had the diagnosis short title hyp ht dis nos w ht fail?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Hyp ht dis NOS w ht fail"
mimicsql_data
CREATE TABLE school_bus ( School_ID int, Driver_ID int, Years_Working int, If_full_time bool ) CREATE TABLE school ( School_ID int, Grade text, School text, Location text, Type text ) CREATE TABLE driver ( Driver_ID int, Name text, Party text, Home_city text, Ag...
Compare the average age of drivers from the same home city with a bar chart, sort in descending by the X.
SELECT Home_city, AVG(Age) FROM driver GROUP BY Home_city ORDER BY Home_city DESC
nvbench
CREATE TABLE zyjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, ...
门诊诊断的患者为疾病H19.777的促甲状腺激素数值的平均值是多少?最值是多少?
SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM mzjzjlb JOIN zyjybgb JOIN jyjgzbb ON mzjzjlb.YLJGDM = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZJZJLB AND zyjybgb.YLJGDM = jyjgzbb.YLJGDM AND zyjybgb.BGDH = jyjgzbb.BGDH WHERE mzjzjlb.JZZDBM = 'H19.777' AND jyjgzbb.JCZBMC =...
css
CREATE TABLE ftxmzjzjlb ( 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, MZZYZD...
22021171患者被门诊诊断为混合性焦虑障碍,查看他的检测指标074536的结果定量及其单位
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jyb...
css
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeI...
Top bounty givers on IPS.
SELECT SUM(v.BountyAmount) AS TotalBounty, MAX(u.DisplayName) FROM Votes AS v INNER JOIN Users AS u ON v.UserId = u.Id WHERE v.VoteTypeId = 8 GROUP BY (u.Id) ORDER BY TotalBounty DESC LIMIT 100
sede
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE job_history ( EMPLOYEE...
For those employees who do not work in departments with managers that have ids between 100 and 200, a scatter chart shows the correlation between employee_id and manager_id .
SELECT EMPLOYEE_ID, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
nvbench
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...
00年7月25日-19年6月25日,患者柳庆雪的768438指标情况
SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb 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 AND jybgb.YLJGDM = jyjgzbb.YLJGDM...
css
CREATE TABLE accounts ( account_id number, statement_id number, account_details text ) CREATE TABLE statements ( statement_id number, statement_details text ) CREATE TABLE documents_with_expenses ( document_id number, budget_type_code text, document_details text ) CREATE TABLE project...
Give the budget type code that is most common among documents with expenses.
SELECT budget_type_code FROM documents_with_expenses GROUP BY budget_type_code ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE table_41375 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
What was the first leg score for the match that had AS Police as team 2?
SELECT "1st leg" FROM table_41375 WHERE "Team 2" = 'as police'
wikisql
CREATE TABLE table_16220 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Stadium" text, "Record" text, "Attendance" real )
How many weeks are there that include the date October 11, 1969.
SELECT COUNT("Week") FROM table_16220 WHERE "Date" = 'October 11, 1969'
wikisql
CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE course ( course_id int, name varchar, dep...
Do all of the upper-level classes count for 13 credits ?
SELECT COUNT(*) = 0 FROM course, program_course WHERE course.credits <> 13 AND course.department = 'EECS' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id
advising
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, ...
for patients who were prescribed pancrease, what were the four most frequently prescribed drugs at the same time in the last year?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'pancrease' AND DATETIME(prescriptions.startdate, 'start of year')...
mimic_iii
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...
what are the four most frequently prescribed medicines?
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication GROUP BY medication.drugname) AS t1 WHERE t1.c1 <= 4
eicu
CREATE TABLE table_58210 ( "Player" text, "Height" text, "School" text, "Hometown" text, "College" text, "NBA Draft" text )
What is the NBA draft result of Dwayne Washington?
SELECT "NBA Draft" FROM table_58210 WHERE "Player" = 'dwayne washington'
wikisql
CREATE TABLE table_32022 ( "Week #" real, "Finalists" text, "Status" text, "Eliminated" text, "Date" text )
Tell me the finalists for week # less than 2
SELECT "Finalists" FROM table_32022 WHERE "Week #" < '2'
wikisql
CREATE TABLE table_name_28 ( tournament VARCHAR )
What is the 2010 value for the Australian Open?
SELECT 2010 FROM table_name_28 WHERE tournament = "australian open"
sql_create_context
CREATE TABLE table_name_45 ( são_paulo_career VARCHAR, name VARCHAR, appearances VARCHAR, goals VARCHAR )
WHAT SAN PAULO CAREER HAD SMALLER THAN 201 APPEARANCES, SMALLER THAN 2 GOALS, AND FOR RICARDO ROCHA?
SELECT são_paulo_career FROM table_name_45 WHERE appearances < 201 AND goals < 2 AND name = "ricardo rocha"
sql_create_context
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName te...
Programming languages trends (python as a single language).
SELECT YEAR(p.CreationDate), COUNT(DISTINCT p.Id) AS total FROM Posts AS p JOIN PostTags AS pTags ON pTags.PostId = p.Id JOIN Tags AS t ON t.Id = pTags.TagId WHERE p.AnswerCount + p.CommentCount > 0 GROUP BY YEAR(p.CreationDate)
sede
CREATE TABLE table_28332 ( "Frequency (Hz)" text, "R (\u03a9/km)" text, "L (mH/km)" text, "G (\u03bcS/km)" text, "C (nF/km)" text )
what is the c (nf/km) when the l (mh/km) is 0.6099?
SELECT "C (nF/km)" FROM table_28332 WHERE "L (mH/km)" = '0.6099'
wikisql
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,...
# of users with rep > amount, active recently.
SELECT SUM(IIF(DATEDIFF(DAY, u.LastAccessDate, GETDATE()) <= 7, 1, 0)) AS Days7, SUM(IIF(DATEDIFF(DAY, u.LastAccessDate, GETDATE()) <= 14, 1, 0)) AS Days14, SUM(IIF(DATEDIFF(DAY, u.LastAccessDate, GETDATE()) <= 30, 1, 0)) AS Days30, SUM(IIF(DATEDIFF(DAY, u.LastAccessDate, GETDATE()) <= 90, 1, 0)) AS Days90, SUM(IIF(DAT...
sede
CREATE TABLE table_23285849_10 ( score VARCHAR, high_rebounds VARCHAR )
When aaron afflalo (9) has the highest amount of rebounds what is the score?
SELECT score FROM table_23285849_10 WHERE high_rebounds = "Aaron Afflalo (9)"
sql_create_context
CREATE TABLE church ( Church_ID int, Name text, Organized_by text, Open_Date int, Continuation_of text ) CREATE TABLE wedding ( Church_ID int, Male_ID int, Female_ID int, Year int ) CREATE TABLE people ( People_ID int, Name text, Country text, Is_Male text, Age ...
Show all countries and the number of people from each country, and display bar in descending order.
SELECT Country, COUNT(*) FROM people GROUP BY Country ORDER BY Country DESC
nvbench
CREATE TABLE festival_detail ( Festival_ID int, Festival_Name text, Chair_Name text, Location text, Year int, Num_of_Audience int ) CREATE TABLE artwork ( Artwork_ID int, Type text, Name text ) CREATE TABLE nomination ( Artwork_ID int, Festival_ID int, Result text )
Show the ids and names of festivals that have at least two nominations for artworks by a bar chart, rank in desc by the x-axis please.
SELECT T3.Festival_Name, T1.Festival_ID FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID ORDER BY T3.Festival_Name DESC
nvbench
CREATE TABLE table_39547 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
How many total gold medals did Australia receive?
SELECT COUNT("Gold") FROM table_39547 WHERE "Nation" = 'australia'
wikisql
CREATE TABLE table_73763 ( "Branding" text, "Callsign" text, "Channel" text, "Power (kW)" text, "Coverage" text )
What's the power output for channel tv-29?
SELECT "Power (kW)" FROM table_73763 WHERE "Channel" = 'TV-29'
wikisql
CREATE TABLE table_13042 ( "Average population (x 1000)" real, "Live births" text, "Deaths" text, "Natural change" text, "Crude birth rate (per 1000)" real, "Crude death rate (per 1000)" real, "Natural change (per 1000)" real )
What is the natural change when crude death rate is more than 13.2, deaths are 4 321 and natural change is 10.6?
SELECT "Natural change" FROM table_13042 WHERE "Crude death rate (per 1000)" > '13.2' AND "Natural change (per 1000)" = '10.6' AND "Deaths" = '4 321'
wikisql
CREATE TABLE table_name_30 ( date VARCHAR, home_team VARCHAR )
What date had the home team as brentford?
SELECT date FROM table_name_30 WHERE home_team = "brentford"
sql_create_context
CREATE TABLE table_name_56 ( points INTEGER, lost VARCHAR, played VARCHAR )
What is the average points for a team that lost 4 and played more than 28 games?
SELECT AVG(points) FROM table_name_56 WHERE lost = 4 AND played > 28
sql_create_context
CREATE TABLE table_79737 ( "Number" real, "Builder" text, "Built" text, "Rebuilt" text, "Name as rebuilt" text, "Scrapped/Sold" text )
Which Rebuilt has a Builder of derby, and a Name as rebuilt of ben madigan?
SELECT "Rebuilt" FROM table_79737 WHERE "Builder" = 'derby' AND "Name as rebuilt" = 'ben madigan'
wikisql
CREATE TABLE table_23215145_2 ( total_points VARCHAR )
If the total points is 5, what is the 2005-2006 points total number?
SELECT COUNT(2005 AS _06_points) FROM table_23215145_2 WHERE total_points = 5
sql_create_context
CREATE TABLE table_34507 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
Name the attendance with result of t 14-14
SELECT "Attendance" FROM table_34507 WHERE "Result" = 't 14-14'
wikisql
CREATE TABLE table_56128 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the away team score at kardinia park?
SELECT "Away team score" FROM table_56128 WHERE "Venue" = 'kardinia park'
wikisql
CREATE TABLE table_name_19 ( figures INTEGER, free INTEGER )
What was the average figure score of the skater with a free score under 56.35?
SELECT AVG(figures) FROM table_name_19 WHERE free < 56.35
sql_create_context
CREATE TABLE table_11677100_3 ( position VARCHAR, player VARCHAR )
What position does Kerry Wood play in?
SELECT position FROM table_11677100_3 WHERE player = "Kerry Wood"
sql_create_context
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, chartti...
tell me the total amount of patient 18316's output on 11/16/2103.
SELECT SUM(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18316)) AND STRFTIME('%y-%m-%d', outputevents.charttime) = '2103-11-16'
mimic_iii
CREATE TABLE table_name_30 ( opposing_team VARCHAR, status VARCHAR )
What was the opposing team for the second test?
SELECT opposing_team FROM table_name_30 WHERE status = "second test"
sql_create_context
CREATE TABLE table_19651669_1 ( champion VARCHAR, season VARCHAR )
Who was the champion for the 1998-99 season?
SELECT champion FROM table_19651669_1 WHERE season = "1998-99"
sql_create_context
CREATE TABLE table_50599 ( "Rank" real, "Team" text, "Played" real, "Wins" real, "Ties" real, "Losses" real, "Goals For" real, "Goals Against" real, "Points" real )
What is the average losses for 22 goals?
SELECT AVG("Losses") FROM table_50599 WHERE "Goals For" > '22'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
how many of the patients transfered from hosp/extram had a lab test for total iron binding capacity?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND lab.label = "Iron Binding Capacity, Total"
mimicsql_data
CREATE TABLE table_75329 ( "Rank" real, "Island's Name" text, "Area (sqmi)" real, "Area (km 2 )" real, "Location" text, "Population (2000)" text )
What is the largest rank with 2,080 area?
SELECT MAX("Rank") FROM table_75329 WHERE "Area (sqmi)" = '2,080'
wikisql
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
患者赵嘉怡在二0一一年九月五日到二0一八年一月十日期间,总共医治过几种病
SELECT COUNT(DISTINCT IN_DIAG_DIS_CD) FROM t_kc21 WHERE PERSON_NM = '赵嘉怡' AND IN_HOSP_DATE BETWEEN '2011-09-05' AND '2018-01-10'
css
CREATE TABLE table_21542 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
How many games occur on the date December 12?
SELECT COUNT("Game") FROM table_21542 WHERE "Date" = 'December 12'
wikisql
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 text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
what is the number of patients whose diagnoses short title is do not resusctate status and 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.short_title = "Do not resusctate status" AND lab."CATEGORY" = "Hematology"
mimicsql_data
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...
把2002年3月16日到2004年10月26日期间患者鲁和颂总共花了多少医保统筹基金金额查看一下
SELECT SUM(t_kc24.OVE_PAY) FROM gwyjzb JOIN t_kc24 ON gwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE gwyjzb.PERSON_NM = '鲁和颂' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2002-03-16' AND '2004-10-26' UNION SELECT SUM(t_kc24.OVE_PAY) FROM fgwyjzb JOIN t_kc24 ON fgwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE fgwyjzb.PERSON...
css
CREATE TABLE table_29842201_1 ( lowest_mark VARCHAR, _percentage_pass VARCHAR )
How many lowest mark entries are there when % passed is 76?
SELECT COUNT(lowest_mark) FROM table_29842201_1 WHERE _percentage_pass = 76
sql_create_context
CREATE TABLE table_203_440 ( id number, "rank" number, "player" text, "from" text, "to" text, "transfer fee\n(\u20ac million)" number, "year" number )
how many players transferred after 2010 ?
SELECT COUNT("player") FROM table_203_440 WHERE "year" > 2010
squall
CREATE TABLE table_1342218_17 ( candidates VARCHAR, party VARCHAR, incumbent VARCHAR )
List all candidates in the democratic party where the election had the incumbent Frank Chelf running.
SELECT candidates FROM table_1342218_17 WHERE party = "Democratic" AND incumbent = "Frank Chelf"
sql_create_context
CREATE TABLE table_203_54 ( id number, "selected\nlatin american\ncountries" text, "internl.\ntourism\narrivals\n2010\n(x 1000)" number, "internl.\ntourism\nreceipts.\n2010\n(usd\n(x1000)" number, "average\nreceipt\nper visitor\n2009\n(usd/turista)" number, "tourist\narrivals\nper\n1000 inhab\n(...
what is the last country listed on this chart ?
SELECT "selected\nlatin american\ncountries" FROM table_203_54 ORDER BY id DESC LIMIT 1
squall
CREATE TABLE table_75606 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Save" text )
Name the date for loss of ruffin (3-5)
SELECT "Date" FROM table_75606 WHERE "Loss" = 'ruffin (3-5)'
wikisql
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
How many of the patients who had a lab test for ascites remained admit in hospital for more than 11 days?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "11" AND lab.fluid = "Ascites"
mimicsql_data
CREATE TABLE table_name_50 ( score VARCHAR, home_team VARCHAR )
What is Score, when Home Team is 'Manchester United'?
SELECT score FROM table_name_50 WHERE home_team = "manchester united"
sql_create_context
CREATE TABLE table_name_10 ( yds_att VARCHAR, net_yds VARCHAR, rank VARCHAR )
What is the total number of Yds/Att where Net Yds was 1818, and Rank was larger than 1?
SELECT COUNT(yds_att) FROM table_name_10 WHERE net_yds = 1818 AND rank > 1
sql_create_context
CREATE TABLE table_24223834_3 ( original_air_date VARCHAR, us_viewers__in_millions_ VARCHAR )
What date did the episode that had 1.023 million u.s. viewers originally air?
SELECT original_air_date FROM table_24223834_3 WHERE us_viewers__in_millions_ = "1.023"
sql_create_context
CREATE TABLE table_name_87 ( losing_team VARCHAR, winning_team VARCHAR, venue VARCHAR, total VARCHAR )
WHich Losing Team has a Venue of sydney football stadium, and a Total larger than 80, and a Winning Team of tigers?
SELECT losing_team FROM table_name_87 WHERE venue = "sydney football stadium" AND total > 80 AND winning_team = "tigers"
sql_create_context
CREATE TABLE table_36345 ( "Throne Name" text, "Title" text, "Born-Died" text, "Entered office" text, "Left office" text, "Family Relations" text )
What is the title of the king who left office in 982 and entered office in 949?
SELECT "Title" FROM table_36345 WHERE "Left office" = '982' AND "Entered office" = '949'
wikisql
CREATE TABLE table_2850912_1 ( college_junior_club_team VARCHAR, pick__number VARCHAR )
What college team did draft pick 18 come from?
SELECT college_junior_club_team FROM table_2850912_1 WHERE pick__number = 18
sql_create_context
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostsWithDe...
Search Users by User Name.
SELECT * FROM Users WHERE LOWER(DisplayName) LIKE LOWER('%##UserName##%')
sede
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, ...
until 3 years ago, count the number of hospital visits of patient 91004.
SELECT COUNT(DISTINCT admissions.hadm_id) FROM admissions WHERE admissions.subject_id = 91004 AND DATETIME(admissions.admittime) <= DATETIME(CURRENT_TIME(), '-3 year')
mimic_iii
CREATE TABLE table_19584 ( "States" text, "Males (%)" text, "Males rank" real, "Females (%)" text, "Females rank" real )
What is the female rank in Karnataka?
SELECT "Females rank" FROM table_19584 WHERE "States" = 'Karnataka'
wikisql
CREATE TABLE plays_games ( stuid number, gameid number, hours_played number ) CREATE TABLE video_games ( gameid number, gname text, gtype text ) CREATE TABLE sportsinfo ( stuid number, sportname text, hoursperweek number, gamesplayed number, onscholarship text ) CREATE TAB...
Show student ids who are female and play football.
SELECT stuid FROM student WHERE sex = 'F' INTERSECT SELECT stuid FROM sportsinfo WHERE sportname = "Football"
spider
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...
看看被门诊诊断为疾病U99.814的患者柏志国的检测指标095190的结果定量是什么?单位又是什么
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND 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...
css
CREATE TABLE table_name_96 ( record VARCHAR, date VARCHAR )
Which record has a Date of april 25?
SELECT record FROM table_name_96 WHERE date = "april 25"
sql_create_context
CREATE TABLE table_26375386_23 ( public INTEGER, result VARCHAR )
How many public is there for the couple that got eliminated?
SELECT MAX(public) FROM table_26375386_23 WHERE result = "Eliminated"
sql_create_context
CREATE TABLE table_78067 ( "Rank" real, "Player" text, "Country" text, "Earnings( $ )" real, "Wins" real )
On average, how many wins have a rank lower than 1?
SELECT AVG("Wins") FROM table_78067 WHERE "Rank" < '1'
wikisql
CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE paperdataset ( paperid ...
What papers were published during the conference ACL 2016 ?
SELECT DISTINCT paper.paperid FROM paper, venue WHERE paper.year = 2016 AND venue.venueid = paper.venueid AND venue.venuename = 'ACL'
scholar
CREATE TABLE table_52181 ( "Game #" real, "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text, "Points" real )
What is the record when the visitor is Buffalo?
SELECT "Record" FROM table_52181 WHERE "Visitor" = 'buffalo'
wikisql
CREATE TABLE table_41363 ( "Year" real, "Venue" text, "Location" text, "Winners" text, "Runners-up" text )
What is the Winners when the United States is the runner-up at st. germain golf club?
SELECT "Winners" FROM table_41363 WHERE "Runners-up" = 'united states' AND "Venue" = 'st. germain golf club'
wikisql
CREATE TABLE table_name_28 ( home_team VARCHAR, ground VARCHAR )
When the Ground was Optus Oval, what is the Home team score?
SELECT home_team AS score FROM table_name_28 WHERE ground = "optus oval"
sql_create_context
CREATE TABLE table_31855 ( "Name" text, "Nationality" text, "School/Club" text, "Season(s)" text, "Position(s)" text )
What is the nationality of the player who played guard in 2006?
SELECT "Nationality" FROM table_31855 WHERE "Position(s)" = 'guard' AND "Season(s)" = '2006'
wikisql
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decima...
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about commission_pct over the email , and show by the Y in desc.
SELECT EMAIL, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY COMMISSION_PCT DESC
nvbench
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, ...
what were the specimen tests that patient 97733 last had in this hospital encounter?
SELECT microbiologyevents.spec_type_desc FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 97733 AND admissions.dischtime IS NULL) ORDER BY microbiologyevents.charttime DESC LIMIT 1
mimic_iii
CREATE TABLE table_14848 ( "Name" text, "Code" text, "Capacity" text, "Power" text, "Acceleration 0\u2013100km/h" text, "Top speed" text, "Combined consumption" text )
what is the power when the capacity is 898cc?
SELECT "Power" FROM table_14848 WHERE "Capacity" = '898cc'
wikisql
CREATE TABLE table_name_38 ( place VARCHAR, player VARCHAR )
What place is player leo diegel?
SELECT place FROM table_name_38 WHERE player = "leo diegel"
sql_create_context
CREATE TABLE table_41730 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-10" real, "Top-25" real, "Events" real, "Cuts made" real )
What is the average number of events having 1 top-10, fewer than 4 cuts made, and 0 wins?
SELECT AVG("Events") FROM table_41730 WHERE "Top-10" = '1' AND "Wins" > '0' AND "Cuts made" < '4'
wikisql
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
what is the number of patients whose ethnicity is asian and diagnoses short title is septicemia nos?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "ASIAN" AND diagnoses.short_title = "Septicemia NOS"
mimicsql_data
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type t...
compared to last measured on the first intensive care unit visit, was the arterial bp [systolic] of patient 16248 less than the value second to last measured on the first intensive care unit visit.
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 16248) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.item...
mimic_iii
CREATE TABLE table_63886 ( "Driver" text, "Navigator" text, "Vehicle" text, "Class" text, "Capacity" real, "Total Time" text, "Margin" text )
What class has a capacity smaller than 3384 for Ferguson?
SELECT "Class" FROM table_63886 WHERE "Capacity" < '3384' AND "Navigator" = 'ferguson'
wikisql
CREATE TABLE table_9322 ( "Articulatory class" text, "Non- stop" text, "Plain stop" text, "Aspirated stop" text, "\"Muddy\" voice" text )
Which Non- stop has an Aspirated stop of ?
SELECT "Non- stop" FROM table_9322 WHERE "Aspirated stop" = 'ㅎ'
wikisql
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TAB...
Search User 'About Me' Sections for an Exact Word or Phrase.
SELECT * FROM Users WHERE LOWER(AboutMe) LIKE '%' + '##keyword:string##' + '%' AND Reputation > 1 AND NOT LOWER(AboutMe) LIKE '%' + '##keyword:string##' + 's%' ORDER BY Reputation DESC
sede
CREATE TABLE table_72353 ( "Rank" real, "Dismissals" real, "Player" text, "Innings" real, "Catches" real, "Stumpings" real )
How many stumpings did the player Tim Latham have?
SELECT MAX("Stumpings") FROM table_72353 WHERE "Player" = 'Tim Latham'
wikisql
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, ...
看看这位章白雪的患者在01年2月22日到10年6月1日期间,去医院看过最主要的疾病是什么
SELECT gwyjzb.IN_DIAG_DIS_CD, gwyjzb.IN_DIAG_DIS_NM FROM gwyjzb WHERE gwyjzb.PERSON_NM = '章白雪' AND gwyjzb.IN_HOSP_DATE BETWEEN '2001-02-22' AND '2010-06-01' GROUP BY gwyjzb.IN_DIAG_DIS_CD ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT fgwyjzb.IN_DIAG_DIS_CD, fgwyjzb.IN_DIAG_DIS_NM FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '章...
css
CREATE TABLE table_name_62 ( season VARCHAR, winner VARCHAR, final_venue VARCHAR )
During what Season was the Final Venue at Sandy Lane with Kiveton Park as the Winner?
SELECT season FROM table_name_62 WHERE winner = "kiveton park" AND final_venue = "sandy lane"
sql_create_context
CREATE TABLE table_14748 ( "Name" text, "Species Authority" text, "Order" text, "Family" text, "Red List" real )
What family has the name of eastern cottontail?
SELECT "Family" FROM table_14748 WHERE "Name" = 'eastern cottontail'
wikisql
CREATE TABLE table_name_57 ( attendance INTEGER, week VARCHAR )
Week of 7 had what average attendance?
SELECT AVG(attendance) FROM table_name_57 WHERE week = 7
sql_create_context
CREATE TABLE performance ( Performance_ID real, Date text, Host text, Location text, Attendance int ) CREATE TABLE member_attendance ( Member_ID int, Performance_ID int, Num_of_Pieces int ) CREATE TABLE member ( Member_ID text, Name text, Nationality text, Role text )
Show the number of the dates of performances with attending members whose roles are 'Violin', and order by the total number in ascending.
SELECT Date, COUNT(Date) FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID WHERE T2.Role = "Violin" GROUP BY Date ORDER BY COUNT(Date)
nvbench
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...
Count the number of married patients with a blood gas lab test category.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "MARRIED" AND lab."CATEGORY" = "Blood Gas"
mimicsql_data
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, ...
Top Comments of all time, site-wide.
SELECT c.Score, c.UserId AS "user_link", c.CreationDate, c.PostId AS "post_link", c.Text AS C_text FROM Comments AS c INNER JOIN Posts AS p ON p.Id = c.PostId LEFT OUTER JOIN Posts AS pp ON pp.Id = p.ParentId INNER JOIN Users AS u ON c.UserId = u.Id WHERE c.Score >= 50 ORDER BY c.Score DESC
sede
CREATE TABLE table_1021 ( "Player" text, "Position" text, "Starter" text, "Touchdowns" real, "Extra points" real, "Field goals" real, "Points" real )
What is the least amount of field goals made by a player?
SELECT MIN("Field goals") FROM table_1021
wikisql
CREATE TABLE table_877 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
what's the record with date being december 29
SELECT "Record" FROM table_877 WHERE "Date" = 'December 29'
wikisql
CREATE TABLE table_15187735_13 ( segment_c VARCHAR, segment_a VARCHAR )
Name the total number of segment c for pressure cookers
SELECT COUNT(segment_c) FROM table_15187735_13 WHERE segment_a = "Pressure Cookers"
sql_create_context
CREATE TABLE table_32298 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What venue did South Melbourne play as the away team?
SELECT "Venue" FROM table_32298 WHERE "Away team" = 'south melbourne'
wikisql
CREATE TABLE table_72253 ( "Series #" real, "Season #" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text )
Who were the authors of series episode #25?
SELECT "Written by" FROM table_72253 WHERE "Series #" = '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...
what is the number of patients whose diagnoses icd9 code is 7756 and drug type is main?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "7756" AND prescriptions.drug_type = "MAIN"
mimicsql_data