context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL v...
For those employees who do not work in departments with managers that have ids between 100 and 200, return a line chart about the change of salary over hire_date , could you sort by the x axis in asc please?
SELECT HIRE_DATE, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY HIRE_DATE
nvbench
CREATE TABLE table_2328113_1 ( population__2011_ INTEGER )
What was the minimum population in 2011?
SELECT MIN(population__2011_) FROM table_2328113_1
sql_create_context
CREATE TABLE music_festival ( Date_of_ceremony VARCHAR, Category VARCHAR, RESULT VARCHAR )
What are the date of ceremony of music festivals with category 'Best Song' and result 'Awarded'?
SELECT Date_of_ceremony FROM music_festival WHERE Category = "Best Song" AND RESULT = "Awarded"
sql_create_context
CREATE TABLE table_59980 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is the Country of the Player in Place 1?
SELECT "Country" FROM table_59980 WHERE "Place" = '1'
wikisql
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGu...
users by location (stack overflow).
SELECT u.Id, u.DisplayName, u.Reputation, u.WebsiteUrl, u.Age, u.LastAccessDate, u.Location FROM Users AS u WHERE (LOWER(u.Location) LIKE LOWER('##Location:string##')) OR (LOWER(u.Location) LIKE LOWER('##AltLocation:string##')) OR (LOWER(u.Location) LIKE LOWER('##AltLocation2:string##')) ORDER BY u.Reputation DESC LIMI...
sede
CREATE TABLE table_41301 ( "Date" text, "Tournament" text, "Surface" text, "Partnering" text, "Opponent in the final" text, "Score" text )
Which tournament was played on 12 February 2001?
SELECT "Tournament" FROM table_41301 WHERE "Date" = '12 february 2001'
wikisql
CREATE TABLE table_56788 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Attendance" real, "Record" text )
Who is the leading scorer when they were at home of the Clippers?
SELECT "Leading scorer" FROM table_56788 WHERE "Home" = 'clippers'
wikisql
CREATE TABLE table_name_10 ( prize VARCHAR, event VARCHAR )
What is the Prize, when the Event is Ept Deauville?
SELECT prize FROM table_name_10 WHERE event = "ept deauville"
sql_create_context
CREATE TABLE table_34022 ( "Rank" text, "City" text, "Population" real, "Area (km 2 )" real, "Density (inhabitants/km 2 )" real, "Altitude (mslm)" real )
What is the lowest density of alessandria where the area is bigger than 16.02 and altitude is less than 116?
SELECT MIN("Density (inhabitants/km 2 )") FROM table_34022 WHERE "Area (km 2 )" > '16.02' AND "Altitude (mslm)" < '116' AND "City" = 'alessandria'
wikisql
CREATE TABLE table_name_65 ( surface VARCHAR, round VARCHAR, edition VARCHAR )
what is the surface when the round is gii play-offs and the edition is 2009 fed cup europe/africa group ii?
SELECT surface FROM table_name_65 WHERE round = "gii play-offs" AND edition = "2009 fed cup europe/africa group ii"
sql_create_context
CREATE TABLE table_name_35 ( laps VARCHAR, grid VARCHAR )
How many laps were there for a grid of 13?
SELECT COUNT(laps) FROM table_name_35 WHERE grid = 13
sql_create_context
CREATE TABLE table_3381 ( "Episode #" real, "The W\u00f8rd" text, "Guest" text, "Introductory phrase" text, "Original airdate" text, "Production code" real )
What was the number of 'The Word' segments for episode number 727?
SELECT COUNT("The W\u00f8rd") FROM table_3381 WHERE "Episode #" = '727'
wikisql
CREATE TABLE table_203_695 ( id number, "draw" number, "artist" text, "song" text, "points" number, "place" text )
which was the only song to earn less than 60 points ?
SELECT "song" FROM table_203_695 WHERE "points" < 60
squall
CREATE TABLE county ( County_Id int, County_name text, Population real, Zip_code text ) CREATE TABLE party ( Party_ID int, Year real, Party text, Governor text, Lieutenant_Governor text, Comptroller text, Attorney_General text, US_Senate text ) CREATE TABLE election ( ...
Who were the comptrollers of the parties associated with the delegates from district 1 or district 2, and count them by a bar chart, and show in desc by the Y.
SELECT Comptroller, COUNT(Comptroller) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2 GROUP BY Comptroller ORDER BY COUNT(Comptroller) DESC
nvbench
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
医疗记录中年龄高于20岁的患者的医疗费平均金额是多少
SELECT AVG(MED_AMOUT) FROM t_kc24 WHERE MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_AGE >= 20)
css
CREATE TABLE furniture ( name VARCHAR, furniture_id VARCHAR, market_rate VARCHAR )
Return the name and id of the furniture with the highest market rate.
SELECT name, furniture_id FROM furniture ORDER BY market_rate DESC LIMIT 1
sql_create_context
CREATE TABLE table_31015 ( "Team" text, "Contest and round" text, "Opponent" text, "1st leg score*" text, "2nd leg score**" text, "Aggregate score" text )
what was the name of the team opponent to elfsborg
SELECT "Team" FROM table_31015 WHERE "Opponent" = 'Elfsborg'
wikisql
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
what number of patients admitted before the year 2110 were diagnosed with cholelith/ac gb inf-obst?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2110" AND diagnoses.short_title = "Cholelith/ac gb inf-obst"
mimicsql_data
CREATE TABLE table_name_46 ( country VARCHAR, name VARCHAR )
Name the country for pieroni
SELECT country FROM table_name_46 WHERE name = "pieroni"
sql_create_context
CREATE TABLE table_69027 ( "Appearances" real, "Team" text, "Wins" real, "Losses" real, "Winning percentage" real, "Season(s)" text )
In 2009, what Appearances had a Winning Percentage of less than 0?
SELECT AVG("Appearances") FROM table_69027 WHERE "Season(s)" = '2009' AND "Winning percentage" < '0'
wikisql
CREATE TABLE table_9807 ( "Rank" real, "Title" text, "Studio" text, "Director" text, "Worldwide Gross" text )
What studio is director Reginald Hudlin from?
SELECT "Studio" FROM table_9807 WHERE "Director" = 'reginald hudlin'
wikisql
CREATE TABLE table_44094 ( "Usage" text, "Class" text, "Performance" text, "Performance test" text, "Particulate size approaching 100% retention" text, "Test Standard" text )
Which Test Standard has a Usage of secondary filters, and a Class of f5? Question 4
SELECT "Test Standard" FROM table_44094 WHERE "Usage" = 'secondary filters' AND "Class" = 'f5'
wikisql
CREATE TABLE table_name_38 ( year_started INTEGER, current_car VARCHAR, number_of_cars VARCHAR )
Which Year started is the highest one that has a Current car of arctic sun, and a Number of cars smaller than 1?
SELECT MAX(year_started) FROM table_name_38 WHERE current_car = "arctic sun" AND number_of_cars < 1
sql_create_context
CREATE TABLE flight ( id int, Vehicle_Flight_number text, Date text, Pilot text, Velocity real, Altitude real, airport_id int, company_id int ) CREATE TABLE operate_company ( id int, name text, Type text, Principal_activities text, Incorporated_in text, Group_Equ...
How many companies that have ever operated a flight for each type? Draw a bar chart, I want to rank from low to high by the x axis.
SELECT Type, COUNT(Type) FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id GROUP BY Type ORDER BY Type
nvbench
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
When did the patient Paul Edwards die?
SELECT demographic.dod FROM demographic WHERE demographic.name = "Paul Edwards"
mimicsql_data
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 hispanic or latino patients were aged below 20 years?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND demographic.age < "20"
mimicsql_data
CREATE TABLE table_65835 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
How many Gold medals for the Nations with 6 or more Bronze medals and 18 or more Silver?
SELECT AVG("Gold") FROM table_65835 WHERE "Bronze" > '6' AND "Silver" > '18'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
按照科室名和入院诊断病名的差异算出医院9841208所有的记录里病人的平均岁数
SELECT gwyjzb.MED_ORG_DEPT_NM, gwyjzb.IN_DIAG_DIS_NM, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '9841208' GROUP BY gwyjzb.MED_ORG_DEPT_NM, gwyjzb.IN_DIAG_DIS_NM UNION SELECT fgwyjzb.MED_ORG_DEPT_NM, fgwyjzb.IN_DIAG_DIS_NM, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '98412...
css
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
tell me the birth date and marital status of patient jerry deberry.
SELECT demographic.marital_status, demographic.dob FROM demographic WHERE demographic.name = "Jerry Deberry"
mimicsql_data
CREATE TABLE table_60255 ( "Opposing Teams" text, "Against" real, "Date" text, "Venue" text, "Status" text )
What is the highest number against on 12/04/1969?
SELECT MAX("Against") FROM table_60255 WHERE "Date" = '12/04/1969'
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
give me the number of patients whose primary disease is upper gi bleed and procedure icd9 code is 66?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "UPPER GI BLEED" AND procedures.icd9_code = "66"
mimicsql_data
CREATE TABLE table_21058823_1 ( result VARCHAR, record VARCHAR )
What did they do in the game when their record was 3-2-1?
SELECT result FROM table_21058823_1 WHERE record = "3-2-1"
sql_create_context
CREATE TABLE storm ( Storm_ID int, Name text, Dates_active text, Max_speed int, Damage_millions_USD real, Number_Deaths int ) CREATE TABLE affected_region ( Region_id int, Storm_ID int, Number_city_affected real ) CREATE TABLE region ( Region_id int, Region_code text, R...
For all storms with at least 1 death, compare the total number of deaths by dates_active attribute.
SELECT Dates_active, Number_Deaths FROM storm WHERE Number_Deaths >= 1
nvbench
CREATE TABLE table_name_92 ( score VARCHAR, visitor VARCHAR, date VARCHAR )
What is the score of the Boston Bruins away game on March 13?
SELECT score FROM table_name_92 WHERE visitor = "boston bruins" AND date = "march 13"
sql_create_context
CREATE TABLE table_56443 ( "Rank" real, "Movie" text, "Year" real, "Studio(s)" text, "Opening Day Net Gross" real, "Day of Week" text )
What is the average rank of the Reliance Entertainment movie with an opening day on Wednesday before 2012?
SELECT AVG("Rank") FROM table_56443 WHERE "Day of Week" = 'wednesday' AND "Year" < '2012' AND "Studio(s)" = 'reliance entertainment'
wikisql
CREATE TABLE table_name_79 ( swimsuit INTEGER, average VARCHAR, interview VARCHAR )
What is the sum of Swimsuit scores where the average score is 9.733 and the interview score is higher than 9.654?
SELECT SUM(swimsuit) FROM table_name_79 WHERE average = 9.733 AND interview > 9.654
sql_create_context
CREATE TABLE table_name_44 ( cuts_made VARCHAR, events VARCHAR, top_25 VARCHAR )
What is the total number of cuts made for events played more than 3 times and under 2 top-25s?
SELECT COUNT(cuts_made) FROM table_name_44 WHERE events > 3 AND top_25 < 2
sql_create_context
CREATE TABLE table_52963 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
Which away team scored 10.14 (74)?
SELECT "Away team" FROM table_52963 WHERE "Away team score" = '10.14 (74)'
wikisql
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, Creati...
Most popular tags during a time period.
SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS PeriodRank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS Questions, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostId AND ...
sede
CREATE TABLE table_1473672_4 ( college_junior_club_team VARCHAR, pick__number VARCHAR )
Name the college/junior club team for pick number 63
SELECT college_junior_club_team FROM table_1473672_4 WHERE pick__number = 63
sql_create_context
CREATE TABLE table_name_27 ( byes INTEGER, draws INTEGER )
How many byes were there recorded with 0 draws?
SELECT SUM(byes) FROM table_name_27 WHERE draws < 0
sql_create_context
CREATE TABLE table_name_5 ( region VARCHAR, catalog VARCHAR )
What is the Region, when the Catalog is SM 2965-05?
SELECT region FROM table_name_5 WHERE catalog = "sm 2965-05"
sql_create_context
CREATE TABLE table_57591 ( "Race" text, "Circuit" text, "Date" text, "Pole position" text, "Fastest lap" text, "Winning driver" text, "Constructor" text, "Tyre" text, "Report" text )
What is the Tyre when Jerry Hoyt was the pole position?
SELECT "Tyre" FROM table_57591 WHERE "Pole position" = 'jerry hoyt'
wikisql
CREATE TABLE submission ( Submission_ID int, Scores real, Author text, College text ) CREATE TABLE workshop ( Workshop_ID int, Date text, Venue text, Name text ) CREATE TABLE Acceptance ( Submission_ID int, Workshop_ID int, Result text )
Visualize a bar chart for how many workshops did each author submit to? Return the author name and the number of workshops, display names from low to high order.
SELECT Author, COUNT(DISTINCT T1.Workshop_ID) FROM Acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY Author
nvbench
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 demographic ...
give me the number of patients whose admission type is urgent and diagnoses icd9 code is 7596?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.icd9_code = "7596"
mimicsql_data
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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, ...
count the number of patients diagnosed with ami nos, initial in the same hospital encounter after they have been diagnosed with brain lacer nec-coma nos since 2105.
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id 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 =...
mimic_iii
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) 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...
what is admission type and death status of subject id 10317?
SELECT demographic.admission_type, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "10317"
mimicsql_data
CREATE TABLE table_20799905_1 ( obama_percentage VARCHAR, county VARCHAR )
What percentage did Obama get in Rutherford county?
SELECT obama_percentage FROM table_20799905_1 WHERE county = "RUTHERFORD"
sql_create_context
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
从13年5月11日到2020年4月11日这段时间,列出患者杨丹红所有检验报告单的审核日期时间吗?
(SELECT jybgb.SHSJ FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = '杨丹红' AND jyb...
css
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE cost ( row_id numbe...
how many times has patient 86791 had received insert gastric tube nec in a year before?
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'insert gastric tube nec') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 86791) AND DATETIME(procedu...
mimic_iii
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 ( ...
give me the number of patients whose admission type is newborn and discharge location is disc-tran cancer/chldrn h?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.discharge_location = "DISC-TRAN CANCER/CHLDRN H"
mimicsql_data
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,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 varc...
Show the total salary by each hire date of employees, and please bin the hire date into the day of week interval for showing a bar chart.
SELECT HIRE_DATE, SUM(SALARY) FROM employees
nvbench
CREATE TABLE table_train_191 ( "id" int, "gender" string, "hemoglobin_a1c_hba1c" float, "diabetic" string, "serum_creatinine" float, "allergy_to_glyburide" bool, "kidney_disease" bool, "drug_abuse" bool, "age" float, "NOUSE" float )
hba1c levels between 6 and 9.5 to be enrolled in the study.
SELECT * FROM table_train_191 WHERE hemoglobin_a1c_hba1c >= 6 AND hemoglobin_a1c_hba1c <= 9.5
criteria2sql
CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text ) CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text )
Stacked bar of class and the number of class colored by Rank, sort Y in descending order.
SELECT Class, COUNT(Class) FROM captain GROUP BY Rank, Class ORDER BY COUNT(Class) DESC
nvbench
CREATE TABLE table_47781 ( "Date" text, "Home" text, "Score" text, "Away" text, "Attendance" real )
Who was the home team with 3305 in attendance?
SELECT "Home" FROM table_47781 WHERE "Attendance" = '3305'
wikisql
CREATE TABLE table_77411 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is Player, when Place is '1'?
SELECT "Player" FROM table_77411 WHERE "Place" = '1'
wikisql
CREATE TABLE election ( Election_ID int, Counties_Represented text, District int, Delegate text, Party int, First_Elected real, Committee text ) CREATE TABLE party ( Party_ID int, Year real, Party text, Governor text, Lieutenant_Governor text, Comptroller text, A...
Show me population by county name in a histogram, sort by the y-axis in desc please.
SELECT County_name, Population FROM county ORDER BY Population DESC
nvbench
CREATE TABLE table_35396 ( "Ranking" real, "Nationality" text, "Name" text, "Position" text, "Years" text, "League" real, "Europe" real, "Others" real, "Total" real )
What is the sum of the Europe totals for players with other appearances of 0, league appearances under 328, and a position of MF?
SELECT SUM("Europe") FROM table_35396 WHERE "Others" = '0' AND "League" < '328' AND "Position" = 'mf'
wikisql
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 locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40)...
For those employees who did not have any job in the past, show me about the distribution of hire_date and the average of employee_id bin hire_date by weekday in a bar chart, and list in descending by the Y.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(EMPLOYEE_ID) DESC
nvbench
CREATE TABLE table_name_61 ( score VARCHAR, home_team VARCHAR )
Which score has a Home Team of saskatoon accelerators?
SELECT score FROM table_name_61 WHERE home_team = "saskatoon accelerators"
sql_create_context
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, Creati...
Number of votes on answers and votes on questions per month - only non-CW.
SELECT LAST_DATE_OF_MONTH(v.CreationDate), COUNT(v.Id) AS "total_upvotes", SUM(CASE WHEN p.PostTypeId = 1 THEN 1 ELSE 0 END) AS "question_upvotes", SUM(CASE WHEN p.PostTypeId = 2 THEN 1 ELSE 0 END) AS "answer_upvotes" FROM Posts AS p INNER JOIN Votes AS v ON v.PostId = p.Id WHERE v.VoteTypeId = 2 AND (p.CommunityOwnedD...
sede
CREATE TABLE table_train_271 ( "id" int, "renal_disease" bool, "hepatic_disease" bool, "smoking" bool, "coronary_artery_disease_cad" bool, "serum_creatinine" float, "body_mass_index_bmi" float, "myocardial_infarction" bool, "NOUSE" float )
coronary artery disease ( cad ) : documented by history of myocardial infarction
SELECT * FROM table_train_271 WHERE coronary_artery_disease_cad = 1 OR myocardial_infarction = 1
criteria2sql
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...
2020年5月1日到2020年11月26日,编号为3006208的医院的小儿肛肠外科科室涉及到多少医疗费
SELECT SUM(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.t_kc21_MED_SER_ORG_NO = '3006208' AND t_kc24.t_kc21_MED_ORG_DEPT_NM = '小儿肛肠外科') AND t_kc24.CLINIC_SLT_DATE BETWEEN '2020-05-01' AND '2020-11-26'
css
CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varch...
Last semester in CZECH 242 , who were the GSIs ?
SELECT DISTINCT student.firstname, student.lastname FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN gsi ON gsi.course_offering_id = course_offering.offering_id INNER JOIN student ON student.student_id = gsi.student_id INNER JOIN semester ON semester.semester_id = course...
advising
CREATE TABLE table_59943 ( "Tournament" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text )
what is 2012 when the tournament is cincinnati masters?
SELECT "2012" FROM table_59943 WHERE "Tournament" = 'cincinnati masters'
wikisql
CREATE TABLE table_46548 ( "Name" text, "Date" text, "Defending forces" text, "Brigade" text, "Population" text )
What is the Defending forces when the population was 120?
SELECT "Defending forces" FROM table_46548 WHERE "Population" = '120'
wikisql
CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
依照科室不同以及出院诊断的疾病编号差别,查询一下医院9266257全部医疗就诊的记录里自费的部分与总医疗费的最小比值且按升序顺序来显示
SELECT t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_CD, MIN(t_kc24.PER_EXP) FROM t_kc21 JOIN t_kc24 JOIN t_kc21_t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc24.MED_CLINIC_ID AND t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID WHERE t_kc21.MED_SER_ORG_NO = '9266257' GROUP BY t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_...
css
CREATE TABLE table_26230 ( "No" real, "Player" text, "Height (m)" text, "Height (f)" text, "Position" text, "Year born" real, "Current Club" text )
Identify every player's height in meters if the player is exactly 6' 07' tall in feet
SELECT "Height (m)" FROM table_26230 WHERE "Height (f)" = '6'' 07'
wikisql
CREATE TABLE table_70437 ( "Name" text, "Years" text, "Gender" text, "Area" text, "Authority" text, "Decile" real, "Roll" real )
Which school in Balclutha has a roll smaller than 55?
SELECT "Name" FROM table_70437 WHERE "Area" = 'balclutha' AND "Roll" < '55'
wikisql
CREATE TABLE table_202_231 ( id number, "party" text, "votes" number, "%" number, "seats" number, "+/-" number )
which party finished last in the election ?
SELECT "party" FROM table_202_231 ORDER BY "%" LIMIT 1
squall
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...
在17年10月30日到18年12月8日期间,列出金宏茂患者所有检验结果指标记录中用的什么检测方法?
SELECT jyjgzbb.JCFF 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 jybgb....
css
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 sum of revenue , and group by attribute founder.
SELECT Founder, SUM(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder
nvbench
CREATE TABLE table_53777 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
What driver has BRM as a constructor and had more than 30 laps?
SELECT "Driver" FROM table_53777 WHERE "Constructor" = 'brm' AND "Laps" > '30'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
参保人序列号为31926697的患者住院期间花费了多少次整数金额?
SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.PERSON_ID = '31926697' AND t_kc21.CLINIC_TYPE = '住院' AND MOD(t_kc21.MED_AMOUT, 1) = 0
css
CREATE TABLE table_name_67 ( conference_joined VARCHAR, location VARCHAR, mascot VARCHAR )
Can you tell me the Conference Joined that has the Location of terre haute, and the Mascot of golden bears?
SELECT conference_joined FROM table_name_67 WHERE location = "terre haute" AND mascot = "golden bears"
sql_create_context
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE TAB...
list the AS flights arriving in BURBANK
SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'BURBANK' AND flight.airline_code = 'AS' AND flight.to_airport = airport_service.airport_code
atis
CREATE TABLE table_49970 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" real, "Money ( $ )" text )
how many times is the country united states and the score 72-71-73-73=289?
SELECT COUNT("To par") FROM table_49970 WHERE "Country" = 'united states' AND "Score" = '72-71-73-73=289'
wikisql
CREATE TABLE table_name_86 ( score VARCHAR, date VARCHAR )
What is the score when november 15 is the date?
SELECT score FROM table_name_86 WHERE date = "november 15"
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...
provide the number of patients whose admission location is clinic referral/premature and age is less than 45?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.age < "45"
mimicsql_data
CREATE TABLE table_76736 ( "School" text, "Locality" text, "Ages" text, "Capacity" real, "Ofsted" real )
What is heaton chapel's capacity?
SELECT MAX("Capacity") FROM table_76736 WHERE "Locality" = 'heaton chapel'
wikisql
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, s...
in this year, patient 49654 has made an admission?
SELECT COUNT(*) > 0 FROM admissions WHERE admissions.subject_id = 49654 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
mimic_iii
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code tex...
what was patient 57023's last blood culture ( myco/f lytic bottle)'s microbiology test time in the last month?
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 57023) AND microbiologyevents.spec_type_desc = 'blood culture ( myco/f lytic bottle)' AND DATETIME(microbiologyevents.charttime, 'start of month') = DA...
mimic_iii
CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TE...
Return a bar chart on how many wines are there for each grape?
SELECT Grape, COUNT(*) FROM wine GROUP BY Grape
nvbench
CREATE TABLE people ( People_ID int, Name text, Height real, Weight real, Birth_Date text, Birth_Place text ) CREATE TABLE body_builder ( Body_Builder_ID int, People_ID int, Snatch real, Clean_Jerk real, Total real )
Visualize a scatter chart about the correlation between People_ID and Snatch .
SELECT People_ID, Snatch FROM body_builder
nvbench
CREATE TABLE table_name_90 ( status VARCHAR, area_km_2 VARCHAR, population VARCHAR )
What status has an area km 2 less than 27.82, with 352 as the population?
SELECT status FROM table_name_90 WHERE area_km_2 < 27.82 AND population = 352
sql_create_context
CREATE TABLE table_name_33 ( country VARCHAR, player VARCHAR )
What country does Mark Hayes play for?
SELECT country FROM table_name_33 WHERE player = "mark hayes"
sql_create_context
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) C...
Users with at least n gold badges.
WITH tagbadges_cte AS (SELECT b.UserId AS uid, SUM(CASE WHEN b.Class = 1 THEN 1 ELSE 0 END) AS gold, SUM(CASE WHEN b.Class = 2 THEN 1 ELSE 0 END) AS silver, SUM(CASE WHEN b.Class = 3 THEN 1 ELSE 0 END) AS bronze, COUNT(b.Id) AS total FROM Badges AS b INNER JOIN Tags AS t ON t.TagName = Name GROUP BY UserId) SELECT u.Id...
sede
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescription...
how many patients with elective admission type were born before the year 2107?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.admityear < "2107"
mimicsql_data
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDat...
Interesting Ubuntu trends (# of Questions per Month).
SELECT DATEADD(mm, (YEAR(Posts.CreationDate) - 1900) * 12 + MONTH(Posts.CreationDate) - 1, 0) AS Month, Tags.TagName, COUNT(*) AS Questions FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Tags.TagName IN ...
sede
CREATE TABLE table_76124 ( "Television service" text, "Country" text, "Language" text, "Content" text, "HDTV" text, "Package/Option" text )
What is the HDTV when documentaries are the content?
SELECT "HDTV" FROM table_76124 WHERE "Content" = 'documentaries'
wikisql
CREATE TABLE table_16409745_1 ( interface VARCHAR, pages_per_minute__color_ VARCHAR )
What interface is used on the scanner that has a 36 pages per minute?
SELECT interface FROM table_16409745_1 WHERE pages_per_minute__color_ = 36
sql_create_context
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...
想知道被门诊诊断为K44.X89这个疾病的那些病人的籍贯代码、名称以及相应人数
SELECT person_info.JGDM, person_info.JGMC, COUNT(person_info.RYBH) FROM person_info JOIN hz_info JOIN mzjzjlb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_inf...
css
CREATE TABLE table_203_798 ( id number, "party" text, "votes" text, "%" number, "swing" number, "seats" number, "change" number )
how many seats did the independent party get ?
SELECT "seats" FROM table_203_798 WHERE "party" = 'independent'
squall
CREATE TABLE table_10367 ( "State" text, "Swimsuit" real, "Interview" real, "Evening Gown" real, "Average" real )
What is the lowest swimsuit for a contestant with an average of 9.125?
SELECT MIN("Swimsuit") FROM table_10367 WHERE "Average" = '9.125'
wikisql
CREATE TABLE table_name_79 ( to_par VARCHAR, place VARCHAR, score VARCHAR )
What is the To par of the T8 Place Player with a Score of 72-70-66=208?
SELECT to_par FROM table_name_79 WHERE place = "t8" AND score = 72 - 70 - 66 = 208
sql_create_context
CREATE TABLE table_70765 ( "Name" text, "Country" text, "Type" text, "Moving from" text, "Transfer window" text, "Ends" real, "Transfer fee" text, "Source" text )
Which transfer window was moving from borussia dortmund?
SELECT "Transfer window" FROM table_70765 WHERE "Moving from" = 'borussia dortmund'
wikisql
CREATE TABLE table_42909 ( "Year" real, "Champion" text, "Runner-up" text, "Third place" text, "Fourth place" text, "Jack Tompkins Trophy (MVP)" text )
What is the Fourth place with a Year that is 1966?
SELECT "Fourth place" FROM table_42909 WHERE "Year" = '1966'
wikisql
CREATE TABLE table_14186 ( "Question #" real, "Prize Level (in Rupees)" real, "Range (in %)" real, "Walk-Away Prize" real, "Prize If Wrong" real )
What is the prize level when the Prize if Wrong is 1,000 and the question is less than 2?
SELECT SUM("Prize Level (in Rupees)") FROM table_14186 WHERE "Prize If Wrong" = '1,000' AND "Question #" < '2'
wikisql
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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), CO...
For all employees who have the letters D or S in their first name, show me about the distribution of hire_date and the average of employee_id bin hire_date by time in a bar chart, sort by the y axis in ascending.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(EMPLOYEE_ID)
nvbench
CREATE TABLE table_46912 ( "Driver" text, "Team" text, "Laps" real, "Time/Retired" text, "Grid" real, "Points" real )
Which Points have a Time/Retired of +49.222 secs?
SELECT MAX("Points") FROM table_46912 WHERE "Time/Retired" = '+49.222 secs'
wikisql