context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_9098 ( "Region (year)" text, "No. 1" text, "No. 2" text, "No. 3" text, "No. 4" text, "No. 5" text, "No. 6" text, "No. 7" text, "No. 8" text, "No. 9" text, "No. 10" text )
Who was No. 8 when No. 1 Michael and No. 4 Logan?
SELECT "No. 8" FROM table_9098 WHERE "No. 1" = 'michael' AND "No. 4" = 'logan'
wikisql
CREATE TABLE table_name_31 ( type VARCHAR, where_built VARCHAR )
What was the type of boat built in Port Blakeley
SELECT type FROM table_name_31 WHERE where_built = "port blakeley"
sql_create_context
CREATE TABLE table_12118 ( "Mininera DFL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
WHAT IS THE HIGHEST AGAINST WITH LOSSES SMALLER THAN 17, DRAWS LARGER THAN 1?
SELECT MAX("Against") FROM table_12118 WHERE "Losses" < '17' AND "Draws" > '1'
wikisql
CREATE TABLE table_name_57 ( player VARCHAR, place VARCHAR, country VARCHAR )
What player has t3 as the place, with england united states as the country?
SELECT player FROM table_name_57 WHERE place = "t3" AND country = "england united states"
sql_create_context
CREATE TABLE route ( train_id int, station_id int ) CREATE TABLE station ( id int, network_name text, services text, local_authority text ) CREATE TABLE train ( id int, train_number int, name text, origin text, destination text, time text, interval text ) CREATE TA...
Bar graph to show the average of high temperature from different day of week, I want to rank by the bars from low to high.
SELECT day_of_week, AVG(high_temperature) FROM weekly_weather GROUP BY day_of_week ORDER BY day_of_week
nvbench
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 Users ( Id number, Reputation number,...
Number/Count of user who have 5000+ reputation..
SELECT COUNT(*), (SELECT COUNT(*) FROM Users), COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Users) FROM Users WHERE Reputation > 5000
sede
CREATE TABLE table_name_38 ( silver INTEGER, bronze VARCHAR, gold VARCHAR )
What is the highest number of silver when there is 1 bronze and less than 4 golds?
SELECT MAX(silver) FROM table_name_38 WHERE bronze = 1 AND gold < 4
sql_create_context
CREATE TABLE table_name_55 ( last_issue VARCHAR, title VARCHAR )
What is the last issue entry of Time and Again?
SELECT last_issue FROM table_name_55 WHERE title = "time and again"
sql_create_context
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, ...
count the number of patients whose year of birth is less than 2121 and lab test fluid is ascites?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2121" AND lab.fluid = "Ascites"
mimicsql_data
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 Customer_Policies ( Policy_ID INTEGER, Customer_ID INTEGER, Policy_Type_Code CHAR(15), Start_Date DATE, End...
For all the claims whose claimed amount is larger than the average, bin the settlement date into the day of week interval and count them for visualizing a bar chart, display y-axis in descending order.
SELECT Date_Claim_Settled, COUNT(Date_Claim_Settled) FROM Claims WHERE Amount_Claimed > (SELECT AVG(Amount_Claimed) FROM Claims) ORDER BY COUNT(Date_Claim_Settled) DESC
nvbench
CREATE TABLE table_name_28 ( name VARCHAR, percentage VARCHAR )
Which name has a percentage of 0.59%?
SELECT name FROM table_name_28 WHERE percentage = "0.59%"
sql_create_context
CREATE TABLE table_29977 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (million)" text )
What was the production code of the episode no. 55 in the series?
SELECT "Production code" FROM table_29977 WHERE "No. in series" = '55'
wikisql
CREATE TABLE table_203_146 ( id number, "year" number, "association" text, "category" text, "nominated work" text, "result" text )
which movie was the first win ?
SELECT "nominated work" FROM table_203_146 WHERE "result" = 'won' ORDER BY "year" LIMIT 1
squall
CREATE TABLE table_41938 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-10" real, "Top-25" real, "Events" real, "Cuts made" real )
What are the Cuts made with a Top-10 smaller than 2?
SELECT SUM("Cuts made") FROM table_41938 WHERE "Top-10" < '2'
wikisql
CREATE TABLE table_name_73 ( nominee VARCHAR, award_ceremony VARCHAR, category VARCHAR )
Which Nominee has an Award Ceremony of tony award, and a Category of the best performance by a leading actor in a musical?
SELECT nominee FROM table_name_73 WHERE award_ceremony = "tony award" AND category = "best performance by a leading actor in a musical"
sql_create_context
CREATE TABLE track ( track_id number, name text, location text, seating number, year_opened number ) CREATE TABLE race ( race_id number, name text, class text, date text, track_id text )
Show name, class, and date for all races.
SELECT name, class, date FROM race
spider
CREATE TABLE table_75672 ( "Ranking" real, "Nationality" text, "Name" text, "Adjusted fee" text, "From" text, "Year" real )
Where is the ranked 2 players from?
SELECT "From" FROM table_75672 WHERE "Ranking" = '2'
wikisql
CREATE TABLE table_name_26 ( moving_from VARCHAR, nat VARCHAR )
Which Moving from has a Nat of ned?
SELECT moving_from FROM table_name_26 WHERE nat = "ned"
sql_create_context
CREATE TABLE table_77618 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text )
What was the date of the game that had a score of 3 1?
SELECT "Date" FROM table_77618 WHERE "Score" = '3 – 1'
wikisql
CREATE TABLE table_16886 ( "Year" real, "Location" text, "1st Place" text, "2nd Place" text, "3rd Place" text, "4th Place" text, "5th Place" text )
What school took 4th place in 2002?
SELECT "4th Place" FROM table_16886 WHERE "Year" = '2002'
wikisql
CREATE TABLE table_22993636_5 ( three_pointers INTEGER, steals VARCHAR )
What is the lowest number of 3 pointers that occured in games with 52 steals?
SELECT MIN(three_pointers) FROM table_22993636_5 WHERE steals = 52
sql_create_context
CREATE TABLE table_name_63 ( ends_lost INTEGER, shot__percentage VARCHAR, ends_won VARCHAR )
Name the highest Ends Lost which has an Shot % larger than 78, and a Ends Won smaller than 38?
SELECT MAX(ends_lost) FROM table_name_63 WHERE shot__percentage > 78 AND ends_won < 38
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 diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microb...
provide me with the four most common diagnoses since 2103.
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE STRFTIME('%y', diagnoses_icd.charttime) >= '2103' GROUP BY diagnoses_icd.icd9_code) AS t1 WHERE ...
mimic_iii
CREATE TABLE table_36432 ( "Season" text, "Race" real, "Podium" real, "Pole" real, "FLap" real )
Pole smaller than 0 had what lowest podium?
SELECT MIN("Podium") FROM table_36432 WHERE "Pole" < '0'
wikisql
CREATE TABLE table_18926 ( "Date" text, "Winning Team" text, "Score" text, "Winning Pitcher" text, "Losing Pitcher" text, "Attendance" real, "Location" text )
Who was the losing pitcher when 40583 attended?
SELECT "Losing Pitcher" FROM table_18926 WHERE "Attendance" = '40583'
wikisql
CREATE TABLE table_9998 ( "Date" text, "Round" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real )
Who was the opponent in the round of R2?
SELECT "Opponent" FROM table_9998 WHERE "Round" = 'r2'
wikisql
CREATE TABLE table_12266757_1 ( womens_singles VARCHAR, season VARCHAR )
Who won the womens singles in the 1958/1959 season?
SELECT womens_singles FROM table_12266757_1 WHERE season = "1958/1959"
sql_create_context
CREATE TABLE airport_aircraft ( ID int, Airport_ID int, Aircraft_ID int ) CREATE TABLE airport ( Airport_ID int, Airport_Name text, Total_Passengers real, %_Change_2007 text, International_Passengers real, Domestic_Passengers real, Transit_Passengers real, Aircraft_Movements...
Please list the number of each winning aircraft in a bar chart, I want to show in ascending by the bars.
SELECT Aircraft, COUNT(Aircraft) FROM aircraft AS T1 JOIN match AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY Aircraft ORDER BY Aircraft
nvbench
CREATE TABLE table_24986 ( "Year" text, "Chairman" text, "Artistic Director" text, "Performance Liaison" text, "Secretary" text, "Business manager" text, "Production Stagemanager" text, "Dramaturge" text, "Public Relations" text, "First/Second Year Rep." text, "Male Rep." tex...
Who was the male rep. when Caroline Rhoads was the artistic director?
SELECT "Male Rep." FROM table_24986 WHERE "Artistic Director" = 'Caroline Rhoads'
wikisql
CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Movie ( mID int, title text, year int, director text ) CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date )
Please return me a bar chart show what are the average smallest rating of different movie title?
SELECT T2.title, AVG(MIN(T1.stars)) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T2.title
nvbench
CREATE TABLE table_7996 ( "Date" text, "Season" text, "Playing for" text, "Opponent" text, "Final score" text )
What team was the opponent in the 2008 09 season, with a final score of 2 3 l?
SELECT "Opponent" FROM table_7996 WHERE "Season" = '2008–09' AND "Final score" = '2–3 l'
wikisql
CREATE TABLE table_24291077_4 ( brisbane INTEGER )
What is the highest number of Brisbane viewers?
SELECT MAX(brisbane) FROM table_24291077_4
sql_create_context
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 medication ( medi...
what was the four most frequent drugs that were prescribed within the same hospital visit to a drug withdrawal syndrome - alcohol female patient of age 40s after having been diagnosed with drug withdrawal syndrome - alcohol, until 2102?
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 = 'drug withdrawal...
eicu
CREATE TABLE table_203_569 ( id number, "designation" text, "classification" text, "constellation" text, "apparent magnitude" number )
what is the last constellation featured on this table ?
SELECT "constellation" FROM table_203_569 ORDER BY id DESC LIMIT 1
squall
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( ...
count the number of patients whose marital status is married and diagnoses icd9 code is v3000?
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 = "V3000"
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
provide the number of patients whose admission type is emergency and procedure short title is ins nondrug elut cor st?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND procedures.short_title = "Ins nondrug elut cor st"
mimicsql_data
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
give me the number of patients whose death status is 1 and admission year is less than 2123?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "1" AND demographic.admityear < "2123"
mimicsql_data
CREATE TABLE table_name_12 ( region__year_ VARCHAR, no_5 VARCHAR, no_7 VARCHAR, no_1 VARCHAR )
Which region (year) has Abigail at number 7, Sophia at number 1 and Aaliyah at number 5?
SELECT region__year_ FROM table_name_12 WHERE no_7 = "abigail" AND no_1 = "sophia" AND no_5 = "aaliyah"
sql_create_context
CREATE TABLE Guests ( guest_id INTEGER, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_last_name VARCHAR(80), date_of_birth DATETIME ) CREATE TABLE View_Unit_Status ( apt_id INTEGER, apt_booking_id INTEGER, status_date DATETIME, available_yn BIT ) CREATE TABLE Apartment_F...
A bar chart for what are the number of the facility codes of the apartments with more than four bedrooms?, I want to list by the bars from low to high.
SELECT facility_code, COUNT(facility_code) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4 GROUP BY facility_code ORDER BY facility_code
nvbench
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, ...
when was patient 53015 prescribed nystatin ointment first until 08/2103?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 53015) AND prescriptions.drug = 'nystatin ointment' AND STRFTIME('%y-%m', prescriptions.startdate) <= '2103-08' ORDER BY prescriptions.startdate LIMIT 1
mimic_iii
CREATE TABLE table_1114 ( "Rank" real, "Country" text, "International tourist arrivals (2012)" text, "International tourist arrivals (2011)" text, "Change (2011 to 2012)" text, "Change (2010 to 2011)" text )
Name the number of ranks for south korea
SELECT COUNT("Rank") FROM table_1114 WHERE "Country" = 'South Korea'
wikisql
CREATE TABLE table_45128 ( "Player" text, "Wkts" real, "Runs" real, "Econ" real, "Ovrs" real )
What is the highest wkts for james hopes who had less than 26 runs and more than 2 ovrs?
SELECT MAX("Wkts") FROM table_45128 WHERE "Runs" < '26' AND "Player" = 'james hopes' AND "Ovrs" > '2'
wikisql
CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId numb...
Comments from users with display names that look like unregistered.
SELECT c.PostId AS "post_link", u.DisplayName, c.Text FROM Comments AS c JOIN Users AS u ON c.UserId = u.Id JOIN Posts AS p ON c.PostId = p.Id LEFT OUTER JOIN Posts AS q ON p.ParentId = q.Id WHERE u.DisplayName LIKE 'user3%' AND ((p.PostTypeId = 1 AND p.OwnerUserId != c.UserId) OR (p.PostTypeId = 2 AND p.OwnerUserId !=...
sede
CREATE TABLE table_name_30 ( class VARCHAR, year VARCHAR, points VARCHAR )
What is the Class for a year later than 1958, with 4 points?
SELECT class FROM table_name_30 WHERE year > 1958 AND points = 4
sql_create_context
CREATE TABLE table_name_99 ( final_episode INTEGER, character VARCHAR )
What is the average number for a final episode featuring maxine valera?
SELECT AVG(final_episode) AS Count FROM table_name_99 WHERE character = "maxine valera"
sql_create_context
CREATE TABLE table_name_28 ( club_province VARCHAR, caps VARCHAR, position VARCHAR )
What club/province for the player with over 18 caps and plays the fly-half?
SELECT club_province FROM table_name_28 WHERE caps > 18 AND position = "fly-half"
sql_create_context
CREATE TABLE table_2339 ( "School" text, "Main location" text, "Control" text, "Type" text, "Enrollment (2005)" real, "Founded" real )
Name the control for albany
SELECT "Control" FROM table_2339 WHERE "Main location" = 'Albany'
wikisql
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...
在2002.11.25到2021.2.18这段时间,小儿眼底病科有多少蜜炼川贝枇杷膏被开出
SELECT COUNT(*) FROM t_kc22 WHERE MED_ORG_DEPT_NM = '小儿眼底病科' AND STA_DATE BETWEEN '2002-11-25' AND '2021-02-18' AND SOC_SRT_DIRE_NM = '蜜炼川贝枇杷膏'
css
CREATE TABLE table_name_97 ( bronze INTEGER, nation VARCHAR, gold VARCHAR, rank VARCHAR )
Which Bronze has a Gold smaller than 16, a Rank of 10, and a Nation of italy?
SELECT AVG(bronze) FROM table_name_97 WHERE gold < 16 AND rank = "10" AND nation = "italy"
sql_create_context
CREATE TABLE table_204_996 ( id number, "no." text, "air date" text, "network" text, "household\nrating" number, "viewers\n(millions)" text )
how many times has nbc hosted the awards ?
SELECT COUNT(*) FROM table_204_996 WHERE "network" = 'nbc'
squall
CREATE TABLE table_203_644 ( id number, "pos." number, "driver" text, "co-driver" text, "car" text, "time" text, "difference" text, "points" number )
how many points earned by bob neyret ?
SELECT "points" FROM table_203_644 WHERE "driver" = 'bob neyret'
squall
CREATE TABLE table_42210 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponent in Final" text, "Score in Final" text )
Who was the partner of the winner?
SELECT "Partner" FROM table_42210 WHERE "Outcome" = 'winner'
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...
从03.2.18开始,截止到06.1.17,在患者64384565开出的所有药品里,自费金额高于1245.87元的总共有多少
SELECT COUNT(*) FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_ID = '64384565' AND t_kc22.STA_DATE BETWEEN '2003-02-18' AND '2006-01-17' AND t_kc22.SELF_PAY_AMO > 1245.87 UNION SELECT COUNT(*) FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gyb.PERSON_ID = '6438...
css
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
provide the number of patients whose diagnoses long title is hydronephrosis and drug route is sc?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Hydronephrosis" AND prescriptions.route = "SC"
mimicsql_data
CREATE TABLE table_13746866_2 ( percentage_of_votes VARCHAR, number_of_deputies VARCHAR )
what's the percentage of votes with number of deputies being 112
SELECT percentage_of_votes FROM table_13746866_2 WHERE number_of_deputies = 112
sql_create_context
CREATE TABLE table_56717 ( "Athlete" text, "Event" text, "Round of 16" text, "Quarterfinal" text, "Semifinal" text, "Final" text )
What event had zhamash l 1 2 in the quarterfinal?
SELECT "Event" FROM table_56717 WHERE "Quarterfinal" = 'zhamash l 1–2'
wikisql
CREATE TABLE table_70827 ( "Match" real, "Date" text, "Competition or tour" text, "Ground" text, "Opponent" text, "Score1" text )
On what ground was the game on 31 Jul 2007?
SELECT "Ground" FROM table_70827 WHERE "Date" = '31 jul 2007'
wikisql
CREATE TABLE table_name_65 ( to_par VARCHAR, player VARCHAR )
What is To Par, when Player is Greg Norman?
SELECT to_par FROM table_name_65 WHERE player = "greg norman"
sql_create_context
CREATE TABLE Parties_in_Events ( Party_ID INTEGER, Event_ID INTEGER, Role_Code CHAR(15) ) CREATE TABLE Parties ( Party_ID INTEGER, Party_Details VARCHAR(255) ) CREATE TABLE Finances ( Finance_ID INTEGER, Other_Details VARCHAR(255) ) CREATE TABLE Locations ( Location_ID INTEGER, Ot...
Show the names of products and the number of events they are in. Visualize by bar chart.
SELECT Product_Name, COUNT(*) FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name
nvbench
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
when was the first time patient 021-75161 had been prescribed medication through the oral route until 09/2105?
SELECT 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 = '021-75161')) AND medication.routeadmin = 'oral' AND STRFTIME('...
eicu
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, ...
what were the four medicines most frequently prescribed last year?
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 4
mimic_iii
CREATE TABLE table_name_97 ( opponent VARCHAR, game_site VARCHAR )
What was the Opponent at Arrowhead Stadium?
SELECT opponent FROM table_name_97 WHERE game_site = "arrowhead stadium"
sql_create_context
CREATE TABLE table_1342013_42 ( district VARCHAR, incumbent VARCHAR )
Omar Burleson was the incumbent in what district?
SELECT district FROM table_1342013_42 WHERE incumbent = "Omar Burleson"
sql_create_context
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime...
what is the number of patients that sodium chloride 0.9%solp (1000 ml) is prescribed to?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'sodium chloride 0.9%solp (1000 ml)')
eicu
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID...
Show me manager_id by last name in a histogram, show in asc by the y axis.
SELECT LAST_NAME, MANAGER_ID FROM employees ORDER BY MANAGER_ID
nvbench
CREATE TABLE table_74232 ( "Year Location" text, "Mens Singles" text, "Womens Singles" text, "Mens Doubles" text, "Womens Doubles" text )
How many times has Ma Long won the men's singles?
SELECT COUNT("Mens Doubles") FROM table_74232 WHERE "Mens Singles" = 'Ma Long'
wikisql
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 )
Select the names of all the products in the store, and count them by a bar chart, show in descending by the y-axis.
SELECT Name, COUNT(Name) FROM Products GROUP BY Name ORDER BY COUNT(Name) DESC
nvbench
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TAB...
what medicine has been prescribed to patient 021-79544 for the first time?
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-79544')) ORDER BY medication.drugstarttime LIMIT 1
eicu
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) 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, C...
看看患有牙折断的病人,都是开的哪些编号和名称的药品来治疗的
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM 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.IN_DIAG_DIS_NM = '牙折断'
css
CREATE TABLE table_49090 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the sum of Total, when Silver is greater than 1, when Nation is Germany (GER), and when Gold is less than 1?
SELECT SUM("Total") FROM table_49090 WHERE "Silver" > '1' AND "Nation" = 'germany (ger)' AND "Gold" < '1'
wikisql
CREATE TABLE table_name_61 ( home VARCHAR, visitor VARCHAR, score VARCHAR )
which Home has a Visitor of ottawa senators and a Score of 2 3?
SELECT home FROM table_name_61 WHERE visitor = "ottawa senators" AND score = "2–3"
sql_create_context
CREATE TABLE Detention ( detention_id INTEGER, detention_type_code VARCHAR(10), teacher_id INTEGER, datetime_detention_start DATETIME, datetime_detention_end DATETIME, detention_summary VARCHAR(255), other_details VARCHAR(255) ) CREATE TABLE Teachers ( teacher_id INTEGER, address_id...
Find date_address_to and the sum of monthly_rental , and group by attribute other_details and bin date_address_to by time, and visualize them by a bar chart.
SELECT date_address_to, SUM(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
nvbench
CREATE TABLE table_6407 ( "Feature" text, "GT Force" text, "Driving Force EX" text, "Driving Force Pro" text, "Driving Force GT" text, "G25 Racing Wheel" text, "G27 Racing Wheel" text )
Driving Force EX of 25cm (10-inch) involves what feature?
SELECT "Feature" FROM table_6407 WHERE "Driving Force EX" = '25cm (10-inch)'
wikisql
CREATE TABLE table_name_56 ( country VARCHAR, notes VARCHAR, athlete VARCHAR )
Which country is the athlete latt shwe zin with notes of sc/d from?
SELECT country FROM table_name_56 WHERE notes = "sc/d" AND athlete = "latt shwe zin"
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...
在医疗就诊50417387220中,患者86772484出的各药品的名称及其每次用量和使用频次都是什么?
SELECT t_kc22.SOC_SRT_DIRE_NM, t_kc22.EACH_DOSAGE, t_kc22.USE_FRE FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '50417387220'
css
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 ...
60676464号病人的检验报告单对应的检验结果指标均异常的检验报告单号有哪些
SELECT jyjgzbb.BGDH FROM hz_info JOIN mzjzjlb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jyjgzbb.jybgb_YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jyjgzbb.jybgb_JZLSH_MZJZJLB WHERE hz_info.RYBH = '60676464' AND NOT jyjgzbb.BGDH IN (SELECT jyjgzb...
css
CREATE TABLE region ( Region_ID int, Region_name text, Date text, Label text, Format text, Catalogue text ) CREATE TABLE member ( Member_ID int, Member_Name text, Party_ID text, In_office text ) CREATE TABLE party_events ( Event_ID int, Event_Name text, Party_ID int...
Compute the total how many minister across minister as a pie chart.
SELECT Minister, COUNT(Minister) FROM party GROUP BY Minister
nvbench
CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE STUDENT ...
Give me a pie to show the total number from different dept code.
SELECT DEPT_CODE, COUNT(*) FROM STUDENT GROUP BY DEPT_CODE
nvbench
CREATE TABLE table_71542 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text )
What was the loss of the game that had a score of 9-7?
SELECT "Loss" FROM table_71542 WHERE "Score" = '9-7'
wikisql
CREATE TABLE on_call ( nurse number, blockfloor number, blockcode number, oncallstart time, oncallend time ) CREATE TABLE nurse ( employeeid number, name text, position text, registered boolean, ssn number ) CREATE TABLE department ( departmentid number, name text, ...
Which physicians prescribe a medication of brand X? Tell me the name and position of those physicians.
SELECT DISTINCT T1.name, T1.position FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.brand = "X"
spider
CREATE TABLE table_15327489_1 ( wins INTEGER )
Name the most wins
SELECT MIN(wins) FROM table_15327489_1
sql_create_context
CREATE TABLE table_name_33 ( to_par INTEGER, player VARCHAR )
What score to highest to par did Mike Weir achieve?
SELECT MAX(to_par) FROM table_name_33 WHERE player = "mike weir"
sql_create_context
CREATE TABLE table_name_6 ( matches_as_champion INTEGER, title_last_held VARCHAR, rank VARCHAR )
Which Matches is on 24 march 1963 with a Rank larger than 44?
SELECT MAX(matches_as_champion) FROM table_name_6 WHERE title_last_held = "24 march 1963" AND rank > 44
sql_create_context
CREATE TABLE table_20982 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Falcons points" real, "Opponents" real, "Record" text, "Attendance" real )
In games where the opponent was the San Francisco 49ers what was the minimum amount of points scored?
SELECT MIN("Falcons points") FROM table_20982 WHERE "Opponent" = 'San Francisco 49ers'
wikisql
CREATE TABLE table_32975 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the number of people in the crowd when the away team scored 10.14 (74)?
SELECT COUNT("Crowd") FROM table_32975 WHERE "Away team score" = '10.14 (74)'
wikisql
CREATE TABLE table_59284 ( "Year" real, "Award" text, "Category" text, "Film" text, "Result" text )
What is Award, when Category is 'Best Actor', and when Year is less than 1988?
SELECT "Award" FROM table_59284 WHERE "Category" = 'best actor' AND "Year" < '1988'
wikisql
CREATE TABLE table_62037 ( "Year" real, "Result" text, "Matches" real, "Wins" real, "Draws" real, "Losses" real )
What is the number of Year with a Result of champions, and Matches larger than 5?
SELECT COUNT("Year") FROM table_62037 WHERE "Result" = 'champions' AND "Matches" > '5'
wikisql
CREATE TABLE table_1850339_2 ( air_force___navy_score VARCHAR, season VARCHAR )
What's the Air Force - Navy score in the 2018 season?
SELECT air_force___navy_score FROM table_1850339_2 WHERE season = 2018
sql_create_context
CREATE TABLE table_46032 ( "Rank" real, "Name" text, "Height ft / m" text, "Floors" real, "Year" real )
What is the highest rank of a building erected in 1976 with fewer than 21 floors?
SELECT MAX("Rank") FROM table_46032 WHERE "Year" = '1976' AND "Floors" < '21'
wikisql
CREATE TABLE PlaylistTrack ( PlaylistId integer, TrackId integer ) CREATE TABLE Customer ( CustomerId integer, FirstName varchar(40), LastName varchar(20), Company varchar(80), Address varchar(70), City varchar(40), State varchar(40), Country varchar(40), PostalCode varchar(...
Plot the number of phone by grouped by phone as a bar graph
SELECT Phone, COUNT(Phone) FROM Employee GROUP BY Phone
nvbench
CREATE TABLE table_name_53 ( year INTEGER, performing_arts VARCHAR )
Name the average year for janaprakal chandruang
SELECT AVG(year) FROM table_name_53 WHERE performing_arts = "janaprakal chandruang"
sql_create_context
CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) CREATE TABLE Movie ( mID int, title text, year int, director text ) CREATE TABLE Reviewer ( rID int, name text )
Compare the lowest rating among all movies by each director using a bar chart, list by the director from low to high.
SELECT director, MIN(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY director ORDER BY director
nvbench
CREATE TABLE table_204_400 ( id number, "district" number, "senator" text, "party" text, "caucus" text, "first elected" number, "counties represented" text )
who was the last sentor from erie ?
SELECT "senator" FROM table_204_400 WHERE "counties represented" = 'erie' ORDER BY id DESC LIMIT 1
squall
CREATE TABLE table_75647 ( "Game" real, "January" real, "Opponent" text, "Score" text, "Record" text, "Points" real )
Which January has a Score of 7 4, and a Game smaller than 42?
SELECT SUM("January") FROM table_75647 WHERE "Score" = '7–4' AND "Game" < '42'
wikisql
CREATE TABLE table_name_89 ( home_team VARCHAR, away_team VARCHAR )
Who played as the home team when Vit ria was the away team?
SELECT home_team FROM table_name_89 WHERE away_team = "vitória"
sql_create_context
CREATE TABLE field ( fieldid int ) CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int...
how many papers are published in emnlp ?
SELECT DISTINCT COUNT(paper.paperid) FROM paper, venue WHERE venue.venueid = paper.venueid AND venue.venuename = 'emnlp'
scholar
CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE...
Show me about the distribution of meter_200 and the average of meter_100 , and group by attribute meter_200 in a bar chart, display Y in descending order please.
SELECT meter_200, AVG(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY AVG(meter_100) DESC
nvbench
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, ...
Average score of accepted posts (no restrictions).
WITH QuestionsWITHAccepted AS (SELECT Id, Score, AcceptedAnswerId FROM Posts WHERE PostTypeId = 1 AND AcceptedAnswerId != '') SELECT COUNT(Id) AS numAccepted, AVG(CAST(Score AS FLOAT)) AS averageScore, SUM(CAST(Score AS FLOAT)) AS totalScore FROM Posts WHERE Id IN (SELECT AcceptedAnswerId FROM QuestionsWITHAccepted) AN...
sede
CREATE TABLE table_27348 ( "Pick #" real, "CFL Team" text, "Player" text, "Position" text, "College" text )
What draft pick number was the player with the position DL?
SELECT "Pick #" FROM table_27348 WHERE "Position" = 'DL'
wikisql
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...
tell me the number of patients admitted before 2115 who were discharged to skilled nursing facility.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "REHAB/DISTINCT PART HOSP" AND demographic.admityear < "2115"
mimicsql_data