context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE college ( state VARCHAR, enr INTEGER )
What is the number of states that has some colleges whose enrollment is smaller than the average enrollment?
SELECT COUNT(DISTINCT state) FROM college WHERE enr < (SELECT AVG(enr) FROM college)
sql_create_context
CREATE TABLE table_name_89 ( platform VARCHAR, title VARCHAR )
What's the platform of Super Mario All-Stars?
SELECT platform FROM table_name_89 WHERE title = "super mario all-stars"
sql_create_context
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 patients whose procedure icd9 code is 3950?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "3950"
mimicsql_data
CREATE TABLE table_347 ( "Year" real, "Song name" text, "Film name" text, "Co-singer" text, "Music director" text, "Lyricist" text, "Language" text )
Who was the lyricist for gopal krishna and co singer of solo?
SELECT "Lyricist" FROM table_347 WHERE "Film name" = 'Gopal Krishna' AND "Co-singer" = 'Solo'
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...
count the number of patients who received a venous cath nec procedure two or more times since 2 years ago?
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'venous cath nec') AND...
mimic_iii
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE PostLinks ( Id number, CreationDate time, Pos...
Top users from Gothenburg.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%gothenburg%' OR UPPER(Location) LIKE '%GOTHENBURG%' OR Location LIKE '%Gothenburg%' AND Reputation >= 1000 ORDER BY Reputation DESC
sede
CREATE TABLE table_57079 ( "Player" text, "Nationality" text, "Position" text, "Years for Jazz" text, "School/Club Team" text )
Who is the player from Auburn?
SELECT "Player" FROM table_57079 WHERE "School/Club Team" = 'auburn'
wikisql
CREATE TABLE table_name_34 ( date VARCHAR, team VARCHAR, venue VARCHAR )
What day did Glentoran play at Windsor Park, Belfast?
SELECT date FROM table_name_34 WHERE team = "glentoran" AND venue = "windsor park, belfast"
sql_create_context
CREATE TABLE table_name_50 ( to_par VARCHAR, country VARCHAR, place VARCHAR, score VARCHAR )
What is the to par of the player from the United States with a place of t1 and a 76-68=144 score?
SELECT to_par FROM table_name_50 WHERE country = "united states" AND place = "t1" AND score = 76 - 68 = 144
sql_create_context
CREATE TABLE table_55411 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the combined of Crowd when richmond played at home?
SELECT COUNT("Crowd") FROM table_55411 WHERE "Home team" = 'richmond'
wikisql
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...
what is the name of the drug prescribed for patient 030-52395 in the same hospital visit after they has been diagnosed with gi obstruction / ileus - gastric obstruction until 6 months ago?
SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid =...
eicu
CREATE TABLE table_35708 ( "Source" text, "Date" text, "Fidesz" text, "MSZP" text, "SZDSZ" text, "Jobbik" text, "others" text )
What is the SZDSZ percentage with a Jobbik of 5% and a Fidesz of 68%?
SELECT "SZDSZ" FROM table_35708 WHERE "Jobbik" = '5%' AND "Fidesz" = '68%'
wikisql
CREATE TABLE table_40246 ( "Season" real, "Series" text, "Team" text, "Races" text, "Wins" text, "Poles" text, "F/Laps" text, "Podiums" text, "Points" text, "Position" text )
Which teams had the 1st position and entered 1 race?
SELECT "Team" FROM table_40246 WHERE "Races" = '1' AND "Position" = '1st'
wikisql
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, ...
since 5 years ago, what are the top three most frequent diagnoses patients were given in the same hospital encounter after receiving exc/dest hrt lesion open?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_i...
mimic_iii
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE ReviewTasks (...
Questions with a particular tag.
SELECT p.Id AS "post_link", p.Tags FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId WHERE p.Id IN (SELECT p.Id FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE PostTypeId = 1 AND TagName = 'mythology') AND p.ClosedDate IS NULL GROUP BY p.Id, p.Tags...
sede
CREATE TABLE table_43564 ( "Year" text, "Matches" real, "Wins" real, "Losses" real, "No Result" real, "Win %" text )
What is the total number of wins in 2010, when there were more than 14 matches?
SELECT COUNT("Wins") FROM table_43564 WHERE "Year" = '2010' AND "Matches" > '14'
wikisql
CREATE TABLE table_27476 ( "Rank" real, "Rank w/o Hydropower" real, "State" text, "% Renewable" text, "% Renewable w/o Hydro" text, "Renewable electricity (GW\u00b7h)" real, "Renewable electricity w/o Hydro (GW\u00b7h)" real, "Total electricity (GW\u00b7h)" real )
How many data was given the total electricity in GW-h if the renewable electricity w/o hydro (GW-h) is 3601?
SELECT COUNT("Total electricity (GW\u00b7h)") FROM table_27476 WHERE "Renewable electricity w/o Hydro (GW\u00b7h)" = '3601'
wikisql
CREATE TABLE table_name_80 ( year INTEGER, city VARCHAR )
What is the lowest year when the city is casablanca?
SELECT MIN(year) FROM table_name_80 WHERE city = "casablanca"
sql_create_context
CREATE TABLE table_14070062_3 ( points VARCHAR, try_bonus VARCHAR )
How many points does the club with a try bonus of 10 have?
SELECT points FROM table_14070062_3 WHERE try_bonus = "10"
sql_create_context
CREATE TABLE table_40538 ( "Date" text, "Cover model" text, "Centerfold model" text, "Interview subject" text, "20 Questions" text )
When Centerfold model is on 3-04?
SELECT "Centerfold model" FROM table_40538 WHERE "Date" = '3-04'
wikisql
CREATE TABLE table_203_687 ( id number, "#" number, "title" text, "time" text, "performer(s)" text, "songwriters" text, "producer(s)" text, "samples and notes" text )
what title had the longest run time ?
SELECT "title" FROM table_203_687 ORDER BY "time" DESC LIMIT 1
squall
CREATE TABLE table_train_72 ( "id" int, "extracorporeal_membrane_oxygenation_ecmo_cannulation" bool, "heart_disease" bool, "meningitis_or_encephalitis" bool, "sepsis" bool, "cancer" bool, "prisoners" bool, "NOUSE" float )
history of extracorporeal membrane oxygenation ( ecmo ) cannulation.
SELECT * FROM table_train_72 WHERE extracorporeal_membrane_oxygenation_ecmo_cannulation = 1
criteria2sql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( ...
what is diagnoses short title of subject id 2560?
SELECT diagnoses.short_title FROM diagnoses WHERE diagnoses.subject_id = "2560"
mimicsql_data
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...
患者沈鸿风的检测指标721371的情况,在16年7月25日到17年10月2日期间怎么样?
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 files ( f_id number(10), artist_name varchar2(50), file_size varchar2(20), duration varchar2(20), formats varchar2(20) ) CREATE TABLE song ( song_name varchar2(50), artist_name varchar2(50), country varchar2(20), f_id number(10), genre_is varchar2(20), rating nu...
What is the average song rating for each language Plot them as bar chart, and show by the languages in desc.
SELECT languages, AVG(rating) FROM song GROUP BY languages ORDER BY languages DESC
nvbench
CREATE TABLE table_name_45 ( location VARCHAR, fc_matches VARCHAR )
Where was the FC match with a score of 12 played?
SELECT location FROM table_name_45 WHERE fc_matches = "12"
sql_create_context
CREATE TABLE table_66333 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
For the Cage Combat Fighting Championships: Mayhem, what was the record?
SELECT "Record" FROM table_66333 WHERE "Event" = 'cage combat fighting championships: mayhem'
wikisql
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE microbiologyevents ( ...
what was the first height of patient 9294 this month.
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 = 9294)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit ht' ...
mimic_iii
CREATE TABLE table_53231 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
What city was a visitor on the date of April 30?
SELECT "Visitor" FROM table_53231 WHERE "Date" = 'april 30'
wikisql
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE medication ( medi...
when did patient 009-12985 the last time had urine catheter output until 2045 days ago?
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-12985')) AND intakeoutput.cellpath LIKE '%output%...
eicu
CREATE TABLE table_36305 ( "Tournament" text, "1988" text, "1989" text, "1990" text, "1991" text, "1992" text, "1993" text, "1994" text, "1995" text, "1996" text, "1997" text, "1998" text )
Which 992 has a 1 2 of 1989 ?
SELECT "1992" FROM table_36305 WHERE "1989" = '1–2'
wikisql
CREATE TABLE stock ( shop_id number, device_id number, quantity number ) CREATE TABLE device ( device_id number, device text, carrier text, package_version text, applications text, software_platform text ) CREATE TABLE shop ( shop_id number, shop_name text, location tex...
What are the names of shops in ascending order of open year?
SELECT shop_name FROM shop ORDER BY open_year
spider
CREATE TABLE table_name_71 ( rider VARCHAR, time_retired VARCHAR, laps VARCHAR, grid VARCHAR )
Who was the rider for laps less than 23 with grid greater than 21 that had a time of +1 lap?
SELECT rider FROM table_name_71 WHERE laps < 23 AND grid > 21 AND time_retired = "+1 lap"
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...
60963732这位患者在医疗就诊62213446252中自费金额最高的项目是哪个项目?
SELECT SOC_SRT_DIRE_CD, SOC_SRT_DIRE_NM FROM t_kc22 WHERE MED_CLINIC_ID = '62213446252' GROUP BY SOC_SRT_DIRE_CD ORDER BY SUM(SELF_PAY_AMO) DESC LIMIT 1
css
CREATE TABLE table_name_33 ( tournament VARCHAR )
Name the 2010 for 2008 of 1r and tournament of us open
SELECT 2010 FROM table_name_33 WHERE 2008 = "1r" AND 2011 = "1r" AND tournament = "us open"
sql_create_context
CREATE TABLE table_59903 ( "Name" text, "Position" text, "League Apps" text, "League Goals" real, "FA Cup Apps" text, "FA Cup Goals" real, "League Cup Apps" text, "League Cup Goals" real, "Total Apps" text, "Total Goals" real )
Who is the player that has scored more than 0 league cup goals, but has than 13 total goals, and 4 league cup appearances total?
SELECT "Name" FROM table_59903 WHERE "League Cup Goals" > '0' AND "Total Goals" < '13' AND "League Cup Apps" = '4'
wikisql
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
For those employees whose first name is ending with the letter m, show the frequency of the first name using a bar chart, and rank total number in ascending order.
SELECT FIRST_NAME, COUNT(FIRST_NAME) FROM employees WHERE FIRST_NAME LIKE '%m' GROUP BY FIRST_NAME ORDER BY COUNT(FIRST_NAME)
nvbench
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
count the number of patients whose primary disease is abdominal pain and admission year is less than 2173?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ABDOMINAL PAIN" AND demographic.admityear < "2173"
mimicsql_data
CREATE TABLE table_51813 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
What location was f bio maldonado the opponent at?
SELECT "Location" FROM table_51813 WHERE "Opponent" = 'fábio maldonado'
wikisql
CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) 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...
从12年9月8日到13年11月18日,医院9519842的门诊医疗记录的数目是多少?
SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '9519842' AND t_kc21.IN_HOSP_DATE BETWEEN '2012-09-08' AND '2013-11-18' AND t_kc21.CLINIC_TYPE = '门诊'
css
CREATE TABLE table_45124 ( "Event" text, "2006\u201307" text, "2009\u201310" text, "2010\u201311" text, "2011\u201312" text, "2012\u201313" text )
what is 2012-13 when 2011-12 is dnp and event is autumn gold?
SELECT "2012\u201313" FROM table_45124 WHERE "2011\u201312" = 'dnp' AND "Event" = 'autumn gold'
wikisql
CREATE TABLE table_46393 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Who had the most points in the game on November 12?
SELECT "High points" FROM table_46393 WHERE "Date" = 'november 12'
wikisql
CREATE TABLE table_name_79 ( catalog VARCHAR, format VARCHAR, label VARCHAR )
What is the Catalog number of the CD Reissue Universal release?
SELECT catalog FROM table_name_79 WHERE format = "cd reissue" AND label = "universal"
sql_create_context
CREATE TABLE table_27539535_4 ( points INTEGER )
What is the least amount of points?
SELECT MIN(points) FROM table_27539535_4
sql_create_context
CREATE TABLE Transactions_Lots ( transaction_id INTEGER, lot_id INTEGER ) CREATE TABLE Ref_Transaction_Types ( transaction_type_code VARCHAR(10), transaction_type_description VARCHAR(80) ) CREATE TABLE Lots ( lot_id INTEGER, investor_id INTEGER, lot_details VARCHAR(255) ) CREATE TABLE Sal...
Show all dates of transactions whose type code is 'SALE', and count them by a bar chart
SELECT date_of_transaction, COUNT(date_of_transaction) FROM Transactions WHERE transaction_type_code = "SALE"
nvbench
CREATE TABLE table_name_11 ( time VARCHAR, opponent VARCHAR )
Which time has eddie miller as opponent?
SELECT time FROM table_name_11 WHERE opponent = "eddie miller"
sql_create_context
CREATE TABLE table_name_26 ( laps INTEGER, year VARCHAR )
How many laps were done in 2012?
SELECT SUM(laps) FROM table_name_26 WHERE year = 2012
sql_create_context
CREATE TABLE table_201_39 ( id number, "no" number, "title" text, "directed by" text, "released" number )
who directed the most cartoons ?
SELECT "directed by" FROM table_201_39 GROUP BY "directed by" ORDER BY COUNT(*) DESC LIMIT 1
squall
CREATE TABLE table_1342426_3 ( result VARCHAR, incumbent VARCHAR )
What was the result when incumbent John R. Tyson was elected?
SELECT result FROM table_1342426_3 WHERE incumbent = "John R. Tyson"
sql_create_context
CREATE TABLE table_name_81 ( first_match VARCHAR, last_match VARCHAR )
On what date was the first match for the competition that ended its last match on December 16, 2007?
SELECT first_match FROM table_name_81 WHERE last_match = "december 16, 2007"
sql_create_context
CREATE TABLE table_20673 ( "State" text, "Preliminary Average" text, "Interview" text, "Swimsuit" text, "Evening Gown" text, "Semifinal Average" text )
What was the evening gown score for the one who had a preliminary average of 8.121 (8)?
SELECT "Evening Gown" FROM table_20673 WHERE "Preliminary Average" = '8.121 (8)'
wikisql
CREATE TABLE mzjybgb ( 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, ...
开出55858343244这个检验报告单的科室编码以及名称分别是什么?
SELECT zyjybgb.KSBM, zyjybgb.KSMC FROM zyjybgb WHERE zyjybgb.BGDH = '55858343244' UNION SELECT mzjybgb.KSBM, mzjybgb.KSMC FROM mzjybgb WHERE mzjybgb.BGDH = '55858343244'
css
CREATE TABLE table_name_77 ( played VARCHAR, points_for VARCHAR )
What is the number Played that has 310 Points for?
SELECT played FROM table_name_77 WHERE points_for = "310"
sql_create_context
CREATE TABLE table_57332 ( "Council" text, "2003 result" text, "Notional control (based on 2003 results)" text, "2007 result" text, "Details" text )
What's the 2007 result when the notional control is noc and the 2003 result is snp?
SELECT "2007 result" FROM table_57332 WHERE "Notional control (based on 2003 results)" = 'noc' AND "2003 result" = 'snp'
wikisql
CREATE TABLE table_49618 ( "Region (year)" text, "No. 1" text, "No. 2" text, "No. 3" text, "No. 4" text, "No. 5" text, "No. 6" text, "No. 7" text, "No. 8" text, "No. 9" text, "No. 10" text )
What is the No. 8 of the person with a No. 4 of Noah?
SELECT "No. 8" FROM table_49618 WHERE "No. 4" = 'noah'
wikisql
CREATE TABLE table_name_84 ( song_title VARCHAR, movie VARCHAR )
What was the name of the song in Amma Cheppindi?
SELECT song_title FROM table_name_84 WHERE movie = "amma cheppindi"
sql_create_context
CREATE TABLE table_name_33 ( rank VARCHAR, year VARCHAR )
What is the rank for 1961?
SELECT rank FROM table_name_33 WHERE year = "1961"
sql_create_context
CREATE TABLE table_36623 ( "Fraction" text, "Ellipsis" text, "Vinculum" text, "Dots" text, "Parentheses" text )
What fraction has parentheses of 0.(3)?
SELECT "Fraction" FROM table_36623 WHERE "Parentheses" = '0.(3)'
wikisql
CREATE TABLE Document_Sections_Images ( section_id INTEGER, image_id INTEGER ) CREATE TABLE Documents ( document_code VARCHAR(15), document_structure_code VARCHAR(15), document_type_code VARCHAR(15), access_count INTEGER, document_name VARCHAR(80) ) CREATE TABLE Images ( image_id INTEG...
what are the different role codes for users, and how many users have each?, and sort from high to low by the Y.
SELECT role_code, COUNT(*) FROM Users GROUP BY role_code ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_228973_11 ( no_in_series VARCHAR, directed_by VARCHAR )
David James Elliott directed which episode number within the series?
SELECT no_in_series FROM table_228973_11 WHERE directed_by = "David James Elliott"
sql_create_context
CREATE TABLE table_2066 ( "Role" text, "Original Broadway Cast" text, "Current Broadway Cast" text, "Original Toronto Cast" text, "First National Tour Cast" text, "Original Australian Cast" text, "Original West End Cast" text, "Current West End Cast" text, "Second National Tour Cast"...
What member of the current Broadway cast plays the character played by Constantine Maroulis from the original Broadway cast?
SELECT "Current Broadway Cast" FROM table_2066 WHERE "Original Broadway Cast" = 'Constantine Maroulis'
wikisql
CREATE TABLE table_203_771 ( id number, "#" number, "artist" text, "featuring" text, "title" text, "version" text, "length" text )
how many tracks are there on the 2005 best of benassi bros. album ?
SELECT COUNT("title") FROM table_203_771
squall
CREATE TABLE table_name_60 ( director VARCHAR, language VARCHAR )
Who directed the Romanian film?
SELECT director FROM table_name_60 WHERE language = "romanian"
sql_create_context
CREATE TABLE table_name_31 ( opponent VARCHAR, week VARCHAR )
Who were the opponents for week 12?
SELECT opponent FROM table_name_31 WHERE week = 12
sql_create_context
CREATE TABLE table_name_97 ( height__m_ INTEGER, name VARCHAR, ave__no VARCHAR )
Which Height (m) has a Name of plessur alps, and a AVE-No larger than 63?
SELECT MIN(height__m_) FROM table_name_97 WHERE name = "plessur alps" AND ave__no > 63
sql_create_context
CREATE TABLE table_6750 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the lowest number of silver medals with a rank of 4 and total medals greater than 1?
SELECT MIN("Silver") FROM table_6750 WHERE "Rank" = '4' AND "Total" > '1'
wikisql
CREATE TABLE table_test_32 ( "id" int, "anemia" bool, "symptomatic_disease" bool, "language" string, "deceased" bool, "abdominal_pain" bool, "fever" bool, "arthralgia" bool, "unable_provide_consent" bool, "headache" bool, "myalgia" bool, "rash" bool, "thrombocytopenia...
patients who meet any of the following criteria will not be enrolled in the study: < 18 years of age, non _ english speakers, deceased at time of survey, and / or unable to provide consent
SELECT * FROM table_test_32 WHERE age < 18 OR language <> 'english' OR deceased = 1 OR unable_provide_consent = 1
criteria2sql
CREATE TABLE table_17622423_12 ( high_assists VARCHAR, date VARCHAR )
Name the high assists for may 21
SELECT high_assists FROM table_17622423_12 WHERE date = "May 21"
sql_create_context
CREATE TABLE table_31770 ( "Nationality" text, "No [a ]" text, "Pos [a ]" text, "From" text, "School/club" text, "Pts [b ]" real, "Reb [b ]" real, "Ast [b ]" real )
What is the points that is more than 636 and has a value of 50?
SELECT "Pts [b ]" FROM table_31770 WHERE "Reb [b ]" > '636' AND "No [a ]" = '50'
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
provide the number of patients admitted prematurely via clinic referral who have procedure icd9 code 4573.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND procedures.icd9_code = "4573"
mimicsql_data
CREATE TABLE table_55158 ( "Player" text, "Rec." real, "Yards" real, "Avg." real, "TD's" real, "Long" real )
What is the toal rec with more than 27 and averages less than 10.8 and TDs more than 6?
SELECT COUNT("Long") FROM table_55158 WHERE "Rec." > '27' AND "Avg." < '10.8' AND "TD's" > '6'
wikisql
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugsto...
patient 004-86136 was prescribed 1000 ml bag : lactated ringers iv solp since 02/2105?
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-86136')) AND medication.drugname = '1000 ml bag : lactated ringers iv ...
eicu
CREATE TABLE table_name_1 ( method VARCHAR, record VARCHAR )
Tell me the method with a record of 4-2
SELECT method FROM table_name_1 WHERE record = "4-2"
sql_create_context
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) 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_diag...
tell me the percentile of rdw worth 13.4 for patients of the same age as patient 84346 during the last hospital visit?
SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'rdw') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age = (SE...
mimic_iii
CREATE TABLE rating ( rid number, mid number, stars number, ratingdate time ) CREATE TABLE reviewer ( rid number, name text ) CREATE TABLE movie ( mid number, title text, year number, director text )
For each movie that received more than 3 reviews, what is the average rating?
SELECT mid, AVG(stars) FROM rating GROUP BY mid HAVING COUNT(*) >= 2
spider
CREATE TABLE table_31808 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
Tell me the result for 2008-12-23
SELECT "Result" FROM table_31808 WHERE "Date" = '2008-12-23'
wikisql
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
这位38161352的患者有多高、有多重
SELECT mzjzjlb.SG, mzjzjlb.TZ FROM hz_info JOIN mzjzjlb JOIN hz_info_mzjzjlb ON hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz...
css
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0),...
For those employees who did not have any job in the past, draw a bar chart about the distribution of hire_date and the average of salary bin hire_date by time.
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
nvbench
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...
根据不同的出院诊断疾病名称和科室编码,列出所有医疗就诊记录中患者在医院5280788中的平均年龄是多大?
SELECT gwyjzb.MED_ORG_DEPT_CD, gwyjzb.OUT_DIAG_DIS_NM, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '5280788' GROUP BY gwyjzb.MED_ORG_DEPT_CD, gwyjzb.OUT_DIAG_DIS_NM UNION SELECT fgwyjzb.MED_ORG_DEPT_CD, fgwyjzb.OUT_DIAG_DIS_NM, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '52...
css
CREATE TABLE table_8528 ( "Position" real, "Name" text, "Played" real, "Drawn" real, "Lost" real, "Points" real )
Which player lost more than 12?
SELECT COUNT("Lost") FROM table_8528 WHERE "Played" > '12'
wikisql
CREATE TABLE table_40479 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-10" real, "Top-25" real, "Events" real, "Cuts made" real )
How many wins are related to events of 7 and more than 2 top-10s?
SELECT COUNT("Wins") FROM table_40479 WHERE "Events" = '7' AND "Top-10" > '2'
wikisql
CREATE TABLE table_10812403_4 ( position VARCHAR, player VARCHAR )
What position did Calvin Mccarty play?
SELECT position FROM table_10812403_4 WHERE player = "Calvin McCarty"
sql_create_context
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABL...
what is the number of days since patient 99883 received the last potassium chloride prescription in the current hospital encounter?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', prescriptions.startdate)) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99883 AND admissions.dischtime IS NULL) AND prescriptions.drug = 'potassium chloride' ORDER BY prescriptions.st...
mimic_iii
CREATE TABLE table_name_31 ( lane INTEGER, rank VARCHAR, nationality VARCHAR )
What is the highest lane with a rank larger than 2 in Guyana?
SELECT MAX(lane) FROM table_name_31 WHERE rank > 2 AND nationality = "guyana"
sql_create_context
CREATE TABLE table_6890 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-10" real, "Top-25" real, "Events" real, "Cuts made" real )
What was the lowest Top-10, when the Wins were 0, when the Top-25 was 12, and when the Events were less than 23?
SELECT MIN("Top-10") FROM table_6890 WHERE "Wins" = '0' AND "Top-25" = '12' AND "Events" < '23'
wikisql
CREATE TABLE table_name_68 ( year INTEGER, winner VARCHAR )
What is the most recent year that Iftiraas was the winner?
SELECT MAX(year) FROM table_name_68 WHERE winner = "iftiraas"
sql_create_context
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
能列举出患者编号87435774在2013年5月27日到2018年10月29日内所有检验报告单中的标本搜集部位吗?
SELECT jybgb.BBCJBW FROM hz_info JOIN txmzjzjlb JOIN jybgb 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 WHERE hz_info.RYBH = '87435774' AND jybgb.BGRQ BETWEEN '2013-05-27' AND '201...
css
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE procedures_icd ( ...
calculate the total dosage of albumin 25% taken from patient 28443 since 11/17/2104.
SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28443)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.lab...
mimic_iii
CREATE TABLE table_63334 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
How many bronze medals did the team have with 0 total silver and less than 3 total medals?
SELECT "Bronze" FROM table_63334 WHERE "Total" < '3' AND "Silver" > '0'
wikisql
CREATE TABLE table_name_21 ( year INTEGER, length VARCHAR )
What is the earliest year having a length of 11:25?
SELECT MIN(year) FROM table_name_21 WHERE length = "11:25"
sql_create_context
CREATE TABLE table_71180 ( "Rank" real, "Lane" real, "Name" text, "Nationality" text, "Time" text )
What is the highest place of a swimmer from the Netherlands?
SELECT MAX("Rank") FROM table_71180 WHERE "Nationality" = 'netherlands'
wikisql
CREATE TABLE table_26039 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Prod. code" text, "U.S. Viewers (in millions)" text )
Who directed the episode with production code 208?
SELECT "Directed by" FROM table_26039 WHERE "Prod. code" = '208'
wikisql
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those records from the products and each product's manufacturer, show me about the distribution of name and code , and group by attribute founder in a bar chart, I want to sort in descending by the Code.
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder, T1.Name ORDER BY T1.Code DESC
nvbench
CREATE TABLE table_16641 ( "Rd." real, "Grand Prix" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Constructor" text, "Report" text )
What is the fastest lap for the european grand prix?
SELECT "Fastest Lap" FROM table_16641 WHERE "Grand Prix" = 'European Grand Prix'
wikisql
CREATE TABLE table_25908 ( "Episode" text, "First broadcast" text, "Seans team" text, "Jons team" text, "Scores" text )
What was the score on the episode that had Russell Kane and Louise Redknapp on Sean's team?
SELECT "Scores" FROM table_25908 WHERE "Seans team" = 'Russell Kane and Louise Redknapp'
wikisql
CREATE TABLE table_2988 ( "Year" real, "Kentucky Derby" real, "The Preakness Stakes" text, "Kentucky Oaks" text, "Belmont Stakes" text, "Travers Stakes" text, "Breeders Cup Saturday" text, "Breeders Cup Friday" text )
What was the Kentucky Oaks attendance the year the Belmont Stakes had 64,949 attendance?
SELECT "Kentucky Oaks" FROM table_2988 WHERE "Belmont Stakes" = '64,949'
wikisql
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 (...
tell me the long title of diagnosis for patient with diagnosis icd9 code 42731.
SELECT diagnoses.long_title FROM diagnoses WHERE diagnoses.icd9_code = "42731"
mimicsql_data
CREATE TABLE table_name_8 ( tied INTEGER, pct VARCHAR, lost VARCHAR )
What is the highest number of games tied for teams with under 551 games and a percentage of under 0.5593?
SELECT MAX(tied) FROM table_name_8 WHERE pct < 0.5593 AND lost = 551
sql_create_context
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewTaskStates ( Id number, Na...
number of users who posted, by year. Count of users who posted at least 1 question or answer, grouped by year
SELECT YEAR(CreationDate) AS "year", COUNT(DISTINCT OwnerUserId) AS "#userswhoposted" FROM Posts WHERE PostTypeId IN (1, 2) GROUP BY YEAR(CreationDate) ORDER BY YEAR(CreationDate)
sede
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE procedures_icd ( row_id number, su...
since 2101, what were the top four most frequent specimen tests given to patients within 2 months following the diagnosis of angiopathy in other dis?
SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 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_...
mimic_iii