context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE Transactions ( transaction_id INTEGER, investor_id INTEGER, transaction_type_code VARCHAR(10), date_of_transaction DATETIME, amount_of_transaction DECIMAL(19,4), share_count VARCHAR(40), other_details VARCHAR(255) ) CREATE TABLE Investors ( investor_id INTEGER, Investor...
What are the number of the purchase details of transactions with amount bigger than 10000?
SELECT purchase_details, COUNT(purchase_details) FROM Purchases AS T1 JOIN Transactions AS T2 ON T1.purchase_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction > 10000 GROUP BY purchase_details
nvbench
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( la...
count the number of patients who were diagnosed with bipolar disorder in the same month after they were diagnosed with delirium since 3 years ago.
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'bipolar disorder' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-3 year')) AS t1 JOIN (...
eicu
CREATE TABLE table_59487 ( "Opposing Teams" text, "Against" real, "Date" text, "Venue" text, "Status" text )
Which venue was the opposing team New Zealand on 22/11/1997?
SELECT "Venue" FROM table_59487 WHERE "Opposing Teams" = 'new zealand' AND "Date" = '22/11/1997'
wikisql
CREATE TABLE table_name_14 ( result VARCHAR, opponent VARCHAR )
Which result was there when the opponents were the Buffalo Bills?
SELECT result FROM table_name_14 WHERE opponent = "buffalo bills"
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescription...
provide the number of patients admitted before 2145 who had psychiatric facility-partial hospitalization discharge.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND demographic.admityear < "2145"
mimicsql_data
CREATE TABLE table_65105 ( "Nat." text, "Name" text, "Moving from" text, "Type" text, "Transfer window" text, "Ends" real, "Transfer fee" text )
What was the transfer fee when the moving from was celta de Vigo?
SELECT "Transfer fee" FROM table_65105 WHERE "Moving from" = 'celta de vigo'
wikisql
CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational...
Are there any upper level CS classes offered next semester , which are they ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE program_course.catego...
advising
CREATE TABLE customers ( customer_id VARCHAR ) CREATE TABLE customer_events ( customer_id VARCHAR )
How many customers did not have any event?
SELECT COUNT(*) FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM customer_events)
sql_create_context
CREATE TABLE table_29525 ( "Episode air date" text, "Audition city" text, "First audition date" text, "Audition venue" text, "Callback audition date" text, "Callback venue" text, "Golden tickets" text )
In how many different audition cities were the Bridgestone arena auditions held?
SELECT COUNT("Audition city") FROM table_29525 WHERE "Audition venue" = 'Bridgestone Arena'
wikisql
CREATE TABLE table_203_129 ( id number, "finalist" text, "age" number, "from" text, "dress colour" text, "status" text )
what was the number of finalist ?
SELECT COUNT("finalist") FROM table_203_129
squall
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, ...
tell me the name of the medication that patient 58649 was prescribed during the same hospital encounter after having been diagnosed with delusional disorder?
SELECT t2.drug FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 58649 AND diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.s...
mimic_iii
CREATE TABLE table_16751596_13 ( dates_administered VARCHAR, poll_source VARCHAR )
When the poll source is research 2000/daily kos, what is the total number of dates administered?
SELECT COUNT(dates_administered) FROM table_16751596_13 WHERE poll_source = "Research 2000/Daily Kos"
sql_create_context
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
负责检验报告单36272042053报告的机构代码和名称分别叫什么?
SELECT zyjybgb.BGJGDM, zyjybgb.BGJGMC FROM zyjybgb WHERE zyjybgb.BGDH = '36272042053' UNION SELECT mzjybgb.BGJGDM, mzjybgb.BGJGMC FROM mzjybgb WHERE mzjybgb.BGDH = '36272042053'
css
CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INTEGER, Price INTEGER, Score INTEGER, Cases INTEGER, Drink TEXT ) CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE appellations ( No...
A bar chart shows the number of year of the maximum price and score of wines, and bin the year into the weekday interval.
SELECT Year, COUNT(Year) FROM wine
nvbench
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 ) ...
count the number of patients whose admission year is less than 2176 and procedure long title is coronary arteriography using a single catheter?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2176" AND procedures.long_title = "Coronary arteriography using a single catheter"
mimicsql_data
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE employees ( EMPLOYE...
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, show me about the distribution of hire_date and the sum of employee_id bin hire_date by weekday in a bar chart.
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
nvbench
CREATE TABLE table_name_92 ( total_goals INTEGER, position VARCHAR, fa_cup_goals VARCHAR, fa_cup_apps VARCHAR )
Which Total Goals have an FA Cup Goals of 0, and an FA Cup Apps of 3, and a Position of fw?
SELECT AVG(total_goals) FROM table_name_92 WHERE fa_cup_goals = 0 AND fa_cup_apps = "3" AND position = "fw"
sql_create_context
CREATE TABLE table_12610 ( "Constituency number" text, "Name" text, "Reserved for ( SC / ST /None)" text, "District" text, "Number of electorates (2009)" real )
What is the Reserved for (SC / ST /None) when the number of electorates (2009) is more than 237,560, and the constituency number is 48?
SELECT "Reserved for ( SC / ST /None)" FROM table_12610 WHERE "Number of electorates (2009)" > '237,560' AND "Constituency number" = '48'
wikisql
CREATE TABLE table_6116 ( "Name" text, "Birth" text, "Marriage" text, "Became Queen" text, "Ceased to be Queen" text, "Death" text, "Spouse" text )
When was the person who became queen on 15 April 1820 born?
SELECT "Birth" FROM table_6116 WHERE "Became Queen" = '15 april 1820'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text ) 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 te...
从11年4月24日到2015年10月6日这一段时间,患者33303356被开出的所有检验报告单的检验报告单号都有哪些?
SELECT jybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN person_info_hz_info JOIN person_info 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 AND person_info_hz_info.KH = hz_info.KH AND pers...
css
CREATE TABLE table_name_72 ( lost VARCHAR, drawn VARCHAR, points_for VARCHAR )
what is the amount lost when there is 1 draw and 515 points?
SELECT lost FROM table_name_72 WHERE drawn = "1" AND points_for = "515"
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 admission location is phys referral/normal deli and primary disease is posterior communicating aneurysm/sda?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA"
mimicsql_data
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,...
For all employees who have the letters D or S in their first name, a bar chart shows the distribution of job_id and the average of department_id , and group by attribute job_id, and order the average of department id in ascending order.
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(DEPARTMENT_ID)
nvbench
CREATE TABLE Lots ( lot_id INTEGER, investor_id INTEGER, lot_details VARCHAR(255) ) CREATE TABLE Transactions ( transaction_id INTEGER, investor_id INTEGER, transaction_type_code VARCHAR(10), date_of_transaction DATETIME, amount_of_transaction DECIMAL(19,4), share_count VARCHAR(40),...
Show the ids and details of the investors who have at least two transactions with type code 'SALE' by a bar chart, list by the X-axis from low to high.
SELECT T1.Investor_details, T1.investor_id FROM Investors AS T1 JOIN Transactions AS T2 ON T1.investor_id = T2.investor_id WHERE T2.transaction_type_code = "SALE" ORDER BY T1.Investor_details
nvbench
CREATE TABLE table_5253 ( "Name" text, "Nationality" text, "Position" text, "Tenure Began" real, "Term Ending" real )
Name of xue hanqin has what highest term ending?
SELECT MAX("Term Ending") FROM table_5253 WHERE "Name" = 'xue hanqin'
wikisql
CREATE TABLE table_8433 ( "Number" text, "Builder" text, "Type" text, "Date" real, "Length" text, "Capacity" text )
Which Type has a Capacity of 10 tons, and a Number of 24-27?
SELECT "Type" FROM table_8433 WHERE "Capacity" = '10 tons' AND "Number" = '24-27'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, ...
列出在2007年3月19日到2009年3月8日内患者22871857所有检验报告单什么时候审核的?
SELECT jybgb.SHSJ FROM hz_info JOIN zzmzjzjlb JOIN jybgb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '22871857' AND jybgb.BGRQ BETWEEN '2007-03-19' AND '2009-...
css
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, ...
tell me the drug code and route of administration of mult drug.
SELECT prescriptions.formulary_drug_cd, prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Mult"
mimicsql_data
CREATE TABLE table_43591 ( "Outcome" text, "Date" text, "Championship" text, "Surface" text, "Opponent" text, "Score" text )
What is the Date of the game with an Outcome of runner-up and Score of 5 7, 3 6, 6 3, 2 6?
SELECT "Date" FROM table_43591 WHERE "Outcome" = 'runner-up' AND "Score" = '5–7, 3–6, 6–3, 2–6'
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 days of hospital stay is greater than 14 and lab test name is cd4 cells, percent?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "14" AND lab.label = "CD4 Cells, Percent"
mimicsql_data
CREATE TABLE table_2236 ( "No" real, "Season" real, "Ep" real, "Title" text, "Writer" text, "Director" text, "Original airdate" text, "Archive" text )
Name the total number of directors for number 6
SELECT COUNT("Director") FROM table_2236 WHERE "No" = '6'
wikisql
CREATE TABLE table_204_765 ( id number, "year" number, "location" text, "gold" text, "silver" text, "bronze" text )
what was the first year where tamarine tanasugarn won a silver medal in singles ?
SELECT MIN("year") FROM table_204_765 WHERE "silver" = 'tamarine tanasugarn'
squall
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE intakeoutput ( intakeou...
count the number of patients that received antihypertensive drug within the same month after having been diagnosed with dementia until 2 years ago.
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'dementia' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-2 year')) AS t1 JOIN (SELECT p...
eicu
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, ...
did patient 5828's arterial bp [systolic], yesterday, have been 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 = 5828)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [systo...
mimic_iii
CREATE TABLE Teachers ( teacher_id INTEGER, address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(80), last_name VARCHAR(80), gender VARCHAR(1), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), other_details VARCHAR(255) ) CREATE TABLE Ref_Detention_Type ( de...
A bar chart shows the distribution of date_address_to and the average of monthly_rental , and group by attribute other_details and bin date_address_to by time.
SELECT date_address_to, AVG(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
nvbench
CREATE TABLE table_name_60 ( grid VARCHAR, time_retired VARCHAR )
What is the total number of grids where there were races that had a time of 34:22.335?
SELECT COUNT(grid) FROM table_name_60 WHERE time_retired = "34:22.335"
sql_create_context
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 patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d...
how many hours have passed since the last time patient 27172 stayed in ward 15 during the current hospital visit.
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27172 AND admissions.dischtime IS NULL)) AND transfers...
mimic_iii
CREATE TABLE table_10846 ( "Tournament" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text )
Name the 2009 for when 2007 is 3r and 2010 is q2
SELECT "2009" FROM table_10846 WHERE "2007" = '3r' AND "2010" = 'q2'
wikisql
CREATE TABLE table_name_72 ( original_title VARCHAR, director VARCHAR )
What was the original title of the film directed by Lene Gr nlykke and Sven Gr nlykke?
SELECT original_title FROM table_name_72 WHERE director = "lene grønlykke and sven grønlykke"
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( ...
give me the number of patients less than 81 years who were prescribed critic-aid clear af drug.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "81" AND prescriptions.drug = "Critic-Aid Clear AF"
mimicsql_data
CREATE TABLE table_37562 ( "Date" text, "Race Name" text, "Location" text, "UCI Rating" text, "Winner" text, "Team" text )
What is the date of the omloop van de vlaamse scheldeboorden race with a UCI rating of 1.1?
SELECT "Date" FROM table_37562 WHERE "UCI Rating" = '1.1' AND "Race Name" = 'omloop van de vlaamse scheldeboorden'
wikisql
CREATE TABLE table_name_5 ( sno INTEGER, capital VARCHAR )
What is the highest S number with a capital of Shekhsar?
SELECT MAX(sno) FROM table_name_5 WHERE capital = "shekhsar"
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE a...
have patient 006-195316 been to the er during their current hospital visit?
SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '006-195316' AND patient.hospitaladmitsource = 'emergency department' AND patient.hospitaldischargetime IS NULL
eicu
CREATE TABLE table_48720 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Ground" text, "Date" text, "Crowd" real )
What is Away Team, when Ground is Colonial Stadium?
SELECT "Away team" FROM table_48720 WHERE "Ground" = 'colonial stadium'
wikisql
CREATE TABLE table_name_77 ( round INTEGER, overall VARCHAR, pick__number VARCHAR, position VARCHAR )
What is the highest round with a pick# of 9, overll less than 468, and position of defensive back?
SELECT MAX(round) FROM table_name_77 WHERE pick__number = 9 AND position = "defensive back" AND overall < 468
sql_create_context
CREATE TABLE book ( Book_ID int, Title text, Issues real, Writer text ) CREATE TABLE publication ( Publication_ID int, Book_ID int, Publisher text, Publication_Date text, Price real )
A bar chart for what are the number of the dates of publications in descending order of price?
SELECT Publication_Date, COUNT(Publication_Date) FROM publication GROUP BY Publication_Date ORDER BY Price DESC
nvbench
CREATE TABLE table_57601 ( "Index" text, "Organization" text, "Year" text, "Rank" real, "Out of" real )
Tell me the rank for year of 2012 and out of larger than 176
SELECT "Rank" FROM table_57601 WHERE "Year" = '2012' AND "Out of" > '176'
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
Count the number of patients less than 61 years categorized under a blood gas lab test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "61" AND lab."CATEGORY" = "Blood Gas"
mimicsql_data
CREATE TABLE geographic ( city_name varchar, county varchar, region varchar ) CREATE TABLE location ( restaurant_id int, house_number int, street_name varchar, city_name varchar ) CREATE TABLE restaurant ( id int, name varchar, food_type varchar, city_name varchar, rati...
where can we find a restaurant in alameda ?
SELECT location.house_number, restaurant.name FROM location, restaurant WHERE location.city_name = 'alameda' AND restaurant.id = location.restaurant_id
restaurants
CREATE TABLE table_10324 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Attendance" real, "Record" text )
Who was the visiting team on November 26, 2007?
SELECT "Visitor" FROM table_10324 WHERE "Date" = 'november 26, 2007'
wikisql
CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE date_day ...
show flights from DENVER into SAN FRANCISCO
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRA...
atis
CREATE TABLE table_204_912 ( id number, "rank" number, "athlete" text, "country" text, "time" number, "notes" text )
which athlete completed the race in the same time as jan bazen ?
SELECT "athlete" FROM table_204_912 WHERE "athlete" <> 'jan bazen' AND "time" = (SELECT "time" FROM table_204_912 WHERE "athlete" = 'jan bazen')
squall
CREATE TABLE table_201_7 ( id number, "year" number, "gross domestic product" number, "us dollar exchange" text, "inflation index\n(2000=100)" number, "per capita income\n(as % of usa)" number )
how many years have an inflation index above 90 ?
SELECT COUNT("year") FROM table_201_7 WHERE "inflation index\n(2000=100)" > 90
squall
CREATE TABLE table_name_88 ( location VARCHAR, year VARCHAR, city VARCHAR )
What location had a year of 1971 and a city of Tokyo?
SELECT location FROM table_name_88 WHERE year = 1971 AND city = "tokyo"
sql_create_context
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 wdmzjzjlb.ZYZDBM, wdmzjzjlb.ZYZDMC 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.ZYZDBM, bdmzjzjlb.ZYZDMC FROM person_info JOIN...
css
CREATE TABLE table_1341598_36 ( party VARCHAR, district VARCHAR )
what is the party for district ohio 11?
SELECT party FROM table_1341598_36 WHERE district = "Ohio 11"
sql_create_context
CREATE TABLE table_12407546_1 ( athlete__noc_ VARCHAR, swimming VARCHAR )
Who's the player with 2:05.63 (1296 pts) swimming score?
SELECT athlete__noc_ FROM table_12407546_1 WHERE swimming = "2:05.63 (1296 pts)"
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
tell me the time of admission and dosage of drug for patient with patient id 74032.
SELECT demographic.admittime, prescriptions.drug_dose FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "74032"
mimicsql_data
CREATE TABLE table_3880 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What is the date when the high points is michael beasley , martell webster (16)?
SELECT "Date" FROM table_3880 WHERE "High points" = 'Michael Beasley , Martell Webster (16)'
wikisql
CREATE TABLE table_29409 ( "Athlete" text, "Event" text, "Round of 32" text, "Round of 16" text, "Quarterfinals" text, "Semifinals" text )
What was the event when su rez ( tri ) w 16 6 was round of 32?
SELECT "Event" FROM table_29409 WHERE "Round of 32" = 'Suárez ( TRI ) W 16–6'
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 demographic ...
specify the gender of patient id 26285
SELECT demographic.gender FROM demographic WHERE demographic.subject_id = "26285"
mimicsql_data
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE job_history ( EMPLO...
For all employees who have the letters D or S in their first name, show me about the distribution of hire_date and the sum of salary bin hire_date by weekday in a bar chart, and could you list from high to low by the Y-axis?
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY SUM(SALARY) DESC
nvbench
CREATE TABLE table_57203 ( "Type of sign" text, "Shape" text, "Border" text, "Background colour" text, "Text/Symbol" text )
Which color is the background of the mandatory instructions?
SELECT "Background colour" FROM table_57203 WHERE "Type of sign" = 'mandatory instructions'
wikisql
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, econ...
now show me the flights from DENVER to PHILADELPHIA on a SATURDAY
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, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND days.day_name = 'SATURDAY' AND flight.flight_days = days.days_cod...
atis
CREATE TABLE table_30513 ( "Pick" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
Who was drafted by the Washington Capitals?
SELECT "Player" FROM table_30513 WHERE "NHL team" = 'Washington Capitals'
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...
for patient id 2560, specify primary disease and code of drug administered.
SELECT demographic.diagnosis, prescriptions.formulary_drug_cd FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "2560"
mimicsql_data
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
count the number of patients whose ethnicity is black/african american and diagnoses short title is enthesopathy of hip?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND diagnoses.short_title = "Enthesopathy of hip"
mimicsql_data
CREATE TABLE table_8090 ( "Season" text, "President" text, "General Sec" text, "Treasurer" text, "Fixtures Sec" text, "Social Sec Bradford" text, "Social Sec Leeds" text, "Media Officer" text )
Name the Fixtures Sec which has a Season of 2009 2010
SELECT "Fixtures Sec" FROM table_8090 WHERE "Season" = '2009–2010'
wikisql
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
what is the monthly minimum amount of foley cath that patient 006-224208 had until 08/17/2103?
SELECT MIN(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-224208')) AND intakeoutput.celllabel = 'fole...
eicu
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
想知道医疗就诊33468513439的要住多久院
SELECT IN_HOSP_DAYS FROM t_kc21 WHERE MED_CLINIC_ID = '33468513439'
css
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...
get me the number of widow patients who have procedure icd9 code 4523.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "WIDOWED" AND procedures.icd9_code = "4523"
mimicsql_data
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE microlab ( microlabid number, ...
when was the first time patient 027-82559 had a urine output on 09/27/last year.
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 = '027-82559')) AND intakeoutput.cellpath LIKE '%output%...
eicu
CREATE TABLE table_name_71 ( new_entries_this_round VARCHAR, phase VARCHAR, winners_from_previous_round VARCHAR )
How many new entries are there for a second phase that has 4 winners from previous rounds?
SELECT new_entries_this_round FROM table_name_71 WHERE phase = "second phase" AND winners_from_previous_round = "4"
sql_create_context
CREATE TABLE table_name_1 ( weekly_rank___number_ VARCHAR )
Name the 18-49 rating for weekly rank of 30
SELECT 18 AS _49__rating_share_ FROM table_name_1 WHERE weekly_rank___number_ = "30"
sql_create_context
CREATE TABLE table_72448 ( "Club" text, "Played" text, "Won" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text, "Losing bonus" text, "Points" text )
What is the value of the points column when the value of the column lost is 'lost
SELECT "Points" FROM table_72448 WHERE "Lost" = 'Lost'
wikisql
CREATE TABLE table_60965 ( "Class" text, "Team" text, "Drivers" text, "Laps" real, "Qual Pos" real )
Which class has a Qual position of 30?
SELECT "Class" FROM table_60965 WHERE "Qual Pos" = '30'
wikisql
CREATE TABLE table_name_7 ( founded INTEGER, nickname VARCHAR )
What is the most recent year founded that has a nickname of bruins?
SELECT MAX(founded) FROM table_name_7 WHERE nickname = "bruins"
sql_create_context
CREATE TABLE table_1473672_9 ( position VARCHAR, player VARCHAR )
what's the position with player being ray boutin
SELECT position FROM table_1473672_9 WHERE player = "Ray Boutin"
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
what is the number of patients whose diagnoses short title is malnutrition mild degree and lab test fluid is urine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Malnutrition mild degree" AND lab.fluid = "Urine"
mimicsql_data
CREATE TABLE table_57583 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Record" text )
What is the record of the game with Mason as the decision and Nashville as the home team?
SELECT "Record" FROM table_57583 WHERE "Decision" = 'mason' AND "Home" = 'nashville'
wikisql
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.7.27开始,截止到06.10.24,在患者葛安易开出的所有药品里,自费金额高于1217.85元的总共有多少
SELECT COUNT(*) FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_NM = '葛安易' AND t_kc22.STA_DATE BETWEEN '2000-07-27' AND '2006-10-24' AND t_kc22.SELF_PAY_AMO > 1217.85 UNION SELECT COUNT(*) FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gyb.PERSON_NM = '葛安易' AND ...
css
CREATE TABLE table_6071 ( "Medal" text, "Name" text, "Games" text, "Sport" text, "Event" text )
What were the events in the 1976 Innsbruck Games?
SELECT "Event" FROM table_6071 WHERE "Games" = '1976 innsbruck'
wikisql
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_re...
what airlines serve DENVER
SELECT DISTINCT airline_code FROM airline WHERE airline_code IN (SELECT FLIGHTalias0.airline_code FROM flight AS FLIGHTalias0 WHERE FLIGHTalias0.to_airport IN (SELECT AIRPORT_SERVICEalias0.airport_code FROM airport_service AS AIRPORT_SERVICEalias0 WHERE AIRPORT_SERVICEalias0.city_code IN (SELECT CITYalias0.city_code FR...
atis
CREATE TABLE table_name_22 ( arena VARCHAR, date VARCHAR )
At what arena was the September 21 game?
SELECT arena FROM table_name_22 WHERE date = "september 21"
sql_create_context
CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pre...
For those dates that have the 5 highest cloud cover rates, please bin the date into the day of week interval and count their frequency, could you sort in descending by the Y-axis?
SELECT date, COUNT(date) FROM weather ORDER BY COUNT(date) DESC
nvbench
CREATE TABLE table_19332 ( "Rank" real, "Name" text, "Nationality" text, "1st (m)" text, "2nd (m)" text, "Points" text, "Overall WC points (Rank)" text )
What is shown for 2nd (m) if the is 1st (m) is 203.5?
SELECT "2nd (m)" FROM table_19332 WHERE "1st (m)" = '203.5'
wikisql
CREATE TABLE book ( Title VARCHAR, Book_ID VARCHAR ) CREATE TABLE publication ( Title VARCHAR, Book_ID VARCHAR )
List the titles of books that are not published.
SELECT Title FROM book WHERE NOT Book_ID IN (SELECT Book_ID FROM publication)
sql_create_context
CREATE TABLE table_23286223_5 ( high_rebounds VARCHAR, game VARCHAR )
How many different high rebound results are there for the game number 26?
SELECT COUNT(high_rebounds) FROM table_23286223_5 WHERE game = 26
sql_create_context
CREATE TABLE table_25958 ( "Edition" text, "Round" text, "Date" text, "Against" text, "Surface" text, "Opponent" text, "Result" text, "Outcome" text )
If the opponent is Kristian Pless, who was it against?
SELECT "Against" FROM table_25958 WHERE "Opponent" = 'Kristian Pless'
wikisql
CREATE TABLE table_45028 ( "Driver" text, "Points" real, "Wins" real, "Top 5" real, "Top 10" real )
What are the highest points for Justin Lofton when his top 10 is lower than 5?
SELECT MAX("Points") FROM table_45028 WHERE "Driver" = 'justin lofton' AND "Top 10" < '5'
wikisql
CREATE TABLE table_name_36 ( result VARCHAR, week VARCHAR )
What was the result for week 16?
SELECT result FROM table_name_36 WHERE week = 16
sql_create_context
CREATE TABLE table_35338 ( "Race Title" text, "Circuit" text, "Location / State" text, "Date" text, "Winner" text, "Team" text )
Which Team has a Winner of craig lowndes, and a Circuit of phillip island grand prix circuit?
SELECT "Team" FROM table_35338 WHERE "Winner" = 'craig lowndes' AND "Circuit" = 'phillip island grand prix circuit'
wikisql
CREATE TABLE genre ( g_name text, rating text, most_popular_in text ) CREATE TABLE files ( f_id number, artist_name text, file_size text, duration text, formats text ) CREATE TABLE song ( song_name text, artist_name text, country text, f_id number, genre_is text, ...
How many songs were released for each format?
SELECT COUNT(*), formats FROM files GROUP BY formats
spider
CREATE TABLE table_70263 ( "1-person dive" text, "2-person dive" text, "3-person dive" text, "Surface" text, "Cage dive" text, "Seal/turtle decoy" text, "Catch release" text, "Attached camera" text, "Remote camera" text )
Which 3-person dive has 0 as a remote camera?
SELECT "3-person dive" FROM table_70263 WHERE "Remote camera" = '0'
wikisql
CREATE TABLE table_36860 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Attendance" real, "Record" text )
What was the record on March 14?
SELECT "Record" FROM table_36860 WHERE "Date" = 'march 14'
wikisql
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...
Potentially abandoned questions with inactive owners. Returns questions that are old (+6 months), have low views and score, have no upvoted or accept answer and where the user hasn't been active in the last 6 months. Modified from the query build out of this conversation http://chat.stackexchange.com/rooms/118/convers...
SELECT p.Id AS "post_link", p.Score, p.Tags AS Tags, p.AnswerCount AS Answers, CASE WHEN p.ClosedDate IS NULL THEN NULL ELSE 'Y' END AS Closed, DATEDIFF(month, p.CreationDate, GETDATE()) AS MnthsQstAct, u.Id AS "user_link" FROM Posts AS p LEFT JOIN Users AS u ON p.OwnerUserId = u.Id JOIN PostTags ON PostTags.PostId = p...
sede
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,...
Find the number of patients diagnosed with congestive heart failure, unspecified and the drug route of iv drip.
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 = "Congestive heart failure, unspecified" AND prescriptions.route = "IV DRIP"
mimicsql_data
CREATE TABLE table_71720 ( "Rank" real, "Player" text, "Games" real, "Goals" real, "Goal Ratio" real, "Debut in Europe" real )
How many debuts in Europe have less than 76 goals, more than 151 games, and a rank greater than 5?
SELECT COUNT("Debut in Europe") FROM table_71720 WHERE "Goals" < '76' AND "Games" > '151' AND "Rank" > '5'
wikisql
CREATE TABLE table_19001916_2 ( country VARCHAR, supply_point VARCHAR )
In how many countries is Itaipu a supply point for electricity?
SELECT COUNT(country) FROM table_19001916_2 WHERE supply_point = "Itaipu"
sql_create_context
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALA...
For those employees who was hired before 2002-06-21, return a bar chart about the distribution of hire_date and the sum of employee_id bin hire_date by weekday, and sort in desc by the y-axis please.
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY SUM(EMPLOYEE_ID) DESC
nvbench