context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE ReviewTaskSt...
Find questions with close votes.
SELECT p.Id AS "post_link", COUNT(*) AS "occurrences" FROM Posts AS p INNER JOIN Votes AS v ON p.Id = v.PostId WHERE p.PostTypeId = 1 AND p.ClosedDate IS NULL AND v.VoteTypeId = 6 GROUP BY p.Id HAVING COUNT(*) >= 2 ORDER BY occurrences DESC
sede
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, U...
Who says they are 'new to' a technology?.
SELECT Id, Tags, Body FROM Posts WHERE PostTypeId = 1 AND Body LIKE '%new to%'
sede
CREATE TABLE table_26125 ( "Represent" text, "Contestant" text, "Age" real, "Height (ft.)" text, "Height (mtr.)" text, "Hometown" text )
What country had a contestant that was 1.70 meters tall?
SELECT "Represent" FROM table_26125 WHERE "Height (mtr.)" = '1.70'
wikisql
CREATE TABLE table_name_31 ( secr_numbers VARCHAR, year_made VARCHAR )
What was the SECR number of the item made in 1861?
SELECT secr_numbers FROM table_name_31 WHERE year_made = "1861"
sql_create_context
CREATE TABLE table_name_69 ( score INTEGER, player VARCHAR )
How high did Arnold Palmer score in 1962?
SELECT MAX(score) FROM table_name_69 WHERE player = "arnold palmer"
sql_create_context
CREATE TABLE table_78791 ( "Release" text, "Chart" text, "Peak Position" real, "Sales Total" real, "Chart Run" text )
Which Chart has a Peak Position of 1?
SELECT "Chart" FROM table_78791 WHERE "Peak Position" = '1'
wikisql
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, ...
Look for time of discharge and procedure icd9 code for the patient with patient id 91588.
SELECT demographic.dischtime, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "91588"
mimicsql_data
CREATE TABLE table_75133 ( "Rank" text, "Runs" text, "Opponent" text, "Venue" text, "Season" text )
Which Runs has a Rank of =5 and an Opponent of south australia?
SELECT "Runs" FROM table_75133 WHERE "Rank" = '=5' AND "Opponent" = 'south australia'
wikisql
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, va...
is the temperature c (calc) of patient 22120 on the first intensive care unit visit normal?
SELECT COUNT(*) > 0 FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 22120) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.itemid IN (SELECT d_...
mimic_iii
CREATE TABLE table_name_14 ( result VARCHAR, week VARCHAR, date VARCHAR )
What was the result of the game after Week 13 on December 8, 1991?
SELECT result FROM table_name_14 WHERE week > 13 AND date = "december 8, 1991"
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, ...
provide the number of patients whose admission type is emergency and days of hospital stay is greater than 23?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.days_stay > "23"
mimicsql_data
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 ) ...
which type of drug is prescribed to patient with patient id 2560?
SELECT prescriptions.drug_type FROM prescriptions WHERE prescriptions.subject_id = "2560"
mimicsql_data
CREATE TABLE table_951 ( "No." text, "Name" text, "Livery" text, "Arrival" real, "Type" text, "Configuration" text, "Builder" text, "Built" real, "Status" text, "Location" text )
Whats the status of the trains at location Museum
SELECT "Status" FROM table_951 WHERE "Location" = 'Museum'
wikisql
CREATE TABLE table_name_94 ( royal_house VARCHAR, name VARCHAR )
What royal house did Shaokang belong to?
SELECT royal_house FROM table_name_94 WHERE name = "shaokang"
sql_create_context
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...
Draw a bar chart of sex versus mean height, and rank mean height in ascending order.
SELECT Sex, AVG(Height) FROM people GROUP BY Sex ORDER BY AVG(Height)
nvbench
CREATE TABLE table_80049 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real )
How many years had more than 0 points?
SELECT SUM("Year") FROM table_80049 WHERE "Points" > '0'
wikisql
CREATE TABLE table_58563 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
When did the home team score 9.13 (67)?
SELECT "Date" FROM table_58563 WHERE "Home team score" = '9.13 (67)'
wikisql
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, a bar chart shows the distribution of name and the average of price , and group by attribute name, and show by the bar from low to high please.
SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Name
nvbench
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid num...
what is the three year survival probability for patients who were prescribed potassium chloride crys er 20 meq po tbcr after having been diagnosed with valvular stenosis?
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t4.diagnosistime) > 3 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.uniquepid, t2.diagnosistime FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid...
eicu
CREATE TABLE table_name_43 ( player VARCHAR, team VARCHAR )
What player is from the Denver Broncos?
SELECT player FROM table_name_43 WHERE team = "denver broncos"
sql_create_context
CREATE TABLE table_74885 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
Name the date for score of 1-5
SELECT "Date" FROM table_74885 WHERE "Score" = '1-5'
wikisql
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and the sum of price , and group by attribute name, could you sort in ascending by the y axis?
SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Price
nvbench
CREATE TABLE table_train_26 ( "id" int, "gender" string, "pregnancy_or_lactation" bool, "allergy_to_penicillin" bool, "active_infection" bool, "allergy_to_cephalosporin" bool, "receiving_anticoagulants" bool, "age" float, "NOUSE" float )
receiving oral or subcutaneous anticoagulants
SELECT * FROM table_train_26 WHERE receiving_anticoagulants = 1
criteria2sql
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 microlab ( microl...
what was patient 004-11043's last intake time of per iv flush: forearm r 20 gauge?
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-11043')) AND intakeoutput.cellpath LIKE '%intake%...
eicu
CREATE TABLE genre ( g_name varchar2(20), rating varchar2(10), most_popular_in varchar2(50) ) CREATE TABLE files ( f_id number(10), artist_name varchar2(50), file_size varchar2(20), duration varchar2(20), formats varchar2(20) ) CREATE TABLE song ( song_name varchar2(50), artist...
What is the average song rating for each language Plot them as bar chart, order by the mean rating in ascending please.
SELECT languages, AVG(rating) FROM song GROUP BY languages ORDER BY AVG(rating)
nvbench
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 real, Freight_Metric_Tonnes real ) CREATE TABLE airport_aircraft ( ID int, ...
Please list the number of each winning aircraft in a bar chart, and rank in asc by the y-axis.
SELECT Aircraft, COUNT(Aircraft) FROM aircraft AS T1 JOIN match AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY Aircraft ORDER BY COUNT(Aircraft)
nvbench
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 minimum creatinine value for patient 87232 in this hospital visit.
SELECT MIN(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 87232 AND admissions.dischtime IS NULL) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'creatinine')
mimic_iii
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 average age of patients whose marital status is single and ethnicity is american indian/alaska native?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE"
mimicsql_data
CREATE TABLE table_name_60 ( points INTEGER, entrant VARCHAR, chassis VARCHAR )
What was marlboro brm's lowest points by using brm p160b?
SELECT MIN(points) FROM table_name_60 WHERE entrant = "marlboro brm" AND chassis = "brm p160b"
sql_create_context
CREATE TABLE table_name_74 ( net_power VARCHAR, type VARCHAR, finish_construction VARCHAR )
What was the net power, when the type was wwer-440/230, and when construction was finished on 24.10.1977?
SELECT net_power FROM table_name_74 WHERE type = "wwer-440/230" AND finish_construction = "24.10.1977"
sql_create_context
CREATE TABLE table_26177 ( "Neighbourhood" text, "% 0-19" text, "% 20-39" text, "% 40-59" text, "% 60-74" text, "% 75 +" text )
What is every value for % 40-59 if % 60-74 is 12,42%?
SELECT "% 40-59" FROM table_26177 WHERE "% 60-74" = '12,42%'
wikisql
CREATE TABLE table_name_14 ( attendance INTEGER, date VARCHAR )
What is the average attendance that has april 12 as the date?
SELECT AVG(attendance) FROM table_name_14 WHERE date = "april 12"
sql_create_context
CREATE TABLE table_18638 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
How many incumbents were first elected in 1930?
SELECT COUNT("Party") FROM table_18638 WHERE "First elected" = '1930'
wikisql
CREATE TABLE table_name_30 ( function__figure_ VARCHAR, real_name VARCHAR )
What role did Jean-Luc Bouvier serve?
SELECT function__figure_ FROM table_name_30 WHERE real_name = "jean-luc bouvier"
sql_create_context
CREATE TABLE table_name_73 ( year VARCHAR, league VARCHAR, malaysia_cup VARCHAR )
What year was the League the malaysian super league, and a Malaysia Cup of group stage?
SELECT year FROM table_name_73 WHERE league = "malaysian super league" AND malaysia_cup = "group stage"
sql_create_context
CREATE TABLE table_204_397 ( id number, "rank" text, "team" text, "athletes" text, "run 1" text, "run 2" text, "run 3" text, "run 4" text, "final" text )
what team came out on top ?
SELECT "team" FROM table_204_397 WHERE id = 1
squall
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...
列出患者蒋天干在00年8月12日到15年1月13日内被开出的所有药品的清单,清单内容包括药物的编码、名称、数量、单价和金额
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_kc22.QTY, t_kc22.UNIVALENT, t_kc22.AMOUNT FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '蒋天干' AND t_kc22.t_kc21_IN_HOSP_DATE BETWEEN '2000-08-12' AND '2015-01-13'
css
CREATE TABLE table_14494 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the total rank with a Nation of gotland, and a Gold larger than 23?
SELECT COUNT("Rank") FROM table_14494 WHERE "Nation" = 'gotland' AND "Gold" > '23'
wikisql
CREATE TABLE table_name_51 ( writer_s_ VARCHAR, episode VARCHAR )
Who wrote Episode 2-15 (56)?
SELECT writer_s_ FROM table_name_51 WHERE episode = "2-15 (56)"
sql_create_context
CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, m...
list nonstop flights from BALTIMORE to NEWARK on wednesday before 1200
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_tim...
atis
CREATE TABLE table_name_55 ( points INTEGER, position VARCHAR, played VARCHAR )
what is the average points when position is more than 5 and played is less than 10?
SELECT AVG(points) FROM table_name_55 WHERE position > 5 AND played < 10
sql_create_context
CREATE TABLE table_28626 ( "Rank" real, "Couple" text, "Judges" real, "Public" real, "Total" real, "Vote percentage" text, "Result" text )
What couple had a total of 8?
SELECT "Couple" FROM table_28626 WHERE "Total" = '8'
wikisql
CREATE TABLE files ( f_id number(10), artist_name varchar2(50), file_size varchar2(20), duration varchar2(20), formats varchar2(20) ) CREATE TABLE song ( song_name varchar2(50), artist_name varchar2(50), country varchar2(20), f_id number(10), genre_is varchar2(20), rating nu...
Show me a bar chart for what is the average song rating for each language?, and list from low to high by the y axis.
SELECT languages, AVG(rating) FROM song GROUP BY languages ORDER BY AVG(rating)
nvbench
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_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 ...
02年4月26日开始截止到08年6月23日医疗机构1165324就诊记录里保险类型是儿童的记录总量
SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '1165324' AND t_kc21.IN_HOSP_DATE BETWEEN '2002-04-26' AND '2008-06-23' AND t_kc21.INSU_TYPE = '儿童'
css
CREATE TABLE table_name_15 ( scores_by_each_individual_judge VARCHAR, status VARCHAR, date_performed VARCHAR )
What Scores by each individual judge has a Status of eliminated, and a Date performed of august 13?
SELECT scores_by_each_individual_judge FROM table_name_15 WHERE status = "eliminated" AND date_performed = "august 13"
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
provide the number of patients whose diagnoses short title is chrnc hpt c wo hpat coma and drug type is main?
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.short_title = "Chrnc hpt C wo hpat coma" AND prescriptions.drug_type = "MAIN"
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 Customers ( Customer_ID INTEGER, Customer_Details VARCHAR(255) ) CREATE TABLE Customer_Policies ( Policy_ID INTEGE...
How many settlements does each claim correspond to? List the claim id and the number of settlements with a scatter chart.
SELECT T1.Claim_ID, COUNT(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_ID = T2.Claim_ID GROUP BY T1.Claim_ID
nvbench
CREATE TABLE table_52857 ( "Station Number" text, "District" text, "Location" text, "Type" text, "Appliances" text, "Registrations" text )
What is the location of the station at Huntingdonshire with a station number of c17?
SELECT "Location" FROM table_52857 WHERE "District" = 'huntingdonshire' AND "Station Number" = 'c17'
wikisql
CREATE TABLE player ( POSITION VARCHAR, name VARCHAR, Points INTEGER )
List the position of players with average number of points scored by players of that position bigger than 20.
SELECT POSITION FROM player GROUP BY name HAVING AVG(Points) >= 20
sql_create_context
CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, basePrice INTEGER, decor TEXT ) CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adul...
What is the average base price of rooms, for each bed type Plot them as bar chart, and order by the bedType in desc.
SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType ORDER BY bedType DESC
nvbench
CREATE TABLE table_68650 ( "Tournament" text, "2003" text, "2007" text, "2008" text, "2009" text, "2011" text )
What is the 2003 value with 2r in 2008 and 1r in 2011?
SELECT "2003" FROM table_68650 WHERE "2008" = '2r' AND "2011" = '1r'
wikisql
CREATE TABLE table_73830 ( "Settlement" text, "Cyrillic Name Other Names" text, "Type" text, "Population (2011)" text, "Largest ethnic group (2002)" text, "Dominant religion (2002)" text )
The population is 2,107's dominant religion is?
SELECT "Dominant religion (2002)" FROM table_73830 WHERE "Population (2011)" = '2,107'
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 ) ...
what is primary disease and procedure long title of subject name chandra schulman?
SELECT demographic.diagnosis, procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Chandra Schulman"
mimicsql_data
CREATE TABLE table_17256 ( "Station Number" text, "District" text, "Location" text, "Type" text, "Appliances" text, "Registrations" text )
what are all the registrations where location is yaxley
SELECT "Registrations" FROM table_17256 WHERE "Location" = 'Yaxley'
wikisql
CREATE TABLE table_66217 ( "Round" text, "Date" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real )
What round has 2-1 as the result, and A as the venue?
SELECT "Round" FROM table_66217 WHERE "Result" = '2-1' AND "Venue" = 'a'
wikisql
CREATE TABLE table_name_41 ( method VARCHAR, event VARCHAR )
What method of resolution was the fight that took place at hardcore championship fighting: destiny?
SELECT method FROM table_name_41 WHERE event = "hardcore championship fighting: destiny"
sql_create_context
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time...
Finding posts upvoted by user.
WITH CandidatePosts AS (SELECT ParentId AS postId FROM Posts AS p WHERE p.OwnerUserId = '##UserId##' AND p.PostTypeId = 2) SELECT p1.Id AS "post_link", p1.OwnerUserId AS "user_link", Body FROM Posts AS p1 JOIN CandidatePosts AS cp ON cp.postId = p1.ParentId WHERE p1.OwnerUserId != '##UserId##' AND p1.Score = 2 ORDER BY...
sede
CREATE TABLE table_18590048_1 ( rank VARCHAR, release_date VARCHAR )
How many titles were released on 21 October 1992?
SELECT COUNT(rank) FROM table_18590048_1 WHERE release_date = "21 October 1992"
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 microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_nam...
did patient 9299 receive the lingual thyroid excision procedure since 2103?
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'lingual thyroid excision') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9299) AND STRFTIME('%y...
mimic_iii
CREATE TABLE table_name_7 ( a_league VARCHAR, saves VARCHAR )
What is the A-league with 39 saves?
SELECT a_league FROM table_name_7 WHERE saves = 39
sql_create_context
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_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 all employees who have the letters D or S in their first name, a bar chart shows the distribution of hire_date and the average of manager_id bin hire_date by time, sort from low to high by the the average of manager id.
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(MANAGER_ID)
nvbench
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREAT...
in this year, patient 018-86978 has been admitted into the hospital?
SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '018-86978' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
eicu
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 admission type is emergency and year of birth is less than 2064?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.dob_year < "2064"
mimicsql_data
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE patients ( row_id number, subject_id number, ...
when is the last direct antigen test for herpes simplex virus types 1 & 2 microbiological test on patient 50065 since 107 months ago?
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 50065) AND microbiologyevents.spec_type_desc = 'direct antigen test for herpes simplex virus types 1 & 2' AND DATETIME(microbiologyevents.charttime) >=...
mimic_iii
CREATE TABLE table_1949746_1 ( licensee VARCHAR, city_of_license VARCHAR )
When portsmouth is the city of license who is the licensee?
SELECT licensee FROM table_1949746_1 WHERE city_of_license = "Portsmouth"
sql_create_context
CREATE TABLE table_203_11 ( id number, "title" text, "year" number, "peak chart positions\nus" number, "peak chart positions\nus r&b" number, "peak chart positions\nus rap" number, "peak chart positions\nuk" number, "certifications" text, "album" text )
what year had the least us peak chart positions ?
SELECT "year" FROM table_203_11 ORDER BY "peak chart positions\nus r&b" DESC LIMIT 1
squall
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswer...
Find identical titles (no closed questions, same owner). We also show the creation date of the posts.
SELECT a.Id AS "post_link", a.CreationDate AS "First Date", b.Id AS "post_link", b.CreationDate AS "Second Date" FROM Posts AS a JOIN Posts AS b ON a.Title = b.Title AND a.OwnerUserId = b.OwnerUserId WHERE a.Id < b.Id AND a.ClosedDate IS NULL AND b.ClosedDate IS NULL
sede
CREATE TABLE table_5415 ( "Season" real, "Series" text, "Team" text, "Races" real, "Wins" real, "Poles" real, "Position" text )
What is the lowest Poles with a Season that is larger than 2009?
SELECT MIN("Poles") FROM table_5415 WHERE "Season" > '2009'
wikisql
CREATE TABLE table_59749 ( "Opposing Teams" text, "Against" real, "Date" text, "Venue" text, "Status" text )
What is Opposing Teams, when Against is less than 6?
SELECT "Opposing Teams" FROM table_59749 WHERE "Against" < '6'
wikisql
CREATE TABLE undergoes ( patient number, procedures number, stay number, dateundergoes time, physician number, assistingnurse number ) CREATE TABLE trained_in ( physician number, treatment number, certificationdate time, certificationexpires time ) CREATE TABLE appointment ( ...
Which department has the largest number of employees?
SELECT name FROM department GROUP BY departmentid ORDER BY COUNT(departmentid) DESC LIMIT 1
spider
CREATE TABLE table_23284271_11 ( location_attendance VARCHAR, high_points VARCHAR )
Name the location attendance for dirk nowitzki , caron butler (17)
SELECT location_attendance FROM table_23284271_11 WHERE high_points = "Dirk Nowitzki , Caron Butler (17)"
sql_create_context
CREATE TABLE table_30289 ( "Religion" text, "Births" real, "Conversions" text, "New adherents per year" real, "Growth rate" text )
Name the least births for conversion being 26,333
SELECT MIN("Births") FROM table_30289 WHERE "Conversions" = '26,333'
wikisql
CREATE TABLE table_30870 ( "Pick #" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
Which player is the centre for the Detroit Red Wings?
SELECT "Player" FROM table_30870 WHERE "Position" = 'Centre' AND "NHL team" = 'Detroit Red Wings'
wikisql
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of headquarter and the average of code , and group by attribute headquarter, and could you show from low to high by the bar?
SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T2.Headquarter
nvbench
CREATE TABLE table_21002 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "Record" text, "Attendance" real )
In what week number was the attendance 74716?
SELECT COUNT("Week") FROM table_21002 WHERE "Attendance" = '74716'
wikisql
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
Visualize a bar chart about the distribution of All_Home and the average of School_ID , and group by attribute All_Home, and could you sort in descending by the x-axis?
SELECT All_Home, AVG(School_ID) FROM basketball_match GROUP BY All_Home ORDER BY All_Home DESC
nvbench
CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varcha...
which flights depart LOS ANGELES destination CHARLOTTE that leave on a monday morning
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CHARLOTTE' AND date_day.day_number = 21 AND date_day.month_number = 2 AN...
atis
CREATE TABLE table_8252 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What is the score of the game where Wrexham is the home team and the date is Blackpool?
SELECT "Score" FROM table_8252 WHERE "Home team" = 'wrexham' AND "Date" = 'blackpool'
wikisql
CREATE TABLE table_52860 ( "Rank" text, "Name" text, "Height ft (m)" text, "Floors" real, "Year" real )
In what Year was the Rank 14.0 14?
SELECT SUM("Year") FROM table_52860 WHERE "Rank" = '14.0 14'
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...
provide the number of patients whose admission type is newborn and discharge location is snf?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.discharge_location = "SNF"
mimicsql_data
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
how many patients whose year of birth is less than 2087 and lab test fluid is joint fluid?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2087" AND lab.fluid = "Joint Fluid"
mimicsql_data
CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABL...
Answers on closed questions by a specific user.
SELECT q.Id AS "post_link", a.Id AS "post_link", q.Score, a.Score, q.ViewCount, q.Tags FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id WHERE (NOT q.ClosedDate IS NULL) AND (a.OwnerUserId = '##userId##') ORDER BY q.Id DESC
sede
CREATE TABLE table_50330 ( "Year ended" text, "Revenue (\u00a3million)" real, "Profit/(loss) before tax (\u00a3m)" real, "Net profit (\u00a3m)" real, "Earnings per share (p)" real )
What is the year 2007 earnings per share?
SELECT "Earnings per share (p)" FROM table_50330 WHERE "Year ended" = '2007'
wikisql
CREATE TABLE table_name_55 ( rank INTEGER, silver INTEGER )
Name the sum of rank for silver less than 0
SELECT SUM(rank) FROM table_name_55 WHERE silver < 0
sql_create_context
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) 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...
tell me the birth date of patient 23002?
SELECT patients.dob FROM patients WHERE patients.subject_id = 23002
mimic_iii
CREATE TABLE table_14102379_4 ( stadium VARCHAR, record VARCHAR )
what's the stadium with record being 1 1
SELECT stadium FROM table_14102379_4 WHERE record = "1–1"
sql_create_context
CREATE TABLE table_1590652_4 ( no INTEGER, tournament VARCHAR )
Name the most number when tournament is madrid masters
SELECT MAX(no) FROM table_1590652_4 WHERE tournament = "Madrid Masters"
sql_create_context
CREATE TABLE gyb ( CLINIC_ID text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, IN...
自2002-04-25起到2002-05-18医疗机构7767561的就诊记录里未就业人员的就诊记录有多少
SELECT COUNT(*) FROM qtb WHERE qtb.MED_SER_ORG_NO = '7767561' AND qtb.IN_HOSP_DATE BETWEEN '2002-04-25' AND '2002-05-18' AND qtb.INSURED_STS = '未就业' UNION SELECT COUNT(*) FROM gyb WHERE gyb.MED_SER_ORG_NO = '7767561' AND gyb.IN_HOSP_DATE BETWEEN '2002-04-25' AND '2002-05-18' AND gyb.INSURED_STS = '未就业' UNION SELECT COU...
css
CREATE TABLE table_19867 ( "Stage" real, "Stage winner" text, "General classification" text, "Points classification" text, "Mountains classification" text, "Malaysian rider classification" text, "Team classification" text )
When li fuyu is the stage winner who is the general classification?
SELECT "General classification" FROM table_19867 WHERE "Stage winner" = 'Li Fuyu'
wikisql
CREATE TABLE table_name_49 ( bp_azeo__˚c_ VARCHAR )
Tell me the 3rd component for bp azeo of 62.1
SELECT 3 AS rd_component FROM table_name_49 WHERE bp_azeo__˚c_ = "62.1"
sql_create_context
CREATE TABLE table_38941 ( "Team" text, "Constructor" text, "Motorcycle" text, "Rider" text, "Rounds" text )
What is the rounds of rider Mika Kallio 1 of the Ducati Marlboro team?
SELECT "Rounds" FROM table_38941 WHERE "Team" = 'ducati marlboro team' AND "Rider" = 'mika kallio 1'
wikisql
CREATE TABLE table_2545 ( "Season" real, "Series" text, "Team" text, "Races" real, "Wins" real, "Poles" real, "F/Laps" real, "Podiums" real, "Points" text, "Position" text )
How many points when pole are 1?
SELECT "Points" FROM table_2545 WHERE "Poles" = '1'
wikisql
CREATE TABLE artist ( Artist_ID int, Name text, Country text, Year_Join int, Age int ) CREATE TABLE exhibition ( Exhibition_ID int, Year int, Theme text, Artist_ID int, Ticket_Price real ) CREATE TABLE exhibition_record ( Exhibition_ID int, Date text, Attendance int...
Give me a bar chart about the number of countries in the artist table, and could you display by the bars in descending?
SELECT Country, COUNT(Country) FROM artist GROUP BY Country ORDER BY Country DESC
nvbench
CREATE TABLE table_name_46 ( airdate VARCHAR, length VARCHAR )
When did the length of 60 minutes air?
SELECT airdate FROM table_name_46 WHERE length = "60 minutes"
sql_create_context
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other,...
Answer (Up/Down) Votes from a specific Question.
SELECT COUNT(v.PostId) AS "DV count", v.PostId AS "post_link", p.Body FROM Votes AS v INNER JOIN Posts AS p ON p.Id = v.PostId WHERE p.ParentId = @ParentId AND p.PostTypeId = 2 AND v.VoteTypeId = @kind GROUP BY v.PostId, p.Body ORDER BY 'DV count' DESC
sede
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_played number ) CREATE TABLE sportsinfo ( stuid number, sportname text, ...
Show all game names played by at least 1000 hours.
SELECT gname FROM plays_games AS T1 JOIN video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid HAVING SUM(hours_played) >= 1000
spider
CREATE TABLE table_name_8 ( rank VARCHAR, team VARCHAR, points VARCHAR )
What is team Yamaha with 3 points ranked?
SELECT rank FROM table_name_8 WHERE team = "yamaha" AND points = 3
sql_create_context
CREATE TABLE table_204_816 ( id number, "locomotive" text, "named" text, "serial no" text, "entered service" text, "gauge" text, "livery" text )
what is the total number of standard and broad gauges ?
SELECT COUNT(*) FROM table_204_816 WHERE "gauge" IN ('standard', 'broad')
squall
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, value...
has any microbiological tests been conducted on patient 1918's blood culture until 1 year ago?
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1918) AND microbiologyevents.spec_type_desc = 'blood culture' AND DATETIME(microbiologyevents.charttime) <= DATETIME(CURRENT_TIME(), '-1 year')
mimic_iii
CREATE TABLE table_name_85 ( result VARCHAR, opponent VARCHAR )
Which Result has an Opponent of minnesota vikings?
SELECT result FROM table_name_85 WHERE opponent = "minnesota vikings"
sql_create_context