context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_items ( ...
a month before when was the last time that patient 27703 was prescribed medication via the tp route?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27703) AND prescriptions.route = 'tp' AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY prescr...
mimic_iii
CREATE TABLE table_74356 ( "Series #" real, "Season #" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Prod. code" real, "U.S. viewers (millions)" text )
What number episode in the season had a production code of 334?
SELECT MAX("Season #") FROM table_74356 WHERE "Prod. code" = '334'
wikisql
CREATE TABLE table_13036251_1 ( the_mole VARCHAR, airdate VARCHAR )
what's the mole with airdate being 8 january 2009
SELECT the_mole FROM table_13036251_1 WHERE airdate = "8 January 2009"
sql_create_context
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
how many patients whose days of hospital stay is greater than 3 and lab test fluid is ascites?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "3" AND lab.fluid = "Ascites"
mimicsql_data
CREATE TABLE table_18018214_3 ( goals_scored VARCHAR, club VARCHAR )
How many goals were scored by club team fm (losc) vilnius
SELECT goals_scored FROM table_18018214_3 WHERE club = "FM (LOSC) Vilnius"
sql_create_context
CREATE TABLE table_43159 ( "Year" text, "Champion" text, "Country" text, "To par" text, "Margin of victory" text, "Winner's share ( $ )" text )
what is the victory margin in 2013 with a Winner's share of 1,440,000
SELECT "Margin of victory" FROM table_43159 WHERE "Winner's share ( $ )" = '1,440,000' AND "Year" = '2013'
wikisql
CREATE TABLE table_68455 ( "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
Which tournament had a hard surface?
SELECT "Tournament" FROM table_68455 WHERE "Surface" = 'hard'
wikisql
CREATE TABLE table_204_455 ( id number, "rd." number, "grand prix" text, "date" text, "location" text, "pole position" text, "fastest lap" text, "winning driver" text, "constructor" text, "report" text )
what grand prix was before the san marino grand prix ?
SELECT "grand prix" FROM table_204_455 WHERE "rd." = (SELECT "rd." FROM table_204_455 WHERE "grand prix" = 'san marino grand prix') - 1
squall
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE labevents ( row...
when was the last time patient 2498 got the prescription in 08/2104?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2498) AND STRFTIME('%y-%m', prescriptions.startdate) = '2104-08' ORDER BY prescriptions.startdate DESC LIMIT 1
mimic_iii
CREATE TABLE table_204_430 ( id number, "model" text, "origin" text, "type" text, "version" text, "in service" text, "notes" text )
name a model that has the most versions .
SELECT "model" FROM table_204_430 ORDER BY "version" DESC LIMIT 1
squall
CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) CREATE TABLE PR...
Return a histogram on how many students are in each department?, and display by the X-axis in asc please.
SELECT DEPT_CODE, COUNT(*) FROM STUDENT GROUP BY DEPT_CODE ORDER BY DEPT_CODE
nvbench
CREATE TABLE bdmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZ...
哪些工号及姓名的医务人员在患者94520266就诊过程中为他检测指标994830的,时间是从0三年十二月十四日到0八年十二月二十五日
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGD...
css
CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight real ) CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate re...
Visualize the relationship between Height and Weight .
SELECT Height, Weight FROM people
nvbench
CREATE TABLE table_name_3 ( ends INTEGER, app_l_c_e_ VARCHAR )
What are the fewest ends with an App(L/C/E) of 51 (44/6/1)?
SELECT MIN(ends) FROM table_name_3 WHERE app_l_c_e_ = "51 (44/6/1)"
sql_create_context
CREATE TABLE table_15887683_4 ( ppv VARCHAR, television_service VARCHAR )
Does the sky calcio 6 hd have PPV?
SELECT ppv FROM table_15887683_4 WHERE television_service = "Sky Calcio 6 HD"
sql_create_context
CREATE TABLE written_by ( id int, msid int, wid int ) CREATE TABLE writer ( wid int, gender text, name text, nationality text, birth_city text, birth_year int ) CREATE TABLE actor ( aid int, gender text, name text, nationality text, birth_city text, birth_ye...
Which movie had the character ' Daffy Duck
SELECT movie.title FROM cast, movie WHERE cast.role = 'Daffy Duck' AND movie.mid = cast.msid
imdb
CREATE TABLE table_name_66 ( winning_driver VARCHAR, winning_car VARCHAR, circuit VARCHAR )
Which driver drove car McLaren M23 at the Snetterton Circuit?
SELECT winning_driver FROM table_name_66 WHERE winning_car = "mclaren m23" AND circuit = "snetterton"
sql_create_context
CREATE TABLE table_69892 ( "Date" text, "Bowl" text, "Result" text, "Points For" real, "Points Against" real )
What date did the Mountaineers score 27 points and their opponent scored more that 7?
SELECT "Date" FROM table_69892 WHERE "Points Against" > '7' AND "Points For" = '27'
wikisql
CREATE TABLE table_36066 ( "Rank" real, "Name" text, "Team" text, "Games" real, "Rebounds" real )
Which game has more than 112 rebounds and a rank greater than 3?
SELECT MAX("Games") FROM table_36066 WHERE "Rank" > '3' AND "Rebounds" = '112'
wikisql
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
喻秀敏这个患者的医疗记录中哪几次被开过金额超过8393.94元的药品?查一下这个医疗就诊的编码
SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_NM = '喻秀敏' AND MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc22 WHERE AMOUNT > 8393.94)
css
CREATE TABLE table_75109 ( "Flat" text, "Threaded" text, "User-selectable themes" text, "Calendar" text, "Image attachment" text, "Unread message tracking" text, "WYSIWYG Editor" text )
Which WYSIWYG Editor has a User-selectable themes of yes, and an Unread message tracking of session, and an Image attachment of plugin?
SELECT "WYSIWYG Editor" FROM table_75109 WHERE "User-selectable themes" = 'yes' AND "Unread message tracking" = 'session' AND "Image attachment" = 'plugin'
wikisql
CREATE TABLE table_74076 ( "Salary range" text, "Indians" text, "Pakistanis" text, "Nepalese" text, "Working force of HK" text )
If the working force of HK is 10.4%, what is the salary range?
SELECT "Salary range" FROM table_74076 WHERE "Working force of HK" = '10.4%'
wikisql
CREATE TABLE Student_Course_Enrolment ( registration_id INTEGER, student_id INTEGER, course_id INTEGER, date_of_enrolment DATETIME, date_of_completion DATETIME ) CREATE TABLE Students ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARC...
What are the completion dates of all the tests that have result 'Fail', and count them by a bar chart, sort Y-axis in asc order please.
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" ORDER BY COUNT(date_of_completion)
nvbench
CREATE TABLE table_42890 ( "Country" text, "Telenovela" text, "Translation" text, "Series Premiere" text, "Series Finale" text, "Weekly Schedule" text, "Timeslot" text )
Which days of the week does the telenovela play that is aired at 11:00?
SELECT "Weekly Schedule" FROM table_42890 WHERE "Timeslot" = '11:00'
wikisql
CREATE TABLE table_50424 ( "Position" real, "Team" text, "Played" real, "Drawn" real, "Lost" real, "Goals For" real, "Goals Against" real, "Goal Difference" text, "Points 1" text )
What is the sum of the positions for the player who had less than 25 losses, a goal difference of +20, 10 draws, and played less than 42?
SELECT SUM("Position") FROM table_50424 WHERE "Drawn" = '10' AND "Lost" < '25' AND "Goal Difference" = '+20' AND "Played" < '42'
wikisql
CREATE TABLE table_name_49 ( school VARCHAR, _number___county VARCHAR )
which school shows #/county of 29 hamilton?
SELECT school FROM table_name_49 WHERE _number___county = "29 hamilton"
sql_create_context
CREATE TABLE table_1341568_24 ( district VARCHAR, elected VARCHAR )
What are the locations where the year of election is 1980?
SELECT district FROM table_1341568_24 WHERE elected = 1980
sql_create_context
CREATE TABLE table_14981555_3 ( venue VARCHAR, race VARCHAR )
How many venues had a race called the Australia Stakes?
SELECT COUNT(venue) FROM table_14981555_3 WHERE race = "Australia Stakes"
sql_create_context
CREATE TABLE table_name_65 ( total_horses INTEGER, cows VARCHAR, bulls VARCHAR, total_cattle VARCHAR, oxen VARCHAR )
What was the lowest total number of horses that has a total cattle smaller than 6274.1, and a oxen smaller than 156.5, and a bulls of 40.0, and fewer than 3377 cows?
SELECT MIN(total_horses) FROM table_name_65 WHERE total_cattle < 6274.1 AND oxen < 156.5 AND bulls = "40.0" AND cows < 3377
sql_create_context
CREATE TABLE table_54283 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
What was the latest week of a game that had an attendance of 63,001?
SELECT MAX("Week") FROM table_54283 WHERE "Attendance" = '63,001'
wikisql
CREATE TABLE fault_log ( fault_log_entry_id number, asset_id number, recorded_by_staff_id number, fault_log_entry_datetime time, fault_description text, other_fault_details text ) CREATE TABLE third_party_companies ( company_id number, company_type text, company_name text, compa...
Which part has the least chargeable amount? List the part id and amount.
SELECT part_id, chargeable_amount FROM parts ORDER BY chargeable_amount LIMIT 1
spider
CREATE TABLE actor ( Actor_ID int, Name text, Musical_ID int, Character text, Duration text, age int ) CREATE TABLE musical ( Musical_ID int, Name text, Year int, Award text, Category text, Nominee text, Result text )
Draw a pie chart for how many actors have appeared in each musical?
SELECT T2.Name, COUNT(*) FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID
nvbench
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
did patient 83466 receive the excise lg intestine les procedure a year before?
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'excise lg intestine les') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 83466) AND DATETIME(pro...
mimic_iii
CREATE TABLE injury_accident ( game_id int, id int, Player text, Injury text, Number_of_matches text, Source text ) CREATE TABLE stadium ( id int, name text, Home_Games int, Average_Attendance real, Total_Attendance real, Capacity_Percentage real ) CREATE TABLE game ( ...
Bar chart x axis away team y axis the number of away team
SELECT Away_team, COUNT(Away_team) FROM game GROUP BY Away_team
nvbench
CREATE TABLE table_48564 ( "Driver" text, "Entrant" text, "Constructor" text, "Time/Retired" text, "Grid" text, "Heat 1/2" text )
What is the Time/Retired value for Ludovico Scarfiotti?
SELECT "Time/Retired" FROM table_48564 WHERE "Driver" = 'ludovico scarfiotti'
wikisql
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...
列出在2001年5月22日到2007年11月6日内开出的检验报告单在医院3701997中,不同检测指标名称以及不同检测指标结果定量单位下,检测指标结果定量的是多少平均值,并按平均值降序排序?
SELECT jyjgzbb.JCZBMC, jyjgzbb.JCZBJGDW, AVG(jyjgzbb.JCZBJGDL) FROM jyjgzbb JOIN jybgb_jyjgzbb JOIN jybgb ON jybgb_jyjgzbb.JYZBLSH = jyjgzbb.JYZBLSH AND jybgb_jyjgzbb.jyjgzbb_id = jyjgzbb.jyjgzbb_id AND jybgb_jyjgzbb.YLJGDM = jybgb.YLJGDM WHERE jybgb.YLJGDM = '3701997' AND jyjgzbb.BGRQ BETWEEN '2001-05-22' AND '2007-11...
css
CREATE TABLE table_name_11 ( rank VARCHAR, points INTEGER )
How much Rank has Points larger than 282.5?
SELECT COUNT(rank) FROM table_name_11 WHERE points > 282.5
sql_create_context
CREATE TABLE table_13312 ( "Number" real, "Sanskrit" text, "International Alphabet of Sanskrit Transliteration" text, "Sanskrit gloss" text, "Western name" text, "Greek" text, "Gloss" text, "Tattva (Element)" text, "Quality" text, "Ruling Planet" text )
What is the lowest number for the english word Aquarius?
SELECT MIN("Number") FROM table_13312 WHERE "Western name" = 'aquarius'
wikisql
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of founder and the amount of founder , and group by attribute founder.
SELECT Founder, COUNT(Founder) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder
nvbench
CREATE TABLE airlines ( country VARCHAR, name VARCHAR )
Find the country of the airlines whose name starts with 'Orbit'.
SELECT country FROM airlines WHERE name LIKE 'Orbit%'
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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
how many patients with death status 1 had drug name fluticasone-salmeterol(250/50)?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.expire_flag = "1" AND prescriptions.drug = "Fluticasone-Salmeterol (250/50) "
mimicsql_data
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...
Number of downvotes by answer score.
SELECT p.Score AS "score", COUNT(v.Id) AS "downvotes" FROM Votes AS v INNER JOIN Posts AS p ON p.Id = v.PostId WHERE p.PostTypeId = 2 AND v.VoteTypeId = 3 GROUP BY p.Score ORDER BY p.Score
sede
CREATE TABLE table_name_64 ( year_commissioned INTEGER, average_annual_output__million_kwh_ VARCHAR, installed_capacity__megawatts_ VARCHAR )
What is the earliest Year commissioned wiht an Average annual output greater than 58 and Installed capacity of 20?
SELECT MIN(year_commissioned) FROM table_name_64 WHERE average_annual_output__million_kwh_ > 58 AND installed_capacity__megawatts_ = 20
sql_create_context
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
number of posts in time slots.
SELECT DATEFROMPARTS(TIME_TO_STR(Users.CreationDate, '%Y'), 1, 1), TIME_TO_STR(Users.CreationDate, '%Y') AS rok, COUNT(Posts.Id) AS ilosc FROM Posts INNER JOIN Users ON Users.Id = Posts.OwnerUserId WHERE Posts.PostTypeId = 1 GROUP BY TIME_TO_STR(Users.CreationDate, '%Y') ORDER BY TIME_TO_STR(Users.CreationDate, '%Y')
sede
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) 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 T...
For all employees who have the letters D or S in their first name, visualize a bar chart about the distribution of job_id and the sum of salary , and group by attribute job_id, rank X from low to high order.
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID
nvbench
CREATE TABLE table_79368 ( "Members" text, "Teammate" text, "Couples Team" text, "Status" text, "Total Votes" text )
Who had 0 total votes in the purple team?
SELECT "Status" FROM table_79368 WHERE "Total Votes" = '0' AND "Couples Team" = 'purple team'
wikisql
CREATE TABLE candidate ( support_rate VARCHAR )
what are the top 3 highest support rates?
SELECT support_rate FROM candidate ORDER BY support_rate DESC LIMIT 3
sql_create_context
CREATE TABLE table_41395 ( "Year" real, "Senior PGA Championship" text, "The Tradition" text, "Senior Players Championship" text, "U.S. Senior Open" text, "Senior British Open" text )
When Tom Watson (5/6) won the Senior British Open who won the Senior PGA Championship?
SELECT "Senior PGA Championship" FROM table_41395 WHERE "Senior British Open" = 'tom watson (5/6)'
wikisql
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
count the number of patients whose admission year is less than 2156 and item id is 51419?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2156" AND lab.itemid = "51419"
mimicsql_data
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
在00年8月14日至12年6月6日之间编号为3907255的医疗机构里的患者对医疗项目自付比例的平均值为多少?
SELECT AVG(t_kc22.SELF_PAY_PRO) FROM t_kc22 WHERE t_kc22.t_kc21_MED_SER_ORG_NO = '3907255' AND t_kc22.STA_DATE BETWEEN '2000-08-14' AND '2012-06-06'
css
CREATE TABLE table_5713 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text, "Points" real )
What record has points less than 16, and detroit as the home?
SELECT "Record" FROM table_5713 WHERE "Points" < '16' AND "Home" = 'detroit'
wikisql
CREATE TABLE table_name_20 ( fa_cup_goals INTEGER, league_goals VARCHAR, club VARCHAR )
Which FA Cup goals have a League goals of 18, and a Club of sheffield united?
SELECT MAX(fa_cup_goals) FROM table_name_20 WHERE league_goals = "18" AND club = "sheffield united"
sql_create_context
CREATE TABLE table_71207 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
What is the 1st leg score when 2nd leg score is 3-3?
SELECT "1st leg" FROM table_71207 WHERE "2nd leg" = '3-3'
wikisql
CREATE TABLE table_77929 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text )
Who was the Home Team while Calgary was visiting while having an Attendance above 15,655?
SELECT "Home" FROM table_77929 WHERE "Visitor" = 'calgary' AND "Attendance" > '15,655'
wikisql
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text...
how many patients were treated with temporary tracheostomy within 2 months after they were diagnosed with chf nos since 2 years ago?
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 = 'chf nos') AND DATE...
mimic_iii
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions...
count the number of patients whose age is less than 79 and diagnoses short title is wheelchair dependence?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "79" AND diagnoses.short_title = "Wheelchair dependence"
mimicsql_data
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREAT...
tell me the name of the last specimen test that was given to patient 031-19622 when they visited the hospital last time?
SELECT microlab.culturesite FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-19622' AND NOT patient.hospitaldischargetime IS NULL ORDER BY pati...
eicu
CREATE TABLE table_name_8 ( start VARCHAR, stage VARCHAR )
What is the start of stage 11?
SELECT start FROM table_name_8 WHERE stage = 11
sql_create_context
CREATE TABLE table_204_928 ( id number, "year" number, "album" text, "territory" text, "label" text, "notes" text )
five was released in 1994 . what was the previous album released ?
SELECT "album" FROM table_204_928 WHERE "year" < 1994 ORDER BY "year" DESC LIMIT 1
squall
CREATE TABLE table_30108930_6 ( player VARCHAR, college VARCHAR )
Which player(s) played at Howard college?
SELECT player FROM table_30108930_6 WHERE college = "Howard"
sql_create_context
CREATE TABLE Product_Suppliers ( product_id INTEGER, supplier_id INTEGER, date_supplied_from DATETIME, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19,4) ) CREATE TABLE Department_Stores ( dept_store_id INTEGER, dept_store_chain_id INTEGER...
What is the lowest price of product, grouped by product type? Show a bar chart, sort Y-axis from high to low order.
SELECT product_type_code, MIN(product_price) FROM Products GROUP BY product_type_code ORDER BY MIN(product_price) DESC
nvbench
CREATE TABLE table_26462 ( "Overall Episode #" real, "Original airdate" text, "Iron Chef" text, "Challenger" text, "Challenger Specialty" text, "Theme Ingredient" text, "Winner" text )
Who was the challenger on Episode 5?
SELECT "Challenger" FROM table_26462 WHERE "Overall Episode #" = '5'
wikisql
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, a bar chart shows the distribution of headquarter and the sum of manufacturer , and group by attribute headquarter, and rank in ascending by the y-axis.
SELECT Headquarter, SUM(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY SUM(Manufacturer)
nvbench
CREATE TABLE table_26567 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real )
Who was the director for the episode airing on September 24, 1993?
SELECT "Directed by" FROM table_26567 WHERE "Original air date" = 'September 24, 1993'
wikisql
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 CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean...
Top Android Users in The Netherlands.
WITH USER_BY_TAG AS (SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS Rank, u.Id AS "user_link", COUNT(*) AS UpVotes FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.ParentId = pt.PostId INNER JOIN Votes AS v ON v.PostId = p.Id AND VoteTypeId = 2 INNER JOIN Users AS u ON u.Id =...
sede
CREATE TABLE customers_policies ( customer_id number, policy_id number, date_opened time, date_closed time ) CREATE TABLE settlements ( settlement_id number, claim_id number, effective_date time, settlement_amount number ) CREATE TABLE customers ( customer_id number, customer_n...
Give me a list of all the service names sorted alphabetically.
SELECT service_name FROM services ORDER BY service_name
spider
CREATE TABLE genres ( id number, name text ) CREATE TABLE albums ( id number, title text, artist_id number ) CREATE TABLE invoice_lines ( id number, invoice_id number, track_id number, unit_price number, quantity number ) CREATE TABLE tracks ( id number, name text, ...
How many tracks does each genre have and what are the names of the top 5?
SELECT T1.name, COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 5
spider
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...
为患者69016896检测指标301582的医务人员工号及姓名都是什么,从14年10月26日到15年11月3日这一年内?
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGD...
css
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of job_id and manager_id , list by the X from low to high.
SELECT JOB_ID, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY JOB_ID
nvbench
CREATE TABLE table_22173 ( "Year (Ceremony)" text, "Film title used in nomination" text, "Original title" text, "Director" text, "Result" text )
What was the original title of Run for Money?
SELECT "Original title" FROM table_22173 WHERE "Film title used in nomination" = 'Run for Money'
wikisql
CREATE TABLE table_11887 ( "Year" real, "Pick" real, "Player name" text, "Position" text, "College" text )
Which pick number resulted in a defensive end?
SELECT "Pick" FROM table_11887 WHERE "Position" = 'defensive end'
wikisql
CREATE TABLE table_name_91 ( tournament VARCHAR )
What tournament was at the 2007 Olympic Games?
SELECT tournament FROM table_name_91 WHERE 2007 = "olympic games"
sql_create_context
CREATE TABLE table_name_19 ( record_as_played VARCHAR, regular_season_vacated VARCHAR, season VARCHAR )
What is shown for Record as played with a Regular season Vacated of 24 0 later than 1997?
SELECT record_as_played FROM table_name_19 WHERE regular_season_vacated = "24–0" AND season > 1997
sql_create_context
CREATE TABLE table_name_15 ( away_team VARCHAR, venue VARCHAR )
What was the away team score at Windy Hill?
SELECT away_team AS score FROM table_name_15 WHERE venue = "windy hill"
sql_create_context
CREATE TABLE table_name_4 ( pos VARCHAR, laps VARCHAR, year VARCHAR )
What position has less than 343 laps in 2010?
SELECT pos FROM table_name_4 WHERE laps < 343 AND year = 2010
sql_create_context
CREATE TABLE table_name_71 ( home_team VARCHAR, away_team VARCHAR )
Which home team score has an Away team of melbourne?
SELECT home_team AS score FROM table_name_71 WHERE away_team = "melbourne"
sql_create_context
CREATE TABLE table_name_41 ( place VARCHAR, player VARCHAR )
What is the place of player chi-chi rodr guez?
SELECT place FROM table_name_41 WHERE player = "chi-chi rodríguez"
sql_create_context
CREATE TABLE review ( rid int, business_id varchar, user_id varchar, rating float, text longtext, year int, month varchar ) CREATE TABLE tip ( tip_id int, business_id varchar, text longtext, user_id varchar, likes int, year int, month varchar ) CREATE TABLE user...
Find all users who reviewed restaurant ' Mesa Grill
SELECT user.name FROM business, category, review, user WHERE business.name = 'Mesa Grill' AND category.business_id = business.business_id AND category.category_name = 'restaurant' AND review.business_id = business.business_id AND user.user_id = review.user_id
yelp
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 ...
从13年5月29号到19年9月12日,患者17750351的检测指标939792情况如何?
SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb....
css
CREATE TABLE table_29396 ( "Model Number" text, "Frequency" text, "L2 Cache" text, "HT" text, "Mult. 1" text, "Voltage" text, "TDP" text, "Socket" text, "Release date" text, "Order Part Number" text )
What's the ht for the model released on June 4, 2008?
SELECT "HT" FROM table_29396 WHERE "Release date" = 'June 4, 2008'
wikisql
CREATE TABLE table_7179 ( "Television service" text, "Country" text, "Language" text, "Content" text, "HDTV" text, "Package/Option" text )
What is Package/Option, when HDTV is no, when Language is Italian, and when Television service is cartello promozionale sky hd?
SELECT "Package/Option" FROM table_7179 WHERE "HDTV" = 'no' AND "Language" = 'italian' AND "Television service" = 'cartello promozionale sky hd'
wikisql
CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) ...
Bar chart x axis nationality y axis mean meter 100, I want to order from high to low by the Y-axis.
SELECT Nationality, AVG(meter_100) FROM swimmer GROUP BY Nationality ORDER BY AVG(meter_100) DESC
nvbench
CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int ) CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text )
Show different types of ships and the number of ships of each type in a bar chart, I want to list from low to high by the names.
SELECT Type, COUNT(*) FROM ship GROUP BY Type ORDER BY Type
nvbench
CREATE TABLE table_name_33 ( name VARCHAR, eliminated VARCHAR )
Who was eliminated on Banana Night?
SELECT name FROM table_name_33 WHERE eliminated = "banana night"
sql_create_context
CREATE TABLE table_16131 ( "No." real, "#" real, "Title" text, "Director" text, "Writer" text, "US air date" text, "Storyteller" text, "Villains" text )
How many villains appeared in the episode titled 'The Tale of the Virtual Pets'?
SELECT COUNT("Villains") FROM table_16131 WHERE "Title" = 'The Tale of The Virtual Pets'
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 allergy ( allergy...
what would be the minimum yearly number of patients diagnosed with leukemia - chronic lymphocytic since 2105?
SELECT MIN(t1.c1) FROM (SELECT COUNT(DISTINCT diagnosis.patientunitstayid) AS c1 FROM diagnosis WHERE diagnosis.diagnosisname = 'leukemia - chronic lymphocytic' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2105' GROUP BY STRFTIME('%y', diagnosis.diagnosistime)) AS t1
eicu
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
Find All_Road and Team_ID , and visualize them by a bar chart, and rank by the x axis from low to high.
SELECT All_Road, Team_ID FROM basketball_match ORDER BY All_Road
nvbench
CREATE TABLE table_name_17 ( d_42 VARCHAR, d_50 VARCHAR )
What is the D 42 when the D 50 is d 31?
SELECT d_42 FROM table_name_17 WHERE d_50 = "d 31"
sql_create_context
CREATE TABLE track ( track_id number, name text, location text, seating number, year_opened number ) CREATE TABLE race ( race_id number, name text, class text, date text, track_id text )
What are the years of opening for tracks with seating between 4000 and 5000?
SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000
spider
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID ...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, visualize the relationship between employee_id and commission_pct .
SELECT EMPLOYEE_ID, COMMISSION_PCT FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
nvbench
CREATE TABLE table_57214 ( "Year" text, "Champion" text, "Score" text, "Runner-Up" text, "Location" text, "Semi-Finalist #1" text, "Semi-Finalist #2" text )
What year saw a score of 8-5?
SELECT "Year" FROM table_57214 WHERE "Score" = '8-5'
wikisql
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...
医疗机构3422258的统筹金额消耗量从17年12月15日到20年5月4日间是多少数额?
SELECT SUM(t_kc24.OVE_PAY) FROM gwyjzb JOIN t_kc24 ON gwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE gwyjzb.MED_SER_ORG_NO = '3422258' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2017-12-15' AND '2020-05-04' UNION SELECT SUM(t_kc24.OVE_PAY) FROM fgwyjzb JOIN t_kc24 ON fgwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE fgwyj...
css
CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_p...
Were there PreMajor courses among the courses I 've taken ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN student_record ON student_record.course_id = course.course_id INNER JOIN program_course ON student_record.course_id = program_course.course_id WHERE program_course.category LIKE '%PreMajor%' AND student_record.student_id = 1
advising
CREATE TABLE driverstandings ( driverstandingsid number, raceid number, driverid number, points number, position number, positiontext text, wins number ) CREATE TABLE laptimes ( raceid number, driverid number, lap number, position number, time text, milliseconds numb...
What is the first and last name of all the German drivers?
SELECT forename, surname FROM drivers WHERE nationality = "German"
spider
CREATE TABLE table_47659 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
What is Time, when Method is 'submission (knees)'?
SELECT "Time" FROM table_47659 WHERE "Method" = 'submission (knees)'
wikisql
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 countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal...
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of job_id and manager_id , and order by the X-axis from low to high please.
SELECT JOB_ID, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY JOB_ID
nvbench
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_20...
Show me about the distribution of Time and ID in a bar chart.
SELECT Time, ID FROM swimmer
nvbench
CREATE TABLE table_8544 ( "Tournament" text, "Surface" text, "Week" text, "Winner and score" text, "Finalist" text, "Semifinalists" text )
Which Surface has a Semifinalist of stefan edberg thomas muster?
SELECT "Surface" FROM table_8544 WHERE "Semifinalists" = 'stefan edberg thomas muster'
wikisql
CREATE TABLE table_47305 ( "Rank" real, "Rank Forbes 2000" real, "Name" text, "Headquarters" text, "Revenue (Bn.$)" real, "Profit (Bn.$)" real, "Assets (Bn.$)" real, "Market value (Bn.$)" real, "Industry" text )
Which company had a market value less than $5.59 billion, assets greater than $27.46 billion, and a rank above 39?
SELECT "Name" FROM table_47305 WHERE "Market value (Bn.$)" < '5.59' AND "Rank" > '39' AND "Assets (Bn.$)" > '27.46'
wikisql
CREATE TABLE table_24803 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text )
What is the surface of the French Championships?
SELECT "Surface" FROM table_24803 WHERE "Championship" = 'French Championships'
wikisql