context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_name_12 ( match_report VARCHAR, date VARCHAR )
What is the match report of the match on 20 August?
SELECT match_report FROM table_name_12 WHERE date = "20 august"
sql_create_context
CREATE TABLE table_name_53 ( last_10_meetings VARCHAR, overall_record VARCHAR )
What is the record for the last 10 meetings when the overall record is *as of March 14, 2013?
SELECT last_10_meetings FROM table_name_53 WHERE overall_record = "*as of march 14, 2013"
sql_create_context
CREATE TABLE table_71403 ( "Date" text, "Tournament" text, "Surface" text, "Tier" text, "Partner" text, "Opponents in the final" text, "Score" text )
Which date has the tier of Itf $10k?
SELECT "Date" FROM table_71403 WHERE "Tier" = 'itf $10k'
wikisql
CREATE TABLE table_18958648_1 ( state_and_district_of_columbia VARCHAR, overweight__incl_obese__adults VARCHAR )
How many states or District of Columbia have 65.4% overweight or obese adults?
SELECT COUNT(state_and_district_of_columbia) FROM table_18958648_1 WHERE overweight__incl_obese__adults = "65.4%"
sql_create_context
CREATE TABLE table_76019 ( "Event" text, "Winner" text, "Second" text, "Third" text, "Fourth" text )
Who was Fourth in the 2008 Telstra Men's Pro Event?
SELECT "Fourth" FROM table_76019 WHERE "Event" = '2008 telstra men''s pro'
wikisql
CREATE TABLE table_25223 ( "Rnd" real, "Date" text, "Length" text, "Race Name" text, "Track" text, "Location" text, "Pole Position" text, "Winning Driver" text )
What rounds did Phoenix International Raceway host?
SELECT "Rnd" FROM table_25223 WHERE "Track" = 'Phoenix International Raceway'
wikisql
CREATE TABLE table_32273 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the date they played against fitzroy?
SELECT "Date" FROM table_32273 WHERE "Away team" = 'fitzroy'
wikisql
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE Badges ( Id number, UserId numb...
how many active answerers for a tag.
SELECT u.Id AS "user_link", COUNT(*) AS NumAnswers, SUM(CASE WHEN q.AcceptedAnswerId = a.Id THEN 1 ELSE 0 END) AS NumAccepted, (SUM(CASE WHEN q.AcceptedAnswerId = a.Id THEN 1 ELSE 0 END) * 100.0 / COUNT(*)) AS AcceptedPercent FROM Posts AS a INNER JOIN Users AS u ON u.Id = a.OwnerUserId INNER JOIN Posts AS q ON a.Paren...
sede
CREATE TABLE table_name_24 ( player VARCHAR, cfl_team VARCHAR )
Name the Player who has a CFL Team of toronto?
SELECT player FROM table_name_24 WHERE cfl_team = "toronto"
sql_create_context
CREATE TABLE table_49168 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is the score of T7 place?
SELECT "Score" FROM table_49168 WHERE "Place" = 't7'
wikisql
CREATE TABLE table_11659 ( "Sport" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
When athletics has a total more than 2 and 0 gold, what is the total number of bronze?
SELECT COUNT("Bronze") FROM table_11659 WHERE "Total" > '2' AND "Gold" = '0' AND "Sport" = 'athletics'
wikisql
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...
在2008年10月2日到2019年11月28日内医生65472198有多少门诊病人?
SELECT COUNT(hz_info.RYBH) FROM hz_info JOIN wdmzjzjlb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE wdmzjzjlb.ZZYSGH = '65472198' AND wdmzjzjlb.JZKSRQ BETWEEN '2008-10-02' AND '2019-11-28' UNION SELECT COUNT(hz_info.RYBH) FROM hz_info JOIN bdmzjzjlb ON hz_info...
css
CREATE TABLE table_name_67 ( power VARCHAR, chassis_code VARCHAR )
What is the power of the Chassis code w123.130?
SELECT power FROM table_name_67 WHERE chassis_code = "w123.130"
sql_create_context
CREATE TABLE table_19651669_1 ( finalist VARCHAR, season VARCHAR )
Who was the finalist in the season 2007-08?
SELECT finalist FROM table_19651669_1 WHERE season = "2007-08"
sql_create_context
CREATE TABLE table_name_94 ( general_classification VARCHAR, mountains_classification VARCHAR, team_classification VARCHAR )
What is the general classification for a mountains value of Christophe Moreau and a Team winner of Team CSC?
SELECT general_classification FROM table_name_94 WHERE mountains_classification = "christophe moreau" AND team_classification = "team csc"
sql_create_context
CREATE TABLE table_75468 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Save" text, "Attendance" real, "Record" text )
What was the attendance at game with a loss of Josh Hall (0 1)?
SELECT "Attendance" FROM table_75468 WHERE "Loss" = 'josh hall (0–1)'
wikisql
CREATE TABLE table_74394 ( "#" text, "Title" text, "Author" text, "Doctor" text, "Featuring companion" text, "Published" text, "ISBN" text, "Audiobook narrator" text )
What is the publication date of the book that is narrated by Michael Maloney?
SELECT "Published" FROM table_74394 WHERE "Audiobook narrator" = 'Michael Maloney'
wikisql
CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
what is the amount of input patient 21134 has received?
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 = 21134))
mimic_iii
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
show me the number of elective hospital admission patients who were hospitalized for more than 14 days.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.days_stay > "14"
mimicsql_data
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, ...
从0八年十二月六日开始,截止到一一年三月十一日,医院8895083的住院医疗记录总的数量有多少
SELECT COUNT(*) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '8895083' AND gwyjzb.IN_HOSP_DATE BETWEEN '2008-12-06' AND '2011-03-11' AND gwyjzb.CLINIC_TYPE = '住院' UNION SELECT COUNT(*) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '8895083' AND fgwyjzb.IN_HOSP_DATE BETWEEN '2008-12-06' AND '2011-03-11' AND fgwyjzb.CLINIC_TY...
css
CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE paperkeyphrase ( pap...
which EMNLP 2010 papers have the most citations ?
SELECT DISTINCT cite.citedpaperid, COUNT(cite.citedpaperid) FROM cite, paper, venue WHERE paper.paperid = cite.citedpaperid AND paper.year = 2010 AND venue.venueid = paper.venueid AND venue.venuename = 'EMNLP' GROUP BY cite.citedpaperid ORDER BY COUNT(cite.citedpaperid) DESC
scholar
CREATE TABLE table_78477 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
What is the venue for the friendly competition and score of 4-0?
SELECT "Venue" FROM table_78477 WHERE "Score" = '4-0' AND "Competition" = 'friendly'
wikisql
CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INTEGER, Price INTEGER, Score INTEGER, Cases INTEGER, Drink TEXT ) CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area...
Bin the year attribute into the Year interval and count them for a bar chart.
SELECT Year, COUNT(Year) FROM wine
nvbench
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END...
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, find hire_date and the average of salary bin hire_date by time, and visualize them by a bar chart.
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
nvbench
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) 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 va...
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about the average of department_id over the hire_date bin hire_date by weekday by a bar chart, list in asc by the y axis.
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(DEPARTMENT_ID)
nvbench
CREATE TABLE table_71228 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" real )
Where has Jimmy Demaret as a player?
SELECT "Place" FROM table_71228 WHERE "Player" = 'jimmy demaret'
wikisql
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId...
Initiated most closures as dupe. The query *is not exact* on at least two reasons: 1) dupe closures initiated by flags aren't counted, the first actual close voter is counted instead 2) it is not sure that the first close voter voted for the post as dupe (he was just the first of the close-voters, whose majority of the...
WITH Raw AS (SELECT CAST(JSON_EXTRACT_SCALAR(Text, '$.Voters0.Id') AS INT) AS DupeCloser FROM PostHistory WHERE PostHistoryTypeId = 10 AND Comment IN (1, 101)) SELECT DupeCloser AS "user_link", DupeCloser AS UserId, COUNT(*) AS Count FROM Raw GROUP BY DupeCloser ORDER BY Count DESC, UserId
sede
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 correlation between code and price in a scatter chart.
SELECT T1.Code, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code
nvbench
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 ) ...
Calculate the maximum age of patients with hyperglycemia as their primary disease who died before 2131
SELECT MAX(demographic.age) FROM demographic WHERE demographic.diagnosis = "HYPERGLYCEMIA" AND demographic.dod_year < "2131.0"
mimicsql_data
CREATE TABLE table_28546 ( "Round" text, "Circuit" text, "Date" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Winning Team" text )
In the circuit Showevent Olympiastadion M nchen, where the winning driver is Bruno Spengler, what is the pole position?
SELECT "Pole Position" FROM table_28546 WHERE "Winning Driver" = 'Bruno Spengler' AND "Circuit" = 'Showevent Olympiastadion München'
wikisql
CREATE TABLE table_204_349 ( id number, "year" number, "conservative\ncouncillors" number, "labour\ncouncillors" number, "independent\ncouncillors" number, "liberal\ncouncillors" number )
did the year 1957 have more or less than 4 liberal councillors ?
SELECT (SELECT "liberal\ncouncillors" FROM table_204_349 WHERE "year" = 1957) > 4
squall
CREATE TABLE table_name_86 ( draws INTEGER, played VARCHAR, goal_difference VARCHAR, club VARCHAR )
What was the number of draws when the Elche CF club played 38 and had a goal difference of -16?
SELECT MIN(draws) FROM table_name_86 WHERE goal_difference > -16 AND club = "elche cf" AND played > 38
sql_create_context
CREATE TABLE table_name_59 ( attendance INTEGER, result VARCHAR )
What is the lowest attendance of a game that has the result of 2-0?
SELECT MIN(attendance) FROM table_name_59 WHERE result = "2-0"
sql_create_context
CREATE TABLE table_19225 ( "Institution" text, "Location" text, "Established" real, "Gained university status" real, "Vice-chancellor" text, "Total Number of Students" real, "Research Funding (\u00a3,000)" real )
What is the year leicester was established?
SELECT MAX("Established") FROM table_19225 WHERE "Location" = 'Leicester'
wikisql
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(4...
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about the average of manager_id over the hire_date bin hire_date by time, and order in asc by the y-axis.
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(MANAGER_ID)
nvbench
CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime tim...
has patient 17435 been given any k-phos 20mmol/500cc intake on the first intensive care unit visit?
SELECT COUNT(*) > 0 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 = 17435) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND inputevents_cv.itemid IN (...
mimic_iii
CREATE TABLE table_204_294 ( id number, "date" text, "time" text, "opponent#" text, "rank#" text, "site" text, "tv" text, "result" text, "attendance" number )
the nebraska cornhuskers last game was played where
SELECT "site" FROM table_204_294 ORDER BY "date" DESC LIMIT 1
squall
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ...
give me the number of patients whose death status is 0 and year of birth is less than 2104?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.dob_year < "2104"
mimicsql_data
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, ...
Top Stack Overflow users from Pakistan by reputation.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%pakistan%' ORDER BY Reputation DESC
sede
CREATE TABLE people ( Age INTEGER, People_ID VARCHAR ) CREATE TABLE gymnast ( Gymnast_ID VARCHAR )
What is the average age of all gymnasts?
SELECT AVG(T2.Age) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID
sql_create_context
CREATE TABLE table_name_34 ( tie_no VARCHAR, home_team VARCHAR )
What was the Tie no when the Home team was wealdstone?
SELECT tie_no FROM table_name_34 WHERE home_team = "wealdstone"
sql_create_context
CREATE TABLE table_47161 ( "Round" real, "Pick" text, "Player" text, "Position" text, "School/Club Team" text )
Which Position has a Pick of 11 (via calgary)?
SELECT "Position" FROM table_47161 WHERE "Pick" = '11 (via calgary)'
wikisql
CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) CREATE TABLE PROFESS...
Find the total number of hours have done for all students in each department Visualize by bar chart, and display Y in asc order.
SELECT DEPT_CODE, SUM(STU_HRS) FROM STUDENT GROUP BY DEPT_CODE ORDER BY SUM(STU_HRS)
nvbench
CREATE TABLE table_name_86 ( date VARCHAR, record VARCHAR )
When was the game played in which the record was 46-29?
SELECT date FROM table_name_86 WHERE record = "46-29"
sql_create_context
CREATE TABLE table_name_3 ( championship VARCHAR, surface VARCHAR, opponent_in_the_final VARCHAR )
What is the Championship with Vitas Gerulaitis as Opponent in the final in a match on Clay Surface?
SELECT championship FROM table_name_3 WHERE surface = "clay" AND opponent_in_the_final = "vitas gerulaitis"
sql_create_context
CREATE TABLE table_name_12 ( pick INTEGER, team VARCHAR )
What is the average pick of the kansas city chiefs?
SELECT AVG(pick) FROM table_name_12 WHERE team = "kansas city chiefs"
sql_create_context
CREATE TABLE table_name_69 ( attendance INTEGER, group_position VARCHAR, result_f_a VARCHAR )
Group position of 1st, and a Result F A of 2 0 has what average attendance?
SELECT AVG(attendance) FROM table_name_69 WHERE group_position = "1st" AND result_f_a = "2–0"
sql_create_context
CREATE TABLE table_76125 ( "Television service" text, "Country" text, "Language" text, "Content" text, "HDTV" text, "Package/Option" text )
What is the Language when the Reteconomy is the television service?
SELECT "Language" FROM table_76125 WHERE "Television service" = 'reteconomy'
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 ) ...
Get me the number of patients born before 2065 who had an unspecified colostomy.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2065" AND procedures.short_title = "Colostomy NOS"
mimicsql_data
CREATE TABLE table_203_441 ( id number, "rank" number, "athlete" text, "ski time" text, "penalties\np+s+p+s" text, "total" text )
what are the number of athletes ?
SELECT COUNT("athlete") FROM table_203_441
squall
CREATE TABLE table_name_70 ( date VARCHAR, japan VARCHAR )
Which date had Japanese sales of 0.59 million?
SELECT date FROM table_name_70 WHERE japan = "0.59 million"
sql_create_context
CREATE TABLE fzzmzjzjlb ( 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...
列出患者柳阳文所有检验结果指标记录的检测人为61543019的检验指标流水号有多少在在2007-05-14到2020-07-28内?
SELECT jyjgzbb.JYZBLSH FROM person_info JOIN hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jyb...
css
CREATE TABLE table_name_61 ( years_at_club VARCHAR, games VARCHAR, goals VARCHAR, debut_year VARCHAR )
What are the years for the player with fewer than 62 goals, debut year of 1981 and 28 games?
SELECT years_at_club FROM table_name_61 WHERE goals < 62 AND debut_year = 1981 AND games = 28
sql_create_context
CREATE TABLE table_name_6 ( date VARCHAR, week VARCHAR )
What is the Date of Week 9?
SELECT date FROM table_name_6 WHERE week = 9
sql_create_context
CREATE TABLE table_name_66 ( group VARCHAR, formula VARCHAR )
Which group has the RNCS formula?
SELECT group FROM table_name_66 WHERE formula = "rncs"
sql_create_context
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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE departments ( DEP...
For those employees who did not have any job in the past, visualize a bar chart about the distribution of job_id and the sum of department_id , and group by attribute job_id, order from low to high by the X-axis.
SELECT JOB_ID, SUM(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID
nvbench
CREATE TABLE table_27853 ( "Settlement" text, "Cyrillic Name Other Names" text, "Type" text, "Population (2011)" real, "Largest ethnic group (2002)" text, "Dominant religion (2002)" text )
When is the cyrillic name other names what is the type?
SELECT "Type" FROM table_27853 WHERE "Cyrillic Name Other Names" = 'Оџаци'
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 prescriptions...
calculate the maximum age of medicaid patients who belong to hispanic or latino ethnic background.
SELECT MAX(demographic.age) FROM demographic WHERE demographic.insurance = "Medicaid" AND demographic.ethnicity = "HISPANIC OR LATINO"
mimicsql_data
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 ) ...
what is the number of patients whose year of death is less than or equal to 2131 and procedure icd9 code is 14?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2131.0" AND procedures.icd9_code = "14"
mimicsql_data
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
first time patient 006-157753 was diagnosed with ventricular fibrillation in their current hospital visit?
SELECT diagnosis.diagnosistime FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-157753' AND patient.hospitaldischargetime IS NULL)) AND diagn...
eicu
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25...
For those employees who did not have any job in the past, give me the comparison about the average of manager_id over the hire_date bin hire_date by time, and I want to order total number from low to high order.
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(MANAGER_ID)
nvbench
CREATE TABLE table_26847237_2 ( position VARCHAR, player VARCHAR )
What position does the player Todd Wise play in?
SELECT position FROM table_26847237_2 WHERE player = "Todd Wise"
sql_create_context
CREATE TABLE table_12203 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" text, "Finish" text )
Which Year(s) won has a Total smaller than 276? Question 1
SELECT "Year(s) won" FROM table_12203 WHERE "Total" < '276'
wikisql
CREATE TABLE table_24048 ( "Displacement" text, "Bore" text, "Stroke" text, "Cylinders" text, "Valves" real, "Power" text, "Torque" text, "Applications" text )
For the 1999 w210 e-class , 2000 w203 c-class, what is the stroke?
SELECT "Stroke" FROM table_24048 WHERE "Applications" = '1999 W210 E-Class , 2000 W203 C-Class'
wikisql
CREATE TABLE table_72880 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
how many high assists stats were maade on february 4
SELECT COUNT("High assists") FROM table_72880 WHERE "Date" = 'February 4'
wikisql
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) 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, lan...
was patient 20898 prescribed artificial tear ointment in the current hospital encounter?
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20898 AND admissions.dischtime IS NULL) AND prescriptions.drug = 'artificial tear ointment'
mimic_iii
CREATE TABLE table_23361 ( "Rd." text, "Race" text, "Pole position" text, "Fastest lap" text, "Most laps led" text, "Winning driver" text, "Winning team" text, "Report" text )
How many winning drivers are there when the winning team is Bryan herta autosport?
SELECT COUNT("Winning driver") FROM table_23361 WHERE "Winning team" = 'Bryan Herta Autosport'
wikisql
CREATE TABLE table_101336_1 ( notation VARCHAR, crystal_structure VARCHAR, formula VARCHAR )
What is the notion when the crystal structure is tetragonal and the formula is bi 2 sr 2 cacu 2 o 8
SELECT notation FROM table_101336_1 WHERE crystal_structure = "Tetragonal" AND formula = "Bi 2 Sr 2 CaCu 2 O 8"
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...
what is the number of patients whose age is less than 76 and drug name is norepinephrine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "76" AND prescriptions.drug = "NORepinephrine"
mimicsql_data
CREATE TABLE table_55262 ( "Date" text, "Tournament" text, "Surface" text, "Opponent in the final" text, "Score" text )
What was the court surface when the score was 6 4, 6 1?
SELECT "Surface" FROM table_55262 WHERE "Score" = '6–4, 6–1'
wikisql
CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10), payment_method_description VARCHAR(80) ) CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER, Performer_ID INTEGER ) CREATE TABLE Performers ( Performer_ID INTEGER, Address_ID INTEGER, Customer_Name VARCHAR(255), Custo...
How many services for each service type description? Use a pie chart to show it.
SELECT Service_Type_Description, COUNT(*) FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code GROUP BY T2.Service_Type_Code
nvbench
CREATE TABLE table_name_68 ( location VARCHAR, year VARCHAR, result VARCHAR )
what is the location when the year is before 1979 and the result is 19-17?
SELECT location FROM table_name_68 WHERE year < 1979 AND result = "19-17"
sql_create_context
CREATE TABLE table_name_62 ( category VARCHAR, recipient VARCHAR, year VARCHAR )
What category was The Suite Life on Deck nominated for later than 2010?
SELECT category FROM table_name_62 WHERE recipient = "the suite life on deck" AND year > 2010
sql_create_context
CREATE TABLE table_name_56 ( home VARCHAR, date VARCHAR )
On October 31 what team played at home?
SELECT home FROM table_name_56 WHERE date = "october 31"
sql_create_context
CREATE TABLE Tourist_Attractions ( Tourist_Attraction_ID INTEGER, Attraction_Type_Code CHAR(15), Location_ID INTEGER, How_to_Get_There VARCHAR(255), Name VARCHAR(255), Description VARCHAR(255), Opening_Hours VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Street_Markets ( Ma...
What are the number of the distinct visit dates?, show by the Y in descending.
SELECT Visit_Date, COUNT(Visit_Date) FROM Visits ORDER BY COUNT(Visit_Date) DESC
nvbench
CREATE TABLE table_203_646 ( id number, "year" number, "competition" text, "venue" text, "position" text, "notes" text )
what were the number of competitions held in 2003 ?
SELECT COUNT("competition") FROM table_203_646 WHERE "year" = 2003
squall
CREATE TABLE table_16919 ( "Date" text, "Tournament" text, "Location" text, "Purse( $ )" real, "Winner" text, "Score" text, "1st Prize( $ )" real )
Name the tournament for arizona
SELECT "Tournament" FROM table_16919 WHERE "Location" = 'Arizona'
wikisql
CREATE TABLE hz_info_zyjzjlb ( JZLSH number, YLJGDM number, zyjzjlb_id number ) CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW t...
列出郑波涛在8549699的就诊记录里,患者出院科室的名字有关节病字样的住院就诊记录
SELECT * FROM person_info JOIN hz_info JOIN zyjzjlb JOIN hz_info_zyjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND hz_info_zyjzjlb.JZLSH = zyjzjlb.JZLSH AND hz_info_zyjzjlb.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info_zyjz...
css
CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Has_Allergy ( StuID INTEGER, Allergy VARCHAR(20) ) CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), ...
What is the number of each allergie type? Return a bar chart.
SELECT AllergyType, COUNT(AllergyType) FROM Allergy_Type GROUP BY AllergyType
nvbench
CREATE TABLE table_name_80 ( latin VARCHAR, greek VARCHAR )
What is the Latin term for the Greek symbol ?
SELECT latin FROM table_name_80 WHERE greek = "μ"
sql_create_context
CREATE TABLE table_203_288 ( id number, "season" text, "premiere date" text, "the winner" text, "runner-up" text, "finalists" text, "contestants in order of elimination" text, "number of contestants" text, "number of concerts" number )
how many contestants were there on june 3 , 2012 ?
SELECT "number of contestants" FROM table_203_288 WHERE "premiere date" = 'june 3, 2012'
squall
CREATE TABLE table_name_46 ( place VARCHAR, to_par VARCHAR, score VARCHAR )
What is the Place when the To par was +3 and Score was 74-73=147?
SELECT place FROM table_name_46 WHERE to_par = "+3" AND score = 74 - 73 = 147
sql_create_context
CREATE TABLE table_60351 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What is the Home team in the game with a Score of 2 3?
SELECT "Home team" FROM table_60351 WHERE "Score" = '2–3'
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, ...
依据科室编码和入院诊断疾病编码的不同,查出医院1830315全部医疗就诊记录中患者的平均年龄是多少
SELECT gwyjzb.MED_ORG_DEPT_CD, gwyjzb.IN_DIAG_DIS_CD, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '1830315' GROUP BY gwyjzb.MED_ORG_DEPT_CD, gwyjzb.IN_DIAG_DIS_CD UNION SELECT fgwyjzb.MED_ORG_DEPT_CD, fgwyjzb.IN_DIAG_DIS_CD, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '18303...
css
CREATE TABLE table_26862 ( "Season" real, "Series" text, "Team" text, "Races" real, "Wins" real, "Poles" real, "FLaps" real, "Podiums" real, "Points" text, "Position" text )
Name the most races for flaps larger than 2.0
SELECT MAX("Races") FROM table_26862 WHERE "FLaps" > '2.0'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text ) CREATE TABLE person_info_hz_info ( RYBH text, KH number, KLX number, YLJGDM number ) CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH tex...
在张秀媛的患者的检查过程中有哪些检验报告单对应的检验结果指标是都不正常的?具体的检验报告单号是啥?
SELECT jybgb.BGDH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN person_info_hz_info ON person_info.RYBH = person_info_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 ...
css
CREATE TABLE table_name_72 ( s_barangay INTEGER, area___has__ INTEGER )
What is the total of Barangay with an area larger than 865.13?
SELECT SUM(s_barangay) FROM table_name_72 WHERE area___has__ > 865.13
sql_create_context
CREATE TABLE table_14132239_3 ( defensive VARCHAR, month VARCHAR, rookie VARCHAR )
Who was the defensive award winner in February when the rookie award was given to Rhys Duch?
SELECT defensive FROM table_14132239_3 WHERE month = "February" AND rookie = "Rhys Duch"
sql_create_context
CREATE TABLE table_name_75 ( bronze INTEGER, nation VARCHAR, silver VARCHAR )
How many Bronze medals did Switzerland with less than 3 Silver medals receive?
SELECT MIN(bronze) FROM table_name_75 WHERE nation = "switzerland" AND silver < 3
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...
请提供云秀美这位病患从17.9.12起,截止到20.12.29期间就诊医生数
SELECT COUNT(mzjzjlb.ZZYSGH) FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.person_info_XM = '云秀美' AND mzjzjlb.JZKSRQ BETWEEN '2017-09-12' AND '2020-12-29'
css
CREATE TABLE table_2655016_10 ( season__number INTEGER, nick_prod__number VARCHAR )
What was the latest season with a nick production number of 942?
SELECT MAX(season__number) FROM table_2655016_10 WHERE nick_prod__number = 942
sql_create_context
CREATE TABLE table_name_7 ( highest_elevation VARCHAR, highest_point VARCHAR )
What is the highest elevation for the highest point of Schnebelhorn?
SELECT highest_elevation FROM table_name_7 WHERE highest_point = "schnebelhorn"
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate n...
does patient 009-8833 go to a hospital since 6 years ago?
SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '009-8833' AND DATETIME(patient.hospitaladmittime) >= DATETIME(CURRENT_TIME(), '-6 year')
eicu
CREATE TABLE products ( product_price INTEGER )
How many products have a price higher than the average?
SELECT COUNT(*) FROM products WHERE product_price > (SELECT AVG(product_price) FROM products)
sql_create_context
CREATE TABLE table_67238 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
Name the outcome with tournament of mexico f12, obreg n
SELECT "Outcome" FROM table_67238 WHERE "Tournament" = 'mexico f12, obregón'
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...
give me the number of patients whose ethnicity is hispanic/latino - puerto rican and drug name is albuterol?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND prescriptions.drug = "Albuterol"
mimicsql_data
CREATE TABLE Purchases ( purchase_transaction_id INTEGER, purchase_details VARCHAR(255) ) CREATE TABLE Ref_Transaction_Types ( transaction_type_code VARCHAR(10), transaction_type_description VARCHAR(80) ) CREATE TABLE Investors ( investor_id INTEGER, Investor_details VARCHAR(255) ) CREATE TAB...
Show the number of transactions with transaction type code 'SALE' for different investors if it is larger than 0. Show the correlation.
SELECT investor_id, COUNT(*) FROM Transactions WHERE transaction_type_code = "SALE" GROUP BY investor_id
nvbench
CREATE TABLE furniture_manufacte ( Manufacturer_ID int, Furniture_ID int, Price_in_Dollar real ) CREATE TABLE furniture ( Furniture_ID int, Name text, Num_of_Component int, Market_Rate real ) CREATE TABLE manufacturer ( Manufacturer_ID int, Open_Year real, Name text, Num_of...
Visualize names and market shares of furnitures which no any company is producing in our records by a bar chart, show in ascending by the bars.
SELECT Name, Market_Rate FROM furniture WHERE NOT Furniture_ID IN (SELECT Furniture_ID FROM furniture_manufacte) ORDER BY Name
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 ...
how many hours has been passed since the last time patient 40707 stayed in ward 33 during their current hospital encounter?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 40707 AND admissions.dischtime IS NULL)) AND transfers...
mimic_iii
CREATE TABLE table_31483 ( "Country" text, "Number of Troops" real, "% of Total Troops" text, "Troops per one million population" text, "Troops per $1 billion ( USD ) GDP" text )
Name the country for troops per one million being 54.9
SELECT "Country" FROM table_31483 WHERE "Troops per one million population" = '54.9'
wikisql