context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( ...
how many patients admitted under emergency admission type are of hispanic/latino - puertorican ethnicity?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN"
mimicsql_data
CREATE TABLE authorship ( authid number, instid number, paperid number, authorder number ) CREATE TABLE papers ( paperid number, title text ) CREATE TABLE inst ( instid number, name text, country text ) CREATE TABLE authors ( authid number, lname text, fname text )
Which institution has the most papers? Find the name of the institution.
SELECT t1.name FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.name ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE table_79678 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-25" real, "Events" real, "Cuts made" real )
What is the average number of cuts made for events with under 4 entries and more than 0 wins?
SELECT AVG("Cuts made") FROM table_79678 WHERE "Events" < '4' AND "Wins" > '0'
wikisql
CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description v...
Who was the most recent instructor for MEDCHEM 617 ?
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE course_offeri...
advising
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of hire_date and the sum of manager_id bin hire_date by weekday, show y axis from low to high order.
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number...
count the number of patients that have had a sputum microbiology test.
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT microbiologyevents.hadm_id FROM microbiologyevents WHERE microbiologyevents.spec_type_desc = 'sputum')
mimic_iii
CREATE TABLE table_name_14 ( location VARCHAR, home_ground VARCHAR )
Which Location has a Home Ground of Mong kok stadium?
SELECT location FROM table_name_14 WHERE home_ground = "mong kok stadium"
sql_create_context
CREATE TABLE table_19389 ( "Country" text, "Total" real, "4000ft+" real, "3500\u20134000ft" real, "3000\u20133500ft" real, "2500\u20133000ft" real, "2000\u20132500ft" real )
Name the minimum for 2500-3000 ft for scotland
SELECT MIN("2500\u20133000ft") FROM table_19389 WHERE "Country" = 'Scotland'
wikisql
CREATE TABLE table_50244 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
Where was the match held that lasted 3:24?
SELECT "Location" FROM table_50244 WHERE "Time" = '3:24'
wikisql
CREATE TABLE table_70021 ( "Season" real, "Host" text, "Winners" text, "Score" text, "Runners-up" text, "Third place" text )
What is the season where Vasco da gama is the score?
SELECT "Season" FROM table_70021 WHERE "Score" = 'vasco da gama'
wikisql
CREATE TABLE table_name_77 ( crowd INTEGER, away_team VARCHAR )
What was the attendance when North Melbourne was the away team?
SELECT AVG(crowd) FROM table_name_77 WHERE away_team = "north melbourne"
sql_create_context
CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDispl...
Questions with no accepted answer.
SELECT (SELECT COUNT(*) FROM Posts WHERE PostTypeId = 1 AND AcceptedAnswerId IS NULL) AS noanswer, (SELECT COUNT(*) FROM Posts WHERE PostTypeId = 1) AS allquestions
sede
CREATE TABLE table_23357 ( "Series #" real, "Season #" real, "Title" text, "Director(s)" text, "Writer(s)" text, "Airdate" text, "Production code" real, "Arties disguises" text )
Writer Max Ehrlich, what is the minimum series number?
SELECT MIN("Series #") FROM table_23357 WHERE "Writer(s)" = 'Max Ehrlich'
wikisql
CREATE TABLE table_name_40 ( venue VARCHAR, runs VARCHAR )
What is the venue where 153 runs were scored?
SELECT venue FROM table_name_40 WHERE runs = "153"
sql_create_context
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...
count the number of patients whose ethnicity is american indian/alaska native and lab test name is lymphocytes?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND lab.label = "Lymphocytes"
mimicsql_data
CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE compartment_class ( ...
what is the total seating capacity of all aircraft of AA
SELECT DISTINCT aircraft.aircraft_code, aircraft.capacity FROM aircraft, equipment_sequence, flight WHERE equipment_sequence.aircraft_code = aircraft.aircraft_code AND flight.aircraft_code_sequence = equipment_sequence.aircraft_code_sequence AND flight.airline_code = 'AA'
atis
CREATE TABLE table_4255 ( "Name" text, "Family name" text, "Receptor" text, "Coreceptor" text, "Property" text, "Chromosomal location" text )
How many different chromosomal locations are there in the family il-1f8?
SELECT COUNT("Chromosomal location") FROM table_4255 WHERE "Family name" = 'IL-1F8'
wikisql
CREATE TABLE table_name_63 ( total INTEGER, country VARCHAR )
What is Fiji's lowest total?
SELECT MIN(total) FROM table_name_63 WHERE country = "fiji"
sql_create_context
CREATE TABLE table_43955 ( "Constellation" text, "Largest component, fractional share" real, "Other components, fractional shares" text, "N, Laakso-Taagepera" real, "N, Golosov" real )
What is the average Largest Component, Fractional Share, when N, Laakso-Taagepera is 1.98, and when N, Golosov is greater than 1.82?
SELECT AVG("Largest component, fractional share") FROM table_43955 WHERE "N, Laakso-Taagepera" = '1.98' AND "N, Golosov" > '1.82'
wikisql
CREATE TABLE table_40515 ( "Date" real, "Doubles, I Class" real, "Doubles, II Class" real, "Greater Doubles" real, "Doubles" real, "Semidoubles" real, "Total" real )
What is the lowest Semidoubles, when Doubles, II Class is 18, and when Total is less than 164?
SELECT MIN("Semidoubles") FROM table_40515 WHERE "Doubles, II Class" = '18' AND "Total" < '164'
wikisql
CREATE TABLE table_name_90 ( max_power_at_rpm VARCHAR, displacement VARCHAR, engine_name VARCHAR )
What is the maximum power at rpm for the engine named 2.0 TDI that has a 1968cc displacement?
SELECT max_power_at_rpm FROM table_name_90 WHERE displacement = "1968cc" AND engine_name = "2.0 tdi"
sql_create_context
CREATE TABLE table_62011 ( "Draft" real, "Round" real, "Pick" real, "Player" text, "Nationality" text )
Which player had a draft before 1975 and before round 6?
SELECT "Player" FROM table_62011 WHERE "Draft" < '1975' AND "Round" < '6'
wikisql
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, ...
Are posts better/more popular if they have a tag in their title?.
SELECT COUNT(*) AS Number, AVG(p.ViewCount) AS Views, ROUND(AVG(CAST(p.Score AS FLOAT)), 3) AS Score, ROUND(AVG(CAST(p.AnswerCount AS FLOAT)), 3) AS AnswerCount, CAST(AVG(CAST(p.CreationDate AS FLOAT)) AS DATETIME) AS AvgDate, CASE WHEN LOWER(p.Title) LIKE '%##TagName##%' THEN 'yes' ELSE 'no' END AS TagInTitle FROM Pos...
sede
CREATE TABLE table_name_51 ( region VARCHAR, format_s_ VARCHAR, label VARCHAR )
What region is the toshiba emi label with a cd format?
SELECT region FROM table_name_51 WHERE format_s_ = "cd" AND label = "toshiba emi"
sql_create_context
CREATE TABLE table_name_94 ( services VARCHAR, local_authority VARCHAR, zone_2010 VARCHAR )
Which Services have a Local authority of chiltern, and a Zone 2010 of 9?
SELECT services FROM table_name_94 WHERE local_authority = "chiltern" AND zone_2010 = "9"
sql_create_context
CREATE TABLE table_1919 ( "Township" text, "County" text, "Pop. (2010)" real, "Land ( sqmi )" text, "Water (sqmi)" text, "Latitude" text, "Longitude" text, "GEO ID" real, "ANSI code" real )
Name the latitude for deer lake
SELECT "Latitude" FROM table_1919 WHERE "Township" = 'Deer Lake'
wikisql
CREATE TABLE table_15966 ( "Pick" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
What is the smallest pick for the player, brett lindros?
SELECT MIN("Pick") FROM table_15966 WHERE "Player" = 'Brett Lindros'
wikisql
CREATE TABLE csu_fees ( campus number, year number, campusfee number ) CREATE TABLE campuses ( id number, campus text, location text, county text, year number ) CREATE TABLE degrees ( year number, campus number, degrees number ) CREATE TABLE enrollments ( campus number...
What is the total number of campuses?
SELECT COUNT(*) FROM campuses
spider
CREATE TABLE table_name_88 ( type VARCHAR, release_date VARCHAR )
Which Type has a Release date of november 30, 1997?
SELECT type FROM table_name_88 WHERE release_date = "november 30, 1997"
sql_create_context
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE Comments ( Id num...
Users owning both Epic and Generalist badges.
SELECT DISTINCT u.* FROM Badges AS g JOIN Badges AS e ON e.UserId = g.UserId JOIN Users AS u ON u.Id = e.UserId WHERE g.Name IN ('Epic', 'Generalist') AND e.Name IN ('Epic', 'Generalist') AND g.Id != e.Id ORDER BY u.DisplayName
sede
CREATE TABLE table_2668336_17 ( candidates VARCHAR, district VARCHAR )
In district North Carolina 10, what are the candidates?
SELECT candidates FROM table_2668336_17 WHERE district = "North Carolina 10"
sql_create_context
CREATE TABLE table_11826 ( "State" text, "Preliminaries" real, "Interview" real, "Swimsuit" real, "Evening Gown" real, "Average" real )
What is the preliminaries of the contestant from Massachusetts with an evening gown higher than 8.631, an average less than 8.791, and an interview higher than 8.608?
SELECT COUNT("Preliminaries") FROM table_11826 WHERE "Evening Gown" > '8.631' AND "Average" < '8.791' AND "State" = 'massachusetts' AND "Interview" > '8.608'
wikisql
CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD...
查一下16年12月29日到19年4月9日这期间内,小儿肛肠外科在治疗疾病P15.892上的平均住院费用
SELECT AVG(t_kc21.MED_AMOUT) FROM t_kc21 WHERE t_kc21.MED_ORG_DEPT_NM = '小儿肛肠外科' AND t_kc21.IN_HOSP_DATE BETWEEN '2016-12-29' AND '2019-04-09' AND t_kc21.IN_DIAG_DIS_CD = 'P15.892' AND t_kc21.CLINIC_TYPE = '住院'
css
CREATE TABLE table_22400 ( "Episode" text, "Garfield Episode 1" text, "U.S. Acres Episode" text, "Garfield Episode 2" text, "Original Airdate" text )
How many original airdates is Garfield episode 1 is cute for loot?
SELECT COUNT("Original Airdate") FROM table_22400 WHERE "Garfield Episode 1" = 'Cute for Loot'
wikisql
CREATE TABLE table_name_1 ( race VARCHAR, date VARCHAR )
What race happened on 04-25-2008?
SELECT race FROM table_name_1 WHERE date = "04-25-2008"
sql_create_context
CREATE TABLE table_name_32 ( date VARCHAR, set_2 VARCHAR )
What is the Date when the Set 2 is 13 25?
SELECT date FROM table_name_32 WHERE set_2 = "13–25"
sql_create_context
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of hire_date and the average of employee_id bin hire_date by time, sort by the y-axis in ascending.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(EMPLOYEE_ID)
nvbench
CREATE TABLE table_40948 ( "Name" text, "Position" text, "Number" real, "School/Club Team" text, "Season" text, "Acquisition via" text )
What is the position of Allen Gamboa?
SELECT "Position" FROM table_40948 WHERE "Name" = 'allen gamboa'
wikisql
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 ( ...
Show the name of each party and the corresponding number of delegates from that party with a bar chart, and list by the total number in desc.
SELECT T2.Party, SUM(COUNT(*)) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party ORDER BY SUM(COUNT(*)) DESC
nvbench
CREATE TABLE table_name_88 ( place VARCHAR, player VARCHAR )
What is Place, when Player is 'Arnold Palmer'?
SELECT place FROM table_name_88 WHERE player = "arnold palmer"
sql_create_context
CREATE TABLE table_57059 ( "VCTP" text, "VCA 155" text, "VCTM" text, "VCPC" text, "VCLC" text, "VCRT" text )
If there is a VCRT of 7.62mm (0.3in) fn mag 60-20 machine gun, what is the VCTP of that?
SELECT "VCTP" FROM table_57059 WHERE "VCRT" = '7.62mm (0.3in) fn mag 60-20 machine gun'
wikisql
CREATE TABLE table_203_522 ( id number, "week" number, "date" text, "opponent" text, "results\nfinal score" text, "results\nteam record" text, "venue" text, "attendance" number )
against which opponent was there the greatest attendance ?
SELECT "opponent" FROM table_203_522 ORDER BY "attendance" DESC LIMIT 1
squall
CREATE TABLE table_957 ( "Season" text, "Regionalliga S\u00fcd" text, "Regionalliga West/S\u00fcdwest" text, "Regionalliga Nord" text, "Regionalliga Nord-Ost" text )
what's the season with regionalliga nord being vfb oldenburg
SELECT "Season" FROM table_957 WHERE "Regionalliga Nord" = 'VfB Oldenburg'
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 is the number of patients whose days of hospital stay is greater than 9 and lab test name is promyelocytes?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "9" AND lab.label = "Promyelocytes"
mimicsql_data
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_ty...
when was the last time that patient 32163 received a procedure in the last hospital visit?
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 32163 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) ORDER BY procedures_icd.charttime DESC LIMIT 1
mimic_iii
CREATE TABLE table_54086 ( "House Name" text, "Composition" text, "Named after" text, "Founded" real, "Colours" text )
When is the earliest year founded for houses named after the river benue?
SELECT MIN("Founded") FROM table_54086 WHERE "Named after" = 'river benue'
wikisql
CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar...
the flight will originate from BOSTON
SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'BOSTON' AND flight.from_airport = airport_service.airport_code
atis
CREATE TABLE table_41387 ( "Episode Number" real, "Air Date" text, "Guest Host" text, "Musical Guest (Song performed)" text, "Coat Of Cash Wearing Celebrity" text )
What is the name of the Guest Host for Episode Number of 5?
SELECT "Guest Host" FROM table_41387 WHERE "Episode Number" = '5'
wikisql
CREATE TABLE table_name_9 ( best VARCHAR, qual_2 VARCHAR )
what team has the qual 2 of 1:44.050?
SELECT best FROM table_name_9 WHERE qual_2 = "1:44.050"
sql_create_context
CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TAB...
NURS 610 was last offered when ?
SELECT DISTINCT semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'NURS' AND course.number = 610 AND semester.semester_id = course_offering.semester ORDER BY semester.year DESC LIMIT 1
advising
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
give me the number of patients whose age is less than 81 and diagnoses long title is unspecified septicemia?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "81" AND diagnoses.long_title = "Unspecified septicemia"
mimicsql_data
CREATE TABLE news_report ( journalist_id number, event_id number, work_type text ) CREATE TABLE journalist ( journalist_id number, name text, nationality text, age text, years_working number ) CREATE TABLE event ( event_id number, date text, venue text, name text, e...
Show the names of journalists and the names of the events they reported in ascending order
SELECT T3.name, T2.name FROM news_report AS T1 JOIN event AS T2 ON T1.event_id = T2.event_id JOIN journalist AS T3 ON T1.journalist_id = T3.journalist_id ORDER BY T2.event_attendance
spider
CREATE TABLE School ( School_id text, School_name text, Location text, Mascot text, Enrollment int, IHSAA_Class text, IHSAA_Football_Class text, County text ) CREATE TABLE budget ( School_id int, Year int, Budgeted int, total_budget_percent_budgeted real, Invested in...
Return a bar chart showing the number of schools in each county, and display y-axis in ascending order.
SELECT County, COUNT(*) FROM School GROUP BY County ORDER BY COUNT(*)
nvbench
CREATE TABLE table_16023 ( "Episode #" real, "Production code" real, "Title" text, "Directed by" text, "Written by" text, "Airdate" text )
what is the production code with title 'skirting the issue / moon over my yinnie
SELECT "Production code" FROM table_16023 WHERE "Title" = 'Skirting the Issue / Moon Over my Yinnie'
wikisql
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE icustays ( row_id number, s...
when for the last time until 14 months ago was patient 7165 prescribed potassium phosphate and furosemide at the same time?
SELECT t1.startdate FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'potassium phosphate' AND admissions.subject_id = 7165 AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-14 month'...
mimic_iii
CREATE TABLE table_75040 ( "Rank" real, "Player" text, "Goals" real, "Games" real, "Goal Ratio" real )
How many goals have a goal ration less than 0.8 with 56 games?
SELECT COUNT("Goals") FROM table_75040 WHERE "Goal Ratio" < '0.8' AND "Games" = '56'
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 procedures ( ...
get me the number of patients on pseudoephedrine prescription who were hospitalized for more than 23 days.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "23" AND prescriptions.drug = "Pseudoephedrine"
mimicsql_data
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, ...
姓名是水清妍的参保人在2004年9月13日到2007年6月5日期间门诊检查一共花了多少钱?
SELECT SUM(t_kc22.AMOUNT) FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '水清妍' AND t_kc21.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2004-09-13' AND '2007-06-05' AND t_kc22.MED_INV_IT...
css
CREATE TABLE table_14903081_1 ( current_venue VARCHAR, location VARCHAR )
Which current venues location is Mason, Ohio?
SELECT current_venue FROM table_14903081_1 WHERE location = "Mason, Ohio"
sql_create_context
CREATE TABLE broadcast ( channel_id number, program_id number, time_of_day text ) CREATE TABLE program ( program_id number, name text, origin text, launch number, owner text ) CREATE TABLE channel ( channel_id number, name text, owner text, share_in_percent number, ...
Which channels are broadcast in the morning? Give me the channel names.
SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning'
spider
CREATE TABLE table_12033 ( "Peak" text, "Height (m)" real, "Prom. (m)" real, "Class" text, "Parent" text )
What is the average prom (m) when the height (m) is more than 733, the class is Hewitt, and the peak is Kirk Fell East Top?
SELECT AVG("Prom. (m)") FROM table_12033 WHERE "Height (m)" > '733' AND "Class" = 'hewitt' AND "Peak" = 'kirk fell east top'
wikisql
CREATE TABLE table_30007801_1 ( country_territory VARCHAR )
How many 3rd runner up values does Turkey have?
SELECT COUNT(3 AS rd_runner_up) FROM table_30007801_1 WHERE country_territory = "Turkey"
sql_create_context
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...
what is the number of private insurance patients who had open biopsy of liver?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.short_title = "Open liver biopsy"
mimicsql_data
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
what is the number of patients whose primary disease is ruq pain and age is less than 71?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "RUQ PAIN" AND demographic.age < "71"
mimicsql_data
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, a bar chart shows the distribution of name and revenue , and group by attribute name, order by the y-axis in desc.
SELECT T1.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name ORDER BY T2.Revenue DESC
nvbench
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate ...
Total number of resolved questions.
SELECT COUNT(*) FROM Posts WHERE PostTypeId = 1 AND AnswerCount > 0 AND NOT AcceptedAnswerId IS NULL
sede
CREATE TABLE table_2914 ( "Artist" text, "Song (English translation)" text, "Songwriter(s)" text, "Position" real, "Date Eliminated" text )
What is the position of 'k rleken v nder allt' (the love turns everything)?
SELECT "Position" FROM table_2914 WHERE "Song (English translation)" = 'Kärleken vänder allt" (The love turns everything)'
wikisql
CREATE TABLE table_name_79 ( position INTEGER, played INTEGER )
How many positions have Played smaller than 12?
SELECT SUM(position) FROM table_name_79 WHERE played < 12
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ...
provide the number of patients whose admission location is transfer from hosp/extram and discharge location is disch-tran to psych hosp?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP"
mimicsql_data
CREATE TABLE table_35287 ( "Date" text, "Opponents" text, "Venue" text, "Result" text, "Score F\u2013A" text )
Date of 4 august 2007 had what opponents?
SELECT "Opponents" FROM table_35287 WHERE "Date" = '4 august 2007'
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...
在04年7月4日到08年4月7日内医院2206684门诊医疗记录的数量总共是多少呢?
SELECT COUNT(*) FROM mzb WHERE mzb.MED_TYPE = '2206684' AND mzb.IN_HOSP_DAYS BETWEEN '2004-07-04' AND '2008-04-07'
css
CREATE TABLE table_44549 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What country has a 70-73-70=213 score?
SELECT "Country" FROM table_44549 WHERE "Score" = '70-73-70=213'
wikisql
CREATE TABLE table_11435 ( "Date" text, "Name" text, "Nationality" text, "Casualties" text, "Tonnage" real, "Sunk by\u2026" text )
What is the name of the ship sunk on 5 May 1943 from the United Kingdom sunk by an u-266 with 0 casualties?
SELECT "Name" FROM table_11435 WHERE "Date" = '5 may 1943' AND "Nationality" = 'united kingdom' AND "Sunk by\u2026" = 'u-266' AND "Casualties" = '0'
wikisql
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
Do you know how long they offered ENGLISH 403 ?
SELECT DISTINCT semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ENGLISH' AND course.number = 403 AND semester.semester_id = course_offering.semester ORDER BY semester.year LIMIT 1
advising
CREATE TABLE table_name_50 ( laps VARCHAR, grid VARCHAR )
How many laps for grid 12?
SELECT laps FROM table_name_50 WHERE grid = 12
sql_create_context
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...
count the number of patients on nu route of drug administration who have been hospitalized for more than a day.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "1" AND prescriptions.route = "NU"
mimicsql_data
CREATE TABLE table_name_50 ( proto_polynesian VARCHAR, proto_malayo_polynesian VARCHAR )
Which Proto-Polynesian has a Proto-Malayo-Polynesian of *telu?
SELECT proto_polynesian FROM table_name_50 WHERE proto_malayo_polynesian = "*telu"
sql_create_context
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_20...
Return a bar chart about the distribution of Nationality and the average of ID , and group by attribute Nationality, rank from low to high by the mean id.
SELECT Nationality, AVG(ID) FROM swimmer GROUP BY Nationality ORDER BY AVG(ID)
nvbench
CREATE TABLE table_36886 ( "Outcome" text, "Date" text, "Surface" text, "Partnering" text, "Opponent" text, "Score" text )
Who was the Opponent partnering with Jordan Kerr, on a hard surface that was the winner?
SELECT "Opponent" FROM table_36886 WHERE "Surface" = 'hard' AND "Outcome" = 'winner' AND "Partnering" = 'jordan kerr'
wikisql
CREATE TABLE table_203_283 ( id number, "#" number, "name" text, "strike tone\n(st-1/16)" text, "weight\n(kg)" number, "diameter\n(mm)" number, "inscription" text )
how many bells weight less than 1000 kg ?
SELECT COUNT("name") FROM table_203_283 WHERE "weight\n(kg)" < 1000
squall
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
how many days has it been since patient 025-50213 was prescribed dextrose 50% 25 gram/50 ml syr during the current hospital encounter the last time?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', medication.drugstarttime)) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-502...
eicu
CREATE TABLE table_38140 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Series" text )
Which Decision has a Date of april 30?
SELECT "Decision" FROM table_38140 WHERE "Date" = 'april 30'
wikisql
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) 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 ...
what was patient 9566's last time of .9% normal saline intake since 12/31/2105?
SELECT inputevents_cv.charttime 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 = 9566)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label ...
mimic_iii
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, give me the comparison about the average of manufacturer over the founder , and group by attribute founder.
SELECT Founder, AVG(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder
nvbench
CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city v...
During next Winter , what will the special topics classes be ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE (course.number = 398 OR course.number = 498 OR course.number = 598) AND course.department = 'E...
advising
CREATE TABLE table_1341395_33 ( result VARCHAR, district VARCHAR )
what are all the result for New York 7 district
SELECT result FROM table_1341395_33 WHERE district = "New York 7"
sql_create_context
CREATE TABLE table_24431264_18 ( rank VARCHAR, withdrew_due_to VARCHAR )
List the rank of the player that left the tournament due to right foot injury
SELECT COUNT(rank) FROM table_24431264_18 WHERE withdrew_due_to = "right foot injury"
sql_create_context
CREATE TABLE table_37380 ( "Year" real, "Senator" text, "Party" text, "State" text, "Result" text )
what is the senator in kentucky
SELECT "Senator" FROM table_37380 WHERE "State" = 'kentucky'
wikisql
CREATE TABLE table_64884 ( "Township" text, "County" text, "Pop. (2010)" real, "Land ( sqmi )" real, "Water (sqmi)" real, "Latitude" real, "Longitude" real, "GEO ID" real, "ANSI code" real )
What is the highest latitude when there are more than 0.518 square miles of water, a longitude less than -99.830606, and a population of 18?
SELECT MAX("Latitude") FROM table_64884 WHERE "Water (sqmi)" > '0.518' AND "Longitude" < '-99.830606' AND "Pop. (2010)" = '18'
wikisql
CREATE TABLE table_51789 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-10" real, "Top-25" real, "Events" real, "Cuts made" real )
For top-25 values under 2, what is the average number of cuts made?
SELECT AVG("Cuts made") FROM table_51789 WHERE "Top-25" < '2'
wikisql
CREATE TABLE region ( Region_id int, Region_code text, Region_name text ) 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_cit...
Return a bar chart on how many regions were affected by each storm?, and I want to list in asc by the y-axis.
SELECT Name, COUNT(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.Storm_ID = T2.Storm_ID GROUP BY T1.Storm_ID ORDER BY COUNT(*)
nvbench
CREATE TABLE table_name_8 ( year_at_cu VARCHAR, experience VARCHAR, position VARCHAR )
What year at CU is the person in video services with an experience less than 1?
SELECT year_at_cu FROM table_name_8 WHERE experience < 1 AND position = "video services"
sql_create_context
CREATE TABLE table_52869 ( "Player" text, "Att." real, "Comp" real, "Yards" real, "Rating" real )
For the player with yards less than 138, and Comp more than 0, what was the highest Att.?
SELECT MAX("Att.") FROM table_52869 WHERE "Yards" < '138' AND "Comp" > '0'
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 ) ...
give me the number of patients whose marital status is single and diagnoses icd9 code is 03849?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "SINGLE" AND diagnoses.icd9_code = "03849"
mimicsql_data
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, ...
how many patients aged below 64 years had celo-vessicle fistula as the primary disease?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CELO-VESSICLE FISTULA" AND demographic.age < "64"
mimicsql_data
CREATE TABLE table_name_75 ( bronze INTEGER, silver VARCHAR, gold VARCHAR, nation VARCHAR )
what is the average bronze when gold is more than 0, the nation is greece and silver is less than 0?
SELECT AVG(bronze) FROM table_name_75 WHERE gold > 0 AND nation = "greece" AND silver < 0
sql_create_context
CREATE TABLE table_54321 ( "Code" real, "Type" text, "Name" text, "Area (km 2 )" real, "Population" real, "Regional County Municipality" text, "Region" real )
What is the population total for saint-wenceslas with a region number of under 17?
SELECT SUM("Population") FROM table_54321 WHERE "Name" = 'saint-wenceslas' AND "Region" < '17'
wikisql
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE allergy ( allergy...
how much is patient 006-21388's change in his or her mchc measured at 2104-06-08 08:00:00 compared to the value measured at 2104-06-08 06:27:00?
SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-21388')) AND lab.labname = 'mchc' AND lab.labresulttime = '2104-06-08 08:00...
eicu
CREATE TABLE table_45651 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location/Attendance" text, "Record" text )
What is the sum of Game(s), when High Rebounds is 'Pierson (6)'?
SELECT SUM("Game") FROM table_45651 WHERE "High rebounds" = 'pierson (6)'
wikisql
CREATE TABLE employee ( emp_num number, emp_lname text, emp_fname text, emp_initial text, emp_jobcode text, emp_hiredate time, emp_dob time ) CREATE TABLE department ( dept_code text, dept_name text, school_code text, emp_num number, dept_address text, dept_extension...
What are the first names of all professors not teaching any classes?
SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' EXCEPT SELECT T1.emp_fname FROM employee AS T1 JOIN class AS T2 ON T1.emp_num = T2.prof_num
spider