context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
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 )
For those ships that do not have a captain, tell me the total number of their classes using a pie chart.
SELECT Class, COUNT(Class) FROM Ship WHERE NOT Ship_ID IN (SELECT Ship_ID FROM captain) GROUP BY Class
nvbench
CREATE TABLE table_11643 ( "Round" text, "Player" text, "Position" text, "Team" text, "College" text )
What college has the Chicago stags and position is G?
SELECT "College" FROM table_11643 WHERE "Team" = 'chicago stags' AND "Position" = 'g'
wikisql
CREATE TABLE table_25397 ( "Player" text, "Games Played" real, "Field Goals" real, "Three Pointers" real, "Free Throws" real, "Rebounds" real, "Assists" real, "Blocks" real, "Steals" real, "Points" real )
What is the lowest number of three pointers in games where the number of rebounds was 178?
SELECT MIN("Three Pointers") FROM table_25397 WHERE "Rebounds" = '178'
wikisql
CREATE TABLE table_name_2 ( type VARCHAR, nat VARCHAR, name VARCHAR )
Marcell Jansen of the nation GER has what for the type?
SELECT type FROM table_name_2 WHERE nat = "ger" AND name = "marcell jansen"
sql_create_context
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
算一下在医疗费明细记录06485196651里面药品的数量乘以单价是多少
SELECT QTY * UNIVALENT FROM t_kc22 WHERE MED_EXP_DET_ID = '06485196651'
css
CREATE TABLE table_name_91 ( grid INTEGER, rider VARCHAR )
How many Grid has a Rider of ryuichi kiyonari?
SELECT SUM(grid) FROM table_name_91 WHERE rider = "ryuichi kiyonari"
sql_create_context
CREATE TABLE table_name_41 ( tournament VARCHAR, outcome VARCHAR, score VARCHAR )
What Tournament has an Outcome of runner-up, and a Score of 4 6, 3 6?
SELECT tournament FROM table_name_41 WHERE outcome = "runner-up" AND score = "4–6, 3–6"
sql_create_context
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid numb...
when did patient 006-99708 first receive a lab test in 02/this year?
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-99708')) AND DATETIME(lab.labresulttime, 'start of year') = DATETIME(CURRENT_TI...
eicu
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, ...
what was patient 3663's monthly average value of body weight since 5 years ago?
SELECT AVG(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3663)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit...
mimic_iii
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) 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...
For those employees who did not have any job in the past, give me the comparison about the average of department_id over the job_id , and group by attribute job_id by a bar chart.
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID
nvbench
CREATE TABLE table_1450 ( "University" text, "Location" text, "Established" real, "Endowment as of 2008" text, "Campus Area (acres)" real, "Kiplingers Top 100 Values" text, "Enrollment as of 2008" real )
Name the least established
SELECT MIN("Established") FROM table_1450
wikisql
CREATE TABLE table_10762 ( "Game" real, "Date" text, "Venue" text, "Opponent" text, "Result F\u2013A" text, "Attendance" real )
What day did they play the bolton wanderers with a result F A of 1 2?
SELECT "Date" FROM table_10762 WHERE "Result F\u2013A" = '1–2' AND "Opponent" = 'bolton wanderers'
wikisql
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, ...
How many tag badges have been awarded?.
SELECT COUNT(1) FROM Badges AS b
sede
CREATE TABLE Services ( Service_ID INTEGER, Service_Type_Code CHAR(15) ) CREATE TABLE Events ( Event_ID INTEGER, Service_ID INTEGER, Event_Details VARCHAR(255) ) CREATE TABLE Participants_in_Events ( Event_ID INTEGER, Participant_ID INTEGER ) CREATE TABLE Participants ( Participant_ID...
How many events have each participants attended? Show their average number by each participant type code using a bar chart, sort from low to high by the names.
SELECT T1.Participant_Type_Code, AVG(COUNT(*)) FROM Participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID GROUP BY T1.Participant_Type_Code ORDER BY T1.Participant_Type_Code
nvbench
CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int,...
i would like a flight from DENVER to PITTSBURGH
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBU...
atis
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 icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
how many patients in this year were prescribed with methylprednisolone sodium succ in the same month after the cont inv mec ven 96+ hrs procedure?
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'cont inv me...
mimic_iii
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE PostsWithDeleted ( Id number, PostTyp...
Average Number of Tags per Post.
SELECT MIN(Posts.Tags) AS "minimum_#_of_answers", AVG(CAST(Posts.AnswerCount AS FLOAT)) AS "average_#_of_answers", MAX(Posts.AnswerCount) AS "maximum_#_of_answers" FROM Posts WHERE Posts.PostTypeId = 1
sede
CREATE TABLE table_27832 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text )
What is the production code for the episode directed by Sam weisman?
SELECT "Production code" FROM table_27832 WHERE "Directed by" = 'Sam Weisman'
wikisql
CREATE TABLE table_80175 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Record" text )
Name the loss on may 22
SELECT "Loss" FROM table_80175 WHERE "Date" = 'may 22'
wikisql
CREATE TABLE table_name_7 ( verb VARCHAR )
What is the 2nd verb for chena?
SELECT 2 AS __f_ FROM table_name_7 WHERE verb = "chena"
sql_create_context
CREATE TABLE table_28846752_4 ( average VARCHAR, highest_score VARCHAR )
What is the average when the highest score is 151?
SELECT average FROM table_28846752_4 WHERE highest_score = "151"
sql_create_context
CREATE TABLE table_name_13 ( season VARCHAR, winner VARCHAR )
What season did Stoke City win?
SELECT season FROM table_name_13 WHERE winner = "stoke city"
sql_create_context
CREATE TABLE table_1000 ( "Total#" real, "Series#" real, "Title" text, "Writer" text, "Director" text, "Original air date" text )
What number from the total number of episodes is the episode written by Julian Unthank?
SELECT "Series#" FROM table_1000 WHERE "Writer" = 'Julian Unthank'
wikisql
CREATE TABLE table_10294071_1 ( singles_w_l VARCHAR, doubles_w_l VARCHAR )
what is the total number of singles w l where doubles w l is 11 14
SELECT COUNT(singles_w_l) FROM table_10294071_1 WHERE doubles_w_l = "11–14"
sql_create_context
CREATE TABLE table_35920 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
What was the Attendance on November 29, 1953?
SELECT SUM("Attendance") FROM table_35920 WHERE "Date" = 'november 29, 1953'
wikisql
CREATE TABLE table_78004 ( "Name (Irish)" text, "Name (English)" text, "Sport" text, "Teams" text, "Location" text, "Pitch" text )
What Pitch is located at Isle of Man?
SELECT "Pitch" FROM table_78004 WHERE "Location" = 'isle of man'
wikisql
CREATE TABLE table_203_489 ( id number, "year" number, "title" text, "system" text, "developer" text, "publisher" text )
how many ghostbusters games were released in 1990 ?
SELECT COUNT("title") FROM table_203_489 WHERE "year" = 1990
squall
CREATE TABLE table_name_59 ( outcome VARCHAR, surface VARCHAR )
What was Olga Govortsova's outcome when she played on a grass surface?
SELECT outcome FROM table_name_59 WHERE surface = "grass"
sql_create_context
CREATE TABLE table_148578_1 ( altitude__km_ VARCHAR, yield__approximate_ VARCHAR )
What was the altitude of the yield of 1.4 megatons?
SELECT altitude__km_ FROM table_148578_1 WHERE yield__approximate_ = "1.4 megatons"
sql_create_context
CREATE TABLE table_35550 ( "School" text, "Location" text, "Mascot" text, "Enrollment" real, "IHSAA Class" text, "IHSAA Football Class" text, "# / County" text )
Name the mascot for shelbyville
SELECT "Mascot" FROM table_35550 WHERE "School" = 'shelbyville'
wikisql
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
School_ID across team name in a pie chart.
SELECT Team_Name, School_ID FROM basketball_match
nvbench
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, ...
有什么医院排序属于团伙成员华云韶最常去的?
SELECT t_kc21.MED_SER_ORG_NO FROM t_kc21 WHERE t_kc21.PERSON_NM = '华云韶' GROUP BY t_kc21.MED_SER_ORG_NO ORDER BY COUNT(*) DESC
css
CREATE TABLE table_name_74 ( time_retired VARCHAR, laps VARCHAR, grid VARCHAR )
Tell me the time/retired for Laps of 42 and Grids of 4
SELECT time_retired FROM table_name_74 WHERE laps = 42 AND grid = 4
sql_create_context
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number...
how many patients had been prescribed vancomycin desensitization?
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'vancomycin desensitization')
mimic_iii
CREATE TABLE instruments ( songid number, bandmateid number, instrument text ) CREATE TABLE band ( id number, firstname text, lastname text ) CREATE TABLE vocals ( songid number, bandmate number, type text ) CREATE TABLE songs ( songid number, title text ) CREATE TABLE tr...
How many songs have a shared vocal?
SELECT COUNT(DISTINCT title) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE type = "shared"
spider
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...
查询6350564医院的科室838涉及的医疗费总额,时间范围是零四年七月十五日到一五年一月二十二日
SELECT SUM(MED_AMOUT) FROM t_kc24 WHERE MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc21 WHERE MED_SER_ORG_NO = '6350564' AND MED_ORG_DEPT_CD = '838') AND CLINIC_SLT_DATE BETWEEN '2004-07-15' AND '2015-01-22'
css
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description...
R, Python and C++ Trends (# Questions per Tag 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 rooms ( roomid text, roomname text, beds number, bedtype text, maxoccupancy number, baseprice number, decor text ) CREATE TABLE reservations ( code number, room text, checkin text, checkout text, rate number, lastname text, firstname text, adults...
Find the names of rooms that have been reserved for more than 60 times.
SELECT T2.roomname FROM reservations AS T1 JOIN rooms AS T2 ON T1.room = T2.roomid GROUP BY T1.room HAVING COUNT(*) > 60
spider
CREATE TABLE table_14551 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "NFL Recap" text, "Record" text, "Attendance" text )
Which week's game had an attendance of 90,138?
SELECT "Week" FROM table_14551 WHERE "Attendance" = '90,138'
wikisql
CREATE TABLE table_54364 ( "Candidate" text, "Contributions" real, "Loans Received" real, "All Receipts" real, "Operating Expenditures" real, "All Disbursements" real )
How many Operating Expenditures have Receipts of 44,259,386?
SELECT COUNT("Operating Expenditures") FROM table_54364 WHERE "All Receipts" = '44,259,386'
wikisql
CREATE TABLE train ( Train_ID int, Train_Num text, Name text, From text, Arrival text, Railway_ID int ) CREATE TABLE manager ( Manager_ID int, Name text, Country text, Working_year_starts text, Age int, Level int ) CREATE TABLE railway_manage ( Railway_ID int, M...
Give me a bar chart for how many name of each name, could you show x-axis from low to high order please?
SELECT Name, COUNT(Name) FROM train GROUP BY Name ORDER BY Name
nvbench
CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE restriction ( restriction_code text, advance_purc...
yes i would like to find what flights are available from ATLANTA to BOSTON on the morning of 7 7
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((flight.departure_time BETWEEN 0 AND 1200) AND date_day.day_number = 7 AND date_day.month_number = 7 AND date_day.year = 1991 AND days.day_name...
atis
CREATE TABLE gwyjzb ( 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, ...
在编号为4616814的这家医院里,有多少科室的平均医疗住院时长在24天以上
SELECT COUNT(*) FROM (SELECT gwyjzb.MED_ORG_DEPT_CD FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '4616814' GROUP BY gwyjzb.MED_ORG_DEPT_CD HAVING AVG(gwyjzb.IN_HOSP_DAYS) > 24 UNION SELECT fgwyjzb.MED_ORG_DEPT_CD FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '4616814' GROUP BY fgwyjzb.MED_ORG_DEPT_CD HAVING AVG(fgwyjzb.IN_H...
css
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, ...
when the first time patient 94293 was prescribed a medication in 01/2104 via the ivpca route?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 94293) AND prescriptions.route = 'ivpca' AND STRFTIME('%y-%m', prescriptions.startdate) = '2104-01' ORDER BY prescriptions.startdate LIMIT 1
mimic_iii
CREATE TABLE staff ( staff_id number, first_name text, last_name text, address_id number, picture others, email text, store_id number, active boolean, username text, password text, last_update time ) CREATE TABLE actor ( actor_id number, first_name text, last_nam...
What are the countries that contain 3 or more cities?
SELECT T2.country FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id GROUP BY T2.country_id HAVING COUNT(*) >= 3
spider
CREATE TABLE table_74354 ( "No." real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (million)" text )
How many million U.S. viewers saw 'Fake Me Home Tonight'?
SELECT "U.S. viewers (million)" FROM table_74354 WHERE "Title" = 'Fake Me Home Tonight'
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,...
医院4355063所有的就诊记载里参照不一样的科室编码和出院时诊断的病名查询患者就诊时的平均年龄
SELECT MED_ORG_DEPT_CD, OUT_DIAG_DIS_NM, AVG(PERSON_AGE) FROM t_kc21 WHERE MED_SER_ORG_NO = '4355063' GROUP BY MED_ORG_DEPT_CD, OUT_DIAG_DIS_NM
css
CREATE TABLE bank ( branch_id number, bname text, no_of_customers number, city text, state text ) CREATE TABLE customer ( cust_id text, cust_name text, acc_type text, acc_bal number, no_of_loans number, credit_score number, branch_id number, state text ) CREATE TABL...
Find the state, account type, and credit score of the customer whose number of loan is 0.
SELECT state, acc_type, credit_score FROM customer WHERE no_of_loans = 0
spider
CREATE TABLE table_name_43 ( revenues VARCHAR, tenure VARCHAR )
What is the Revenues during Tenure 1854-1855?
SELECT revenues FROM table_name_43 WHERE tenure = "1854-1855"
sql_create_context
CREATE TABLE txmzjzjlb ( 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...
哪些工号及姓名的医务人员在患者沈云梦就诊过程中为他检测地高辛的,时间是从0二年二月六日到0四年五月十二日
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM person_info JOIN hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZ...
css
CREATE TABLE table_name_94 ( poles VARCHAR, fastest_laps VARCHAR, wins VARCHAR, podiums VARCHAR )
Which Poles has a Wins larger than 0, and a Podiums smaller than 17?
SELECT poles FROM table_name_94 WHERE wins > 0 AND podiums < 17 AND fastest_laps = 0
sql_create_context
CREATE TABLE table_name_71 ( opponent VARCHAR, time VARCHAR )
Who was the opponent when the fight had a time of 2:01?
SELECT opponent FROM table_name_71 WHERE time = "2:01"
sql_create_context
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 TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_...
show DL flights from JFK to MIAMI
SELECT DISTINCT flight.flight_id FROM airport, airport_service, city, flight WHERE (airport.airport_code = 'JFK' AND city.city_code = airport_service.city_code AND city.city_name = 'MIAMI' AND flight.from_airport = airport.airport_code AND flight.to_airport = airport_service.airport_code) AND flight.airline_code = 'DL'
atis
CREATE TABLE Engineer_Skills ( engineer_id INTEGER, skill_id INTEGER ) CREATE TABLE Engineer_Visits ( engineer_visit_id INTEGER, contact_staff_id INTEGER, engineer_id INTEGER, fault_log_entry_id INTEGER, fault_status VARCHAR(10), visit_start_datetime DATETIME, visit_end_datetime DAT...
Show the number of assets and group by asset make in a bar chart, and could you display in ascending by the X-axis?
SELECT asset_make, COUNT(asset_make) FROM Assets GROUP BY asset_make ORDER BY asset_make
nvbench
CREATE TABLE table_42554 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
What was the time of the bout that ended in a TKO (strikes)?
SELECT "Time" FROM table_42554 WHERE "Method" = 'tko (strikes)'
wikisql
CREATE TABLE table_24549777_1 ( player VARCHAR, high_checkout VARCHAR )
How man players checked out at 84?
SELECT COUNT(player) FROM table_24549777_1 WHERE high_checkout = 84
sql_create_context
CREATE TABLE table_48357 ( "Club" text, "Home city" text, "Stadium" text, "Founded" real, "Seasons in PRSL" text )
What year was the team Club of atl tico de san juan fc who plays at hiram bithorn stadium founded.
SELECT SUM("Founded") FROM table_48357 WHERE "Stadium" = 'hiram bithorn stadium' AND "Club" = 'atlético de san juan fc'
wikisql
CREATE TABLE table_47342 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Record" text )
What was the record when they played in the Miami Arena, before game 24?
SELECT "Record" FROM table_47342 WHERE "Game" < '24' AND "Location" = 'miami arena'
wikisql
CREATE TABLE table_name_96 ( total INTEGER, lecturers VARCHAR, professors VARCHAR )
What is the total in the case where theere are 6 lecturers and fewer than 48 professors?
SELECT AVG(total) FROM table_name_96 WHERE lecturers = 6 AND professors < 48
sql_create_context
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code te...
since 2100, what are the three most frequently prescribed drugs to female patients aged 30s within the same hospital visit after they have been diagnosed with atrial fibrillation?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 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_...
mimic_iii
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...
Top SO Users from KZ.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%kazakhstan%' OR UPPER(Location) LIKE '%KZ' ORDER BY Reputation DESC
sede
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid number...
when was the first time during their first hospital encounter that patient 027-25994 had a surgical drains - jackson-pratt procedure?
SELECT treatment.treatmenttime FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-25994' AND NOT patient.hospitaldischargetime IS NULL ORDER BY...
eicu
CREATE TABLE table_name_65 ( population VARCHAR, former_local_authority VARCHAR )
What was the population of the area that was formerly under the authority of the Audenshaw Urban District?
SELECT population FROM table_name_65 WHERE former_local_authority = "audenshaw urban district"
sql_create_context
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, ...
when was the first time that patient 65401 has the minimum chloride in 10/this year?
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 65401) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'chloride') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURREN...
mimic_iii
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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25...
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, return a scatter chart about the correlation 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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
Find out the number of patients with s/p fall as their primary disease who had delta abnormal lab test status.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "S/P FALL" AND lab.flag = "delta"
mimicsql_data
CREATE TABLE table_64794 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
What is the Week of the game against Green Bay Packers?
SELECT AVG("Week") FROM table_64794 WHERE "Opponent" = 'green bay packers'
wikisql
CREATE TABLE vocals ( songid VARCHAR ) CREATE TABLE songs ( songid VARCHAR )
How many songs have a lead vocal?
SELECT COUNT(DISTINCT title) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE TYPE = "lead"
sql_create_context
CREATE TABLE table_name_42 ( boat_builder VARCHAR, year_built VARCHAR, number VARCHAR )
What is the boat builder for a boat built in 1910/11 and a number of 39?
SELECT boat_builder FROM table_name_42 WHERE year_built = "1910/11" AND number = 39
sql_create_context
CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pre...
List the name and the number of stations for all the cities that have at least 15 stations Show bar chart, and order by the x axis in desc.
SELECT city, COUNT(*) FROM station GROUP BY city ORDER BY city DESC
nvbench
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
出院时,医疗就诊41356793399诊断的疾病编号及名称分别是什么?
SELECT t_kc21.OUT_DIAG_DIS_CD, t_kc21.OUT_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.MED_CLINIC_ID = '41356793399'
css
CREATE TABLE gyb ( CLINIC_ID 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, INSU_TYPE text, IN...
非科室小儿神经外科负责的所有医疗就诊在医院4723266中有哪些记录,在2005-06-17到2018-05-08内?
SELECT * FROM qtb WHERE qtb.MED_SER_ORG_NO = '4723266' AND qtb.IN_HOSP_DATE BETWEEN '2005-06-17' AND '2018-05-08' UNION SELECT * FROM gyb WHERE gyb.MED_SER_ORG_NO = '4723266' AND gyb.IN_HOSP_DATE BETWEEN '2005-06-17' AND '2018-05-08' UNION SELECT * FROM zyb WHERE zyb.MED_SER_ORG_NO = '4723266' AND zyb.IN_HOSP_DATE BETW...
css
CREATE TABLE table_name_71 ( overall INTEGER, college VARCHAR, pick VARCHAR )
When Kansas State had a pick of over 35, what's the highest Overall pick found?
SELECT MAX(overall) FROM table_name_71 WHERE college = "kansas state" AND pick > 35
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 locations ( LOCAT...
Create a bar chart showing manager_id across last name
SELECT LAST_NAME, MANAGER_ID FROM employees
nvbench
CREATE TABLE Catalogs ( catalog_id INTEGER, catalog_name VARCHAR(50), catalog_publisher VARCHAR(80), date_of_publication DATETIME, date_of_latest_revision DATETIME ) CREATE TABLE Attribute_Definitions ( attribute_id INTEGER, attribute_name VARCHAR(30), attribute_data_type VARCHAR(10) ) ...
What are the names of catalog entries with level number 8, and count them by a bar chart
SELECT catalog_entry_name, COUNT(catalog_entry_name) FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" GROUP BY catalog_entry_name
nvbench
CREATE TABLE table_47555 ( "Name" text, "Company" text, "Platform" text, "Latest stable release" text, "Price in USD" text )
What platform is the company Surfstats Software?
SELECT "Platform" FROM table_47555 WHERE "Company" = 'surfstats software'
wikisql
CREATE TABLE table_70487 ( "Year" real, "Team" text, "Co-Drivers" text, "Class" text, "Laps" real, "Pos." text, "Class Pos." text )
What is the total laps for the year 2011?
SELECT SUM("Laps") FROM table_70487 WHERE "Year" = '2011'
wikisql
CREATE TABLE table_name_30 ( date VARCHAR, competition VARCHAR, result VARCHAR )
What was the date of the friendly match, ending in a result of 1-1?
SELECT date FROM table_name_30 WHERE competition = "friendly match" AND result = "1-1"
sql_create_context
CREATE TABLE table_test_24 ( "id" int, "history_of_bleeding_diathesis" bool, "bleeding" int, "systolic_blood_pressure_sbp" int, "hemoglobin_a1c_hba1c" float, "blood_draw" bool, "renal_disease" bool, "allergy_to_aspirin" bool, "allergy_to_clopidogrel" bool, "cardiogenic_shock" boo...
patient with known history of bleeding diathesis or currently active bleeding;
SELECT * FROM table_test_24 WHERE history_of_bleeding_diathesis = 1 OR bleeding = 1
criteria2sql
CREATE TABLE table_28596 ( "Location" text, "Date" real, "Denomination" text, "Coinage metal" text, "Mintage" real, "KM number" text )
What is the mintage for a location of Sion and a denomination of 00500 500 Francs?
SELECT "Mintage" FROM table_28596 WHERE "Location" = 'Sion' AND "Denomination" = '00500 500 francs'
wikisql
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...
provide the number of patients whose admission year is less than 2135 and diagnoses short title is lower extremity embolism?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2135" AND diagnoses.short_title = "Lower extremity embolism"
mimicsql_data
CREATE TABLE region ( Region_ID int, Region_name text, Date text, Label text, Format text, Catalogue text ) CREATE TABLE party ( Party_ID int, Minister text, Took_office text, Left_office text, Region_ID int, Party_name text ) CREATE TABLE member ( Member_ID int, ...
Return a bar chart on how many events are there for each party?
SELECT Party_name, COUNT(*) FROM party_events AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID
nvbench
CREATE TABLE table_name_89 ( round INTEGER, method VARCHAR )
What round was it when the method was TKO (would not stand up from Butt Scoot)?
SELECT AVG(round) FROM table_name_89 WHERE method = "tko (would not stand up from butt scoot)"
sql_create_context
CREATE TABLE table_name_57 ( high_rebounds VARCHAR, high_assists VARCHAR, score VARCHAR )
Who had the high rebounds when the score was w 105 95 (ot) and Jason Kidd (8) had the high assists?
SELECT high_rebounds FROM table_name_57 WHERE high_assists = "jason kidd (8)" AND score = "w 105–95 (ot)"
sql_create_context
CREATE TABLE table_7092 ( "Episode" real, "Title" text, "Story" text, "Adapted by" text, "Director" text, "Airdate" text, "Exists?" text )
What is the Airdate for the episode titled thirteen to centaurus Adapted by stanley miller?
SELECT "Airdate" FROM table_7092 WHERE "Adapted by" = 'stanley miller' AND "Title" = '“thirteen to centaurus”'
wikisql
CREATE TABLE table_58509 ( "Round" text, "Date" text, "Home Team" text, "Score" text, "Away Team" text, "Crowd" real, "Stadium" text, "Match Details" text )
Im the match where the home team is Melbourne Victory, what was the crowd attendance?
SELECT COUNT("Crowd") FROM table_58509 WHERE "Home Team" = 'melbourne victory'
wikisql
CREATE TABLE table_37705 ( "Year" real, "Chassis" text, "Engine" text, "Start" real, "Finish" real, "Team" text )
How many starts are associated with an oldsmobile engine, 21 finishes and before 2001?
SELECT SUM("Start") FROM table_37705 WHERE "Engine" = 'oldsmobile' AND "Finish" = '21' AND "Year" < '2001'
wikisql
CREATE TABLE table_49571 ( "Location" text, "Year" real, "Champion" text, "Runner-up" text, "Score" text )
Who is the runner-up in 1990?
SELECT "Runner-up" FROM table_49571 WHERE "Year" = '1990'
wikisql
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 )
What is the total number of ships with different nationalities and ship types?, sort in descending by the total number.
SELECT Nationality, COUNT(Nationality) FROM ship GROUP BY Type, Nationality ORDER BY COUNT(Nationality) DESC
nvbench
CREATE TABLE table_27277284_27 ( tdp VARCHAR, order_part_number VARCHAR )
How many thermal design power levels does part number amql65dam22gg have?
SELECT COUNT(tdp) FROM table_27277284_27 WHERE order_part_number = "AMQL65DAM22GG"
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodici...
how many patients until 2104 were prescribed dextrose 50 % iv soln during the same hospital encounter after having undergone mechanical ventilation?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'mechanical ventilation' AND STRFTIME('%y', treatment.treatmenttime) <= '2...
eicu
CREATE TABLE Claims ( Claim_ID INTEGER, Policy_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settled INTEGER ) CREATE TABLE Settlements ( Settlement_ID INTEGER, Claim_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amoun...
For those payments processed with Visa, bin the payment day into the Day of Week interval and compute the average amount payment as the Y-axis.
SELECT Date_Payment_Made, AVG(Amount_Payment) FROM Payments WHERE Payment_Method_Code = 'Visa'
nvbench
CREATE TABLE table_name_33 ( pick__number INTEGER, round INTEGER )
What is the highest pick # after round 11?
SELECT MAX(pick__number) FROM table_name_33 WHERE round > 11
sql_create_context
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...
自2005-10-05到2015-04-23,24242862患者一共住了多少次院
SELECT COUNT(*) FROM zyb WHERE zyb.PERSON_NM = '24242862' AND zyb.IN_HOSP_DAYS BETWEEN '2005-10-05' AND '2015-04-23'
css
CREATE TABLE table_6484 ( "College" text, "Bachelor's" real, "Masters" real, "Doctorate" real, "Specialist" real )
How many specialists are at the college with more than 4 bachelor's degrees and more than 26 master's degrees?
SELECT SUM("Specialist") FROM table_6484 WHERE "Bachelor's" > '4' AND "Masters" > '26'
wikisql
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
Positive scored questions, with multiple, all-negative answers, no accepted answer.
SELECT Q.Id AS "post_link", COUNT(*) AS ANum, SUM(CASE WHEN A.Score < 0 THEN 1 ELSE 0 END) AS ANegNum FROM Posts AS Q, Posts AS A WHERE A.ParentId = Q.Id AND Q.Score > 0 AND Q.AcceptedAnswerId IS NULL GROUP BY Q.Id HAVING COUNT(*) = SUM(CASE WHEN A.Score < 0 THEN 1 ELSE 0 END) ORDER BY Q.Id DESC
sede
CREATE TABLE table_name_11 ( pick VARCHAR, position VARCHAR, player VARCHAR )
What is catcher Josh Donaldson's pick number?
SELECT pick FROM table_name_11 WHERE position = "catcher" AND player = "josh donaldson"
sql_create_context
CREATE TABLE table_name_52 ( week_8 VARCHAR, week_1 VARCHAR )
Who did the housemate that nominated Carol Roopali in week 1 nominate in week 8?
SELECT week_8 FROM table_name_52 WHERE week_1 = "carol roopali"
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, ...
Provide the number of patients diagnosed with unspecified acute upper respiratory tract infection who had an ascitic fluid lab test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Acute uri NOS" AND lab.fluid = "Ascites"
mimicsql_data
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...
Show me the number of all home by all home in a histogram, show total number in ascending order.
SELECT All_Home, COUNT(All_Home) FROM basketball_match GROUP BY All_Home ORDER BY COUNT(All_Home)
nvbench