context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_37361 ( "Year" text, "Played" real, "Wins" real, "Losses" real, "No Result" real, "% Win" text )
How many Played has a % Win of 50.00%, and Losses of 1, and Wins smaller than 1?
SELECT COUNT("Played") FROM table_37361 WHERE "% Win" = '50.00%' AND "Losses" = '1' AND "Wins" < '1'
wikisql
CREATE TABLE shop ( Shop_Name VARCHAR, Shop_ID VARCHAR ) CREATE TABLE stock ( Shop_ID VARCHAR )
Show names of shops that have more than one kind of device in stock.
SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T1.Shop_ID HAVING COUNT(*) > 1
sql_create_context
CREATE TABLE table_6646 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Round" text )
Record of 47 5 (1) involved what res?
SELECT "Res." FROM table_6646 WHERE "Record" = '47–5 (1)'
wikisql
CREATE TABLE table_204_183 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
japan finished below how many countries ?
SELECT COUNT("nation") FROM table_204_183 WHERE "rank" < (SELECT "rank" FROM table_204_183 WHERE "nation" = 'japan')
squall
CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_40...
Find the number of the names of swimmers who has a result of 'win', show names in ascending order please.
SELECT name, COUNT(name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID WHERE Result = 'Win' GROUP BY name ORDER BY name
nvbench
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, Cr...
Top answers on UX Stack Exchange.
SELECT CONCAT('http://dba.stackexchange.com/a/', Posts.Id) AS "Url", Posts.Score, Users.DisplayName FROM Posts JOIN Users ON (Posts.OwnerUserId = Users.Id) WHERE PostTypeId = 2 ORDER BY Score DESC LIMIT 100
sede
CREATE TABLE table_64598 ( "Name" text, "Games" text, "W-League" text, "Finals" text, "Goals" real, "Years" text )
What year had more than 2 goals and 11 (2) games?
SELECT "Years" FROM table_64598 WHERE "Goals" > '2' AND "Games" = '11 (2)'
wikisql
CREATE TABLE table_name_58 ( replaced_by VARCHAR, position_in_table VARCHAR )
Who replaced when the position in table is 5th?
SELECT replaced_by FROM table_name_58 WHERE position_in_table = "5th"
sql_create_context
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, ...
MSE rate of posting (non-zero).
SELECT COUNT(*) AS Q_count, p.OwnerUserId AS uid FROM Posts AS p WHERE p.PostTypeId = 1 AND p.OwnerUserId IN (141525, 146126, 811, 50049, 1438, 164200, 115866, 155160, 98786, 209637, 147336, 131182, 135201, 23354, 51, 6212, 146719, 166017, 4, 2, 130213, 159928, 13, 176330, 208518, 142481, 229741, 232374, 147574, 235711...
sede
CREATE TABLE table_17872 ( "No." real, "Episode" text, "Writer" text, "Director" text, "Viewers(millions)" text, "Original airdate" text )
How many viewers did Episode 5 have?
SELECT "Viewers(millions)" FROM table_17872 WHERE "Episode" = 'Episode 5'
wikisql
CREATE TABLE table_17930 ( "Club" text, "Australian Marquee" text, "International Marquee" text, "Junior Marquee player" text, "Captain" text, "Vice-Captain" text )
Name the captain for ben sigmund
SELECT "Captain" FROM table_17930 WHERE "Vice-Captain" = 'Ben Sigmund'
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
how many urgent hospital admission patients have diagnoses icd9 code 99813?
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 = "99813"
mimicsql_data
CREATE TABLE table_name_1 ( attendance INTEGER, date VARCHAR )
What was the lowest Attendance on 8 October 1986?
SELECT MIN(attendance) FROM table_name_1 WHERE date = "8 october 1986"
sql_create_context
CREATE TABLE table_name_38 ( grid INTEGER, time_retired VARCHAR, driver VARCHAR )
What is the average grid for johnny herbert with a Time/Retired of +1 lap?
SELECT AVG(grid) FROM table_name_38 WHERE time_retired = "+1 lap" AND driver = "johnny herbert"
sql_create_context
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...
在44520665号的医疗记录显示其所开出的药品价格全都比7717.72元还高的医疗就诊编号是多少?
SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_ID = '44520665' AND NOT MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc22 WHERE AMOUNT < 7717.72)
css
CREATE TABLE table_name_85 ( opponents VARCHAR, surface VARCHAR, date VARCHAR )
Who were the opponents that played on a hard surface on July 13, 2008?
SELECT opponents FROM table_name_85 WHERE surface = "hard" AND date = "july 13, 2008"
sql_create_context
CREATE TABLE table_64295 ( "Japanese Title" text, "Romaji Title" text, "TV Station" text, "Episodes" real, "Average Ratings" text )
Which episodes has the lowest average ratings of 8.7%?
SELECT MIN("Episodes") FROM table_64295 WHERE "Average Ratings" = '8.7%'
wikisql
CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER ) CREATE TABLE weather ( date TEX...
What are the id and name of the stations that have ever had more than 12 bikes available? Plot them as a bar chart, sort total number in descending order.
SELECT name, id FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available > 12 ORDER BY id DESC
nvbench
CREATE TABLE table_name_26 ( venue VARCHAR, against VARCHAR )
Which Venue has an Against of 25?
SELECT venue FROM table_name_26 WHERE against = 25
sql_create_context
CREATE TABLE table_name_80 ( season INTEGER, position INTEGER )
What is the earliest season that has a position over 12?
SELECT MIN(season) FROM table_name_80 WHERE position > 12
sql_create_context
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
在2006年3月27日到2016年9月4日期间,医院4607031的科室在门诊就诊中开出不小于19张检验报告单的有多少
SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM mzjzjlb JOIN jybgb JOIN hz_info_mzjzjlb ON hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_inf...
css
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 d_labitems ( row_id number, itemid number, label text ) CREATE TABLE diagnoses_icd ( row_id numbe...
list the top four most common diagnoses that patients were diagnosed with within 2 months after being diagnosed with thoracic aortic aneurysm until 1 year ago.
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions...
mimic_iii
CREATE TABLE table_52429 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
When the Away team was south melbourne what was the home team?
SELECT "Home team" FROM table_52429 WHERE "Away team" = 'south melbourne'
wikisql
CREATE TABLE table_14376 ( "January" text, "February" text, "March" text, "April" text, "June" text, "July" text, "August" text, "September" text, "October" text, "November" text, "December" text )
Who is the March playmate with a November playmate Cara Wakelin?
SELECT "March" FROM table_14376 WHERE "November" = 'cara wakelin'
wikisql
CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) 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, ...
查看哪个门诊或住院的流水号是对应77482347657医疗就诊的
SELECT t_kc24.CLINIC_ID FROM t_kc24 JOIN t_kc21_t_kc24 JOIN t_kc21 ON t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID AND t_kc21_t_kc24.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '77482347657'
css
CREATE TABLE table_23165 ( "RPM" real, "Standard HP" text, "Standard torque (lb/ft)" text, "Standard speed (6th gear)" text, "Modified speed (6th gear)" real, "Modified HP" text, "Modified torque (lb/ft)" text )
when standard speed (6th gear) is 88, what is the rpm?
SELECT "RPM" FROM table_23165 WHERE "Standard speed (6th gear)" = '88'
wikisql
CREATE TABLE table_26102 ( "Service" real, "Train number" real, "Train name" text, "Source" text, "Departure" text, "Destination" text, "Arrival" text )
What's the name of the train that goes to Bhubaneswar?
SELECT "Train name" FROM table_26102 WHERE "Destination" = 'Bhubaneswar'
wikisql
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 text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
how many married patients have the diagnosis icd9 code as 53089?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "MARRIED" AND diagnoses.icd9_code = "53089"
mimicsql_data
CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER ) CREATE TABLE status ( station_i...
On which day has it neither been foggy nor rained in the zip code of 94107, and count them by a bar chart, and I want to order in descending by the Y-axis.
SELECT date, COUNT(date) FROM weather WHERE zip_code = 94107 AND events <> "Fog" AND events <> "Rain" ORDER BY COUNT(date) DESC
nvbench
CREATE TABLE GENRE ( GenreId VARCHAR, Name VARCHAR ) CREATE TABLE TRACK ( GenreId VARCHAR )
How many tracks belong to rock genre?
SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock"
sql_create_context
CREATE TABLE table_204_130 ( id number, "#" number, "date" text, "venue" text, "opponent" text, "score" text, "result" text, "competition" text )
what is the last date ?
SELECT "date" FROM table_204_130 ORDER BY "date" DESC LIMIT 1
squall
CREATE TABLE table_34114 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
Which Total is the highest one that has a Gold of 1, and a Nation of czechoslovakia?
SELECT MAX("Total") FROM table_34114 WHERE "Gold" = '1' AND "Nation" = 'czechoslovakia'
wikisql
CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE Apartment_Facilities ( apt_id I...
What is the booking end dates of the apartments with type code 'Duplex'? Bin the year into weekday interval with a bar chart.
SELECT booking_end_date, COUNT(booking_end_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_type_code = "Duplex"
nvbench
CREATE TABLE table_204_922 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
what country scored the top number of bronze medals in taekwondo at the 2013 bolivarian games ?
SELECT "nation" FROM table_204_922 ORDER BY "bronze" DESC LIMIT 1
squall
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE jyjgzbb ( BGDH text, BGRQ tim...
患者曹明智的身高多少厘米、体重多少公斤
SELECT wdmzjzjlb.SG, wdmzjzjlb.TZ FROM person_info JOIN hz_info JOIN wdmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE person_info.XM = '曹明智' UNION SELECT bdmzjzjlb.SG, bdmzjzjlb.TZ FROM person_info JOIN hz_info JOIN bd...
css
CREATE TABLE manager_half ( player_id text, year number, team_id text, league_id text, inseason number, half number, g number, w number, l number, rank number ) CREATE TABLE team_half ( year number, league_id text, team_id text, half number, div_id text, ...
How much salary did the top 3 well-paid players get in 2001?
SELECT salary FROM salary WHERE year = 2001 ORDER BY salary DESC LIMIT 3
spider
CREATE TABLE table_62943 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
How many silver medals when the bronze is more than 2 and having a rank more than 5?
SELECT MAX("Silver") FROM table_62943 WHERE "Rank" > '5' AND "Bronze" > '2'
wikisql
CREATE TABLE club_rank ( Rank real, Club_ID int, Gold real, Silver real, Bronze real, Total real ) CREATE TABLE competition_result ( Competition_ID int, Club_ID_1 int, Club_ID_2 int, Score text ) CREATE TABLE player ( Player_ID int, name text, Position text, Clu...
Give me a bar chart for how many competition type of each competition type, and rank the number of competition type in ascending order.
SELECT Competition_type, COUNT(Competition_type) FROM competition GROUP BY Competition_type ORDER BY COUNT(Competition_type)
nvbench
CREATE TABLE table_61686 ( "Model" text, "Chassis code" text, "Production time" text, "Number built" real, "Engine" text )
What model has a number built smaller than 6.526, and the Chassis code w109.015?
SELECT "Model" FROM table_61686 WHERE "Number built" < '6.526' AND "Chassis code" = 'w109.015'
wikisql
CREATE TABLE table_16019 ( "Episode #" real, "Production code" real, "Title" text, "Directed by" text, "Written by" text, "Airdate" text )
what is the minimum production code with title 'foreign exchange problem / turn about
SELECT MIN("Production code") FROM table_16019 WHERE "Title" = 'Foreign Exchange Problem / Turn About'
wikisql
CREATE TABLE table_16186152_1 ( delegates VARCHAR, candidate VARCHAR )
Candidate John Mccain had how many delegates?
SELECT delegates FROM table_16186152_1 WHERE candidate = "John McCain"
sql_create_context
CREATE TABLE table_name_9 ( round INTEGER, pick VARCHAR )
WHAT IS THE ROUND WITH PICK OF 7?
SELECT SUM(round) FROM table_name_9 WHERE pick = 7
sql_create_context
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime...
what is the name of the drug that has been prescribed two or more times in 12/2105 to patient 015-58787?
SELECT t1.drugname FROM (SELECT medication.drugname, COUNT(medication.drugstarttime) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015...
eicu
CREATE TABLE qtb ( 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...
在00年5月21日到00年10月13日这段时间,患者46674930就医时一共开出的哪些药品,把这些药品的编码、名称、数量、单价、金额列出来
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_kc22.QTY, t_kc22.UNIVALENT, t_kc22.AMOUNT FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_ID = '46674930' AND qtb.IN_HOSP_DATE BETWEEN '2000-05-21' AND '2000-10-13' UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_k...
css
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 aircraft ( aircraft_code varchar, aircraft_description varchar, manufac...
please list the flights from CHARLOTTE to NEWARK
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 = 'CHARLOTTE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NEWA...
atis
CREATE TABLE table_name_35 ( original_title VARCHAR, director VARCHAR, film_title_used_in_nomination VARCHAR )
What is Original title, when Director is Veljko Bulaji category:articles with hcards, and when Film title used in nomination is Train Without A Timetable?
SELECT original_title FROM table_name_35 WHERE director = "veljko bulajić category:articles with hcards" AND film_title_used_in_nomination = "train without a timetable"
sql_create_context
CREATE TABLE table_name_84 ( position VARCHAR, overall VARCHAR, pick VARCHAR )
What is Position, when Overallis less than 314, and when Pick is less than 8?
SELECT position FROM table_name_84 WHERE overall < 314 AND pick < 8
sql_create_context
CREATE TABLE table_name_88 ( attendance VARCHAR, week VARCHAR )
What was the attendance during week 7?
SELECT attendance FROM table_name_88 WHERE week = 7
sql_create_context
CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TE...
A bar chart for what are the number of the wines that have prices lower than 50 and have appelations in Monterey county?, I want to sort by the Y in descending please.
SELECT Name, COUNT(Name) FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Monterey" AND T2.Price < 50 GROUP BY Name ORDER BY COUNT(Name) DESC
nvbench
CREATE TABLE table_24690 ( "Location" text, "July (\u00b0C)" text, "July (\u00b0F)" text, "January (\u00b0C)" text, "January (\u00b0F)" text )
What is the total number of January ( C) temperatures when the July ( C) temperatures were 23/15?
SELECT COUNT("January (\u00b0C)") FROM table_24690 WHERE "July (\u00b0C)" = '23/15'
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 diagnoses_icd ( row_id number, ...
what is the total number of patients discharged from a hospital in 2104?
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE NOT admissions.dischtime IS NULL AND STRFTIME('%y', admissions.dischtime) = '2104'
mimic_iii
CREATE TABLE table_77408 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is Player, when Score is '66-74-76=216'?
SELECT "Player" FROM table_77408 WHERE "Score" = '66-74-76=216'
wikisql
CREATE TABLE table_9800 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text )
What was the winning score when the runner-up was Beth Daniel and the margin of victory was 7 strokes?
SELECT "Winning score" FROM table_9800 WHERE "Runner(s)-up" = 'beth daniel' AND "Margin of victory" = '7 strokes'
wikisql
CREATE TABLE table_18102421_2 ( us_viewers__millions_ VARCHAR, directed_by VARCHAR )
How many millions of U.S. viewers watched the episode directed by Allison Liddi-Brown?
SELECT us_viewers__millions_ FROM table_18102421_2 WHERE directed_by = "Allison Liddi-Brown"
sql_create_context
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...
Name the drug type and route of administration for the drug with drug code KPHO45I.
SELECT prescriptions.drug_type, prescriptions.route FROM prescriptions WHERE prescriptions.formulary_drug_cd = "KPHO45I"
mimicsql_data
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 products with a price between 60 and 120, find name and code , and visualize them by a bar chart, list Y-axis in ascending order please.
SELECT Name, Code FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Code
nvbench
CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight real ) CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate re...
A bar chart showing the average weight for each gender, I want to sort total number from high to low order.
SELECT Sex, AVG(Weight) FROM people GROUP BY Sex ORDER BY AVG(Weight) DESC
nvbench
CREATE TABLE school_details ( School_ID int, Nickname text, Colors text, League text, Class text, Division text ) CREATE TABLE school ( School_ID int, School text, Location text, Enrollment real, Founded real, Denomination text, Boys_or_Girls text, Day_or_Boardin...
For each denomination, return the denomination and the count of schools with that denomination Visualize by bar chart, and could you list Denomination in asc order?
SELECT Denomination, COUNT(*) FROM school GROUP BY Denomination ORDER BY Denomination
nvbench
CREATE TABLE table_33769 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "TV Time" text, "Attendance" text )
How many people were at the game with a record of 6-1?
SELECT "Attendance" FROM table_33769 WHERE "Record" = '6-1'
wikisql
CREATE TABLE video_games ( gameid number, gname text, gtype text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE plays_games ( stuid number, gameid number, hours_pla...
What are the ids of all students who don't play sports?
SELECT stuid FROM student EXCEPT SELECT stuid FROM sportsinfo
spider
CREATE TABLE table_40621 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
What is the Tournament with a Score that is 2 6, 6 4, 3 6?
SELECT "Tournament" FROM table_40621 WHERE "Score" = '2–6, 6–4, 3–6'
wikisql
CREATE TABLE section ( course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), building varchar(15), room_number varchar(7), time_slot_id varchar(4) ) CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), tot_cred numeric(3,0...
Find the number of rooms with more than 50 capacity for each building Show bar chart, and could you display by the names from low to high?
SELECT building, COUNT(*) FROM classroom WHERE capacity > 50 GROUP BY building ORDER BY building
nvbench
CREATE TABLE table_73194 ( "LMS No." real, "WD No." real, "Builder" text, "Serial No." real, "Date built" real )
Name the total number of wd number for lms number being 7638
SELECT COUNT("WD No.") FROM table_73194 WHERE "LMS No." = '7638'
wikisql
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text ...
Top users who haven't changed their username.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS Rank, Id AS "user_link", Reputation FROM Users WHERE DisplayName = 'user' + CAST(Id AS TEXT(40)) LIMIT 100
sede
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId...
The most viewed ELL questions.
SELECT Id AS "post_link", ViewCount, Score FROM Posts ORDER BY ViewCount DESC LIMIT 200
sede
CREATE TABLE table_name_16 ( crude_death_rate__per_1000_ INTEGER, deaths VARCHAR, average_population__x_1000_ VARCHAR )
What is the highest crude death rate when deaths are 3 433 and average population is greater than 298?
SELECT MAX(crude_death_rate__per_1000_) FROM table_name_16 WHERE deaths = "3 433" AND average_population__x_1000_ > 298
sql_create_context
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartr...
what is the four most frequent drugs that were prescribed during the same hospital encounter to failure to wean female patients of age 40s after they have been diagnosed with failure to wean since 2104?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'failure to wean...
eicu
CREATE TABLE table_5136 ( "Date" text, "Tournament" text, "Surface" text, "Opponent in the Final" text, "Score" text )
Score of 3 6, 7 5, 6 4 included what date?
SELECT "Date" FROM table_5136 WHERE "Score" = '3–6, 7–5, 6–4'
wikisql
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, find hire_date and the sum of salary bin hire_date by weekday, and visualize them by a bar chart, and sort total number in descending order.
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY SUM(SALARY) DESC
nvbench
CREATE TABLE table_63097 ( "Date" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real )
Which Opponent has a Result of 1 1, and a Date of 28 november 1998?
SELECT "Opponent" FROM table_63097 WHERE "Result" = '1–1' AND "Date" = '28 november 1998'
wikisql
CREATE TABLE table_29225103_2 ( cm_winning_team VARCHAR, fm_winning_team VARCHAR )
Who was the CM winning team when the FM winning team was #17 Elva - Ford?
SELECT cm_winning_team FROM table_29225103_2 WHERE fm_winning_team = "#17 Elva - Ford"
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...
give me the number of patients whose procedure short title is lap periton adhesiolysis?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.short_title = "Lap periton adhesiolysis"
mimicsql_data
CREATE TABLE table_name_26 ( result VARCHAR, date VARCHAR )
What is Result, when Date is 11 August 1992?
SELECT result FROM table_name_26 WHERE date = "11 august 1992"
sql_create_context
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) 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, H...
最短医疗住院时间超过27天的在医院4547254有多少个科室?
SELECT COUNT(*) FROM (SELECT t_kc21.MED_ORG_DEPT_CD FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '4547254' GROUP BY t_kc21.MED_ORG_DEPT_CD HAVING MIN(t_kc21.IN_HOSP_DAYS) > 27) AS T
css
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
这位朱伟毅患者以前有什么异常的情况吗?
SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb 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 AND jybgb.YLJGDM = jyjgzbb.YLJGDM...
css
CREATE TABLE table_11251109_3 ( _number VARCHAR, air_date VARCHAR )
What is the rank number that aired october 26, 2007?
SELECT RANK(_number) FROM table_11251109_3 WHERE air_date = "October 26, 2007"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) CREATE TABLE zyjzjlb ( YLJGDM text, JZLSH text, MZJZLSH text, KH text, KLX number, HZXM text, WDBZ number, RYDJSJ time, RYTJDM number, RYTJMC text, JZKSDM text, JZKSMC text, RZBQDM t...
患者00438442在2003年4月21日到2011年10月27日内被开出多少份检验报告单?
SELECT (SELECT COUNT(*) FROM hz_info JOIN mzjzjlb JOIN jybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '00438442' AND jybgb.BGRQ BETWEEN '2003-04-21' AND '2011-10-27'...
css
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
列出患者93496868就诊科室名称不包含产的所有门诊就诊记录的流水号是什么,在医院3314397中?
SELECT mzjzjlb.JZLSH FROM hz_info JOIN mzjzjlb JOIN hz_info_mzjzjlb ON 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_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzj...
css
CREATE TABLE table_75081 ( "Venue" text, "Home" text, "Guest" text, "Score" text, "Attendance" real )
What was the score for the game with FK Bratstvo as home team?
SELECT "Score" FROM table_75081 WHERE "Home" = 'fk bratstvo'
wikisql
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 demographic (...
what is the number of patients whose diagnoses short title is dmi renl nt st uncntrld and procedure short title is infusion of vasopressor?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE diagnoses.short_title = "DMI renl nt st uncntrld" AND procedures.short_title = "Infusion of vasopressor"
mimicsql_data
CREATE TABLE table_49322 ( "Season" text, "Series" text, "Team" text, "Races" text, "Wins" text, "Poles" text, "F/Laps" text, "Podiums" text, "Points" text, "Position" text )
Which team had 1 race, 1 F/lap and in the series 24 hours of Nurburgring?
SELECT "Team" FROM table_49322 WHERE "Races" = '1' AND "F/Laps" = '1' AND "Series" = '24 hours of nurburgring'
wikisql
CREATE TABLE table_name_45 ( record VARCHAR, visitor VARCHAR, date VARCHAR )
What record has pittsburgh as the visitor, and November 23 as the date?
SELECT record FROM table_name_45 WHERE visitor = "pittsburgh" AND date = "november 23"
sql_create_context
CREATE TABLE Catalog_Contents ( catalog_entry_id INTEGER, catalog_level_number INTEGER, parent_entry_id INTEGER, previous_entry_id INTEGER, next_entry_id INTEGER, catalog_entry_name VARCHAR(80), product_stock_number VARCHAR(50), price_in_dollars DOUBLE, price_in_euros DOUBLE, pri...
What are the names of catalog entries with level number 8, and count them by a bar chart, and display from high to low by the Y-axis.
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 ORDER BY COUNT(catalog_entry_name) DESC
nvbench
CREATE TABLE ref_document_types ( document_type_code text, document_type_name text, document_type_description text ) CREATE TABLE documents_to_be_destroyed ( document_id number, destruction_authorised_by_employee_id number, destroyed_by_employee_id number, planned_destruction_date time, ...
What is the location code for the country 'Canada'?
SELECT location_code FROM ref_locations WHERE location_name = "Canada"
spider
CREATE TABLE table_15418 ( "Season" text, "Games" real, "Lost" real, "Tied" real, "Points" real, "Goals for" real, "Goals against" real, "Standing" text )
Name the least tied with games more than 70 and goals for less than 310 with points of 98
SELECT MIN("Tied") FROM table_15418 WHERE "Games" > '70' AND "Goals for" < '310' AND "Points" = '98'
wikisql
CREATE TABLE table_204_504 ( id number, "year" number, "award" text, "category" text, "work" text, "result" text )
how many times was she nominated ?
SELECT COUNT(*) FROM table_204_504 WHERE "result" = 'nominated'
squall
CREATE TABLE table_26614365_1 ( western VARCHAR, latin VARCHAR )
What is the western word for 'latrones' in Latin?
SELECT western FROM table_26614365_1 WHERE latin = "latrones"
sql_create_context
CREATE TABLE table_name_34 ( attendance VARCHAR, home_team VARCHAR )
What was the attendance at the Billericay Town home game?
SELECT attendance FROM table_name_34 WHERE home_team = "billericay town"
sql_create_context
CREATE TABLE playlisttrack ( playlistid number, trackid number ) CREATE TABLE genre ( genreid number, name text ) CREATE TABLE customer ( customerid number, firstname text, lastname text, company text, address text, city text, state text, country text, postalcode te...
List the phone numbers of all employees.
SELECT phone FROM employee
spider
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, ...
give the number of patients diagnosed with sternal wound infection and born before the year 2085.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "STERNAL WOUND INFECTION" AND demographic.dob_year < "2085"
mimicsql_data
CREATE TABLE table_1140082_2 ( constructor VARCHAR, race VARCHAR )
What is the constructor of the Swedish Grand Prix?
SELECT constructor FROM table_1140082_2 WHERE race = "Swedish Grand Prix"
sql_create_context
CREATE TABLE table_10927 ( "Model" text, "FSB (MHz)" text, "Chipset" text, "Memory" text, "Graphics" text )
What type of graphics are present in the Precision 340 model with the intel 850e chipset?
SELECT "Graphics" FROM table_10927 WHERE "Chipset" = 'intel 850e' AND "Model" = 'precision 340'
wikisql
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE program_requirement ( program_id int...
When Tina Stewart took WOMENSTD 511 who taught it ?
SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN student_record ON student_record.offering_id = offering_instructor.offering_id INNER JOIN student ON student.student_id = student_record.student_id INNER JOIN course_...
advising
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
what is the number of patients whose primary disease is gangrene and drug route is td?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "GANGRENE" AND prescriptions.route = "TD"
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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttim...
what was the maximum hemoglobin value for patient 9619 until 05/2102.
SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9619) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'hemoglobin') AND STRFTIME('%y-%m', labevents.charttime) <= '2102-05'
mimic_iii
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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttim...
how many hours has it been since the last intake of d5w for patient 12775 on the current intensive care unit visit?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', 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 = 12775) AND icustays.outtime IS NULL)...
mimic_iii
CREATE TABLE table_15607589_2 ( record VARCHAR, opponent VARCHAR )
Name the record for new york giants
SELECT record FROM table_15607589_2 WHERE opponent = "New York Giants"
sql_create_context
CREATE TABLE table_203_810 ( id number, "#" number, "title" text, "songwriters" text, "producer(s)" text, "performer (s)" text )
which performer was listed at least 3 times in both the producer column and the performer column ?
SELECT "producer(s)" FROM table_203_810 GROUP BY "producer(s)" HAVING COUNT(*) >= 3
squall
CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE...
flights and fares from DENVER to OAKLAND
SELECT DISTINCT fare.fare_id, flight.airline_code, flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPO...
atis
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 text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
How many patients were born before the year 2097 and have procedure icd9 code 2501?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2097" AND procedures.icd9_code = "2501"
mimicsql_data