context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_65506 ( "Club" text, "League/Division" text, "Home Ground" text, "Location" text, "Position in 2012-13" text )
Which Location has a Home Ground of Mong kok stadium?
SELECT "Location" FROM table_65506 WHERE "Home Ground" = 'mong kok stadium'
wikisql
CREATE TABLE enroll ( class_code text, stu_num number, enroll_grade text ) CREATE TABLE class ( class_code text, crs_code text, class_section text, class_time text, class_room text, prof_num number ) CREATE TABLE department ( dept_code text, dept_name text, school_code ...
What are the first names of student who only took one course?
SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num GROUP BY T2.stu_num HAVING COUNT(*) = 1
spider
CREATE TABLE table_name_95 ( season VARCHAR, team VARCHAR, number VARCHAR, league VARCHAR )
What season has a number less than 90, Mitte as the league and spvgg ruhmannsfelden as the team?
SELECT season FROM table_name_95 WHERE number < 90 AND league = "mitte" AND team = "spvgg ruhmannsfelden"
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) 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, ...
provide the number of patients whose ethnicity is white and drug name is soln.?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE" AND prescriptions.drug = "Soln."
mimicsql_data
CREATE TABLE table_name_55 ( event VARCHAR, opponent VARCHAR )
At what event did he fight matt eckerle?
SELECT event FROM table_name_55 WHERE opponent = "matt eckerle"
sql_create_context
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, even...
what is the yearly minimum of sao2 for patient 2004 since 91 months ago?
SELECT MIN(chartevents.valuenum) 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 = 2004)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sao2'...
mimic_iii
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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 ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), ...
For those employees who do not work in departments with managers that have ids between 100 and 200, find last_name and salary , and visualize them by a bar chart, and I want to order by the total number from high to low.
SELECT LAST_NAME, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SALARY DESC
nvbench
CREATE TABLE table_4983 ( "Rank" text, "Name" text, "Height m (ft)" text, "Floors" real, "Year" real, "City" text )
What City is the Jal hotel in?
SELECT "City" FROM table_4983 WHERE "Name" = 'jal hotel'
wikisql
CREATE TABLE Grants ( grant_id INTEGER, organisation_id INTEGER, grant_amount DECIMAL(19,4), grant_start_date DATETIME, grant_end_date DATETIME, other_details VARCHAR(255) ) CREATE TABLE Project_Outcomes ( project_id INTEGER, outcome_code VARCHAR(10), outcome_details VARCHAR(255) ) ...
What are the descriptions of all the project outcomes, and count them by a bar chart, and rank bars from low to high order.
SELECT outcome_description, COUNT(outcome_description) FROM Research_Outcomes AS T1 JOIN Project_Outcomes AS T2 ON T1.outcome_code = T2.outcome_code GROUP BY outcome_description ORDER BY outcome_description
nvbench
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...
what is the number of patients whose age is less than 76 and diagnoses long title is transient neonatal thrombocytopenia?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "76" AND diagnoses.long_title = "Transient neonatal thrombocytopenia"
mimicsql_data
CREATE TABLE table_60672 ( "Opposing Teams" text, "Against" real, "Date" text, "Venue" text, "Status" text )
What venue has an against over 14, an opposing team of scotland, and a status of five nations?
SELECT "Venue" FROM table_60672 WHERE "Against" > '14' AND "Opposing Teams" = 'scotland' AND "Status" = 'five nations'
wikisql
CREATE TABLE table_name_39 ( birthdate VARCHAR, name VARCHAR )
What is the birthdate of Robert Esche?
SELECT birthdate FROM table_name_39 WHERE name = "robert esche"
sql_create_context
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABL...
What 's the number of credits for 540 ?
SELECT DISTINCT credits FROM course WHERE department = 'EECS' AND number = 540
advising
CREATE TABLE table_name_60 ( spa_fea VARCHAR, lms_fea VARCHAR )
What was the SPA FEA when the LMS FEA was 5?
SELECT spa_fea FROM table_name_60 WHERE lms_fea = "5"
sql_create_context
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,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), FIRST_NAME varcha...
For those employees who did not have any job in the past, give me the comparison about the average of department_id over the hire_date bin hire_date by time.
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
nvbench
CREATE TABLE table_name_97 ( rank INTEGER, sales__billion_$_ VARCHAR, profits__billion_$_ VARCHAR )
What is the average rank of the company with more than 146.56 billion in sales and profits of 11.68 billions?
SELECT AVG(rank) FROM table_name_97 WHERE sales__billion_$_ > 146.56 AND profits__billion_$_ = 11.68
sql_create_context
CREATE TABLE table_31202 ( "Skip (Club)" text, "W" real, "L" real, "PF" real, "PA" real, "Ends Won" real, "Ends Lost" real, "Blank Ends" real, "Stolen Ends" real )
Name the least ends lost for jo lle belley (glenmore)
SELECT MIN("Ends Lost") FROM table_31202 WHERE "Skip (Club)" = 'Joëlle Belley (Glenmore)'
wikisql
CREATE TABLE table_106 ( "Name of lava dome" text, "Country" text, "Volcanic area" text, "Composition" text, "Last eruption or growth episode" text )
What countries have had eruptions of growth episodes in 1986?
SELECT "Country" FROM table_106 WHERE "Last eruption or growth episode" = '1986'
wikisql
CREATE TABLE table_name_74 ( winning_team VARCHAR, circuit VARCHAR )
Who was the winning team at the Homestead-Miami Speedway?
SELECT winning_team FROM table_name_74 WHERE circuit = "homestead-miami speedway"
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 zyjzjlb.JZLSH FROM person_info JOIN hz_info JOIN zyjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE person_info.XM = '冯勇军' AND NOT zyjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ >= '2019-11-18')
css
CREATE TABLE table_name_46 ( overall INTEGER, college VARCHAR, pick__number VARCHAR )
College of san diego state, and a Pick # smaller than 30 has what lowest overall?
SELECT MIN(overall) FROM table_name_46 WHERE college = "san diego state" AND pick__number < 30
sql_create_context
CREATE TABLE Street_Markets ( Market_ID INTEGER, Market_Details VARCHAR(255) ) CREATE TABLE Ref_Attraction_Types ( Attraction_Type_Code CHAR(15), Attraction_Type_Description VARCHAR(255) ) CREATE TABLE Tourist_Attraction_Features ( Tourist_Attraction_ID INTEGER, Feature_ID INTEGER ) CREATE TA...
Give me a histogram for what are the names and ids of the tourist attractions that are visited at most once?, and sort Name in asc order.
SELECT T1.Name, T1.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN Visits AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID ORDER BY T1.Name
nvbench
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 countries ( COUNTRY...
For those employees who was hired before 2002-06-21, find hire_date and the average of salary bin hire_date by weekday, and visualize them by a bar chart, display in descending by the Y-axis please.
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(SALARY) DESC
nvbench
CREATE TABLE table_name_81 ( Id VARCHAR )
How many sets were played in the 2011 Tournament in which there were 3R in 2007?
SELECT 2011 FROM table_name_81 WHERE 2007 = "3r"
sql_create_context
CREATE TABLE course ( course_id text, title text, dept_name text, credits number ) CREATE TABLE time_slot ( time_slot_id text, day text, start_hr number, start_min number, end_hr number, end_min number ) CREATE TABLE teaches ( id text, course_id text, sec_id text, ...
What are the names of students who haven't taken any Biology courses?
SELECT name FROM student WHERE NOT id IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.dept_name = 'Biology')
spider
CREATE TABLE table_204_937 ( id number, "rank" number, "lane" number, "athlete" text, "time" number )
who placed first in the 2006 asian games finals ??
SELECT "athlete" FROM table_204_937 WHERE id = 1
squall
CREATE TABLE table_name_31 ( placings INTEGER, nation VARCHAR, points VARCHAR )
Which Placings have a Nation of west germany, and Points larger than 303.72?
SELECT SUM(placings) FROM table_name_31 WHERE nation = "west germany" AND points > 303.72
sql_create_context
CREATE TABLE table_name_62 ( roll VARCHAR, decile VARCHAR, name VARCHAR )
What is the roll number of Te Puke Intermediate, which has a decile of 4?
SELECT roll FROM table_name_62 WHERE decile = 4 AND name = "te puke intermediate"
sql_create_context
CREATE TABLE table_name_44 ( elected VARCHAR )
Who was the 1st member that was elected in 1541/42?
SELECT 1 AS st_member FROM table_name_44 WHERE elected = "1541/42"
sql_create_context
CREATE TABLE table_203_446 ( id number, "name" text, "gender" text, "age" number, "from" text, "occupation" text, "prize money (usd)" text, "status" text )
who is the youngest female , but not the youngest overall on the show cha $ e ?
SELECT "name" FROM table_203_446 WHERE "gender" = 'female' ORDER BY "age" LIMIT 1
squall
CREATE TABLE table_61772 ( "Show" text, "Date" text, "Official ratings (millions)" real, "Weekly rank" text, "Share" text )
When were the shares 39.1%?
SELECT "Date" FROM table_61772 WHERE "Share" = '39.1%'
wikisql
CREATE TABLE table_204_882 ( id number, "number" number, "builder" text, "entered service" text, "withdrawn" text, "notes" text )
which numbers were not withdrawn from service in 1957 ?
SELECT "number" FROM table_204_882 WHERE "withdrawn" <> 1957
squall
CREATE TABLE table_name_29 ( pick INTEGER, round VARCHAR, player VARCHAR )
How many picks had less than 11 rounds and a player of Charley Casey?
SELECT SUM(pick) FROM table_name_29 WHERE round < 11 AND player = "charley casey"
sql_create_context
CREATE TABLE table_3204 ( "Team" text, "#" real, "Car Sponsor(s)" text, "Driver(s)" text, "Listed Owner(s)" text, "Engine" text, "Chassis" text )
What engine doe the Ed Carpenter Racing team use?
SELECT "Engine" FROM table_3204 WHERE "Team" = 'Ed Carpenter Racing'
wikisql
CREATE TABLE table_6090 ( "Model Number" text, "Stepping" text, "Frequency" text, "L2 Cache" text, "Multi 1" text, "V Core" text, "Socket" text, "Release Date" text, "Part Number(s)" text )
What is the socket for the processor with part number ADH2350IAA5DO?
SELECT "Socket" FROM table_6090 WHERE "Part Number(s)" = 'adh2350iaa5do'
wikisql
CREATE TABLE table_74862 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
What loss has 26-9 as a loss?
SELECT "Loss" FROM table_74862 WHERE "Record" = '26-9'
wikisql
CREATE TABLE table_203_555 ( id number, "place" text, "player" text, "country" text, "score" text, "to par" number, "money ($)" number )
how many strokes was isao aoki behind larry nelson ?
SELECT (SELECT "to par" FROM table_203_555 WHERE "player" = 'isao aoki') - (SELECT "to par" FROM table_203_555 WHERE "player" = 'larry nelson')
squall
CREATE TABLE table_54351 ( "Round" real, "Pick" real, "Player" text, "Position" text, "Nationality" text, "School/Club Team" text )
What school or team has round of 2 with less than 42 picks?
SELECT "School/Club Team" FROM table_54351 WHERE "Round" = '2' AND "Pick" < '42'
wikisql
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALA...
For employees with first names that end with the letter m, groups and count the first name to visualize a bar graph, and could you rank total number in ascending order please?
SELECT FIRST_NAME, COUNT(FIRST_NAME) FROM employees WHERE FIRST_NAME LIKE '%m' GROUP BY FIRST_NAME ORDER BY COUNT(FIRST_NAME)
nvbench
CREATE TABLE phone_market ( Market_ID int, Phone_ID text, Num_of_stock int ) CREATE TABLE phone ( Name text, Phone_ID int, Memory_in_G int, Carrier text, Price real ) CREATE TABLE market ( Market_ID int, District text, Num_of_employees int, Num_of_shops real, Rankin...
What are the memories and carriers of phones, show in ascending by the sum memory in g.
SELECT Carrier, SUM(Memory_in_G) FROM phone GROUP BY Carrier ORDER BY SUM(Memory_in_G)
nvbench
CREATE TABLE table_name_89 ( round INTEGER, school_club_team VARCHAR, overall VARCHAR )
What is the lowest round Trinity school was drafted with an overall higher than 21?
SELECT MIN(round) FROM table_name_89 WHERE school_club_team = "trinity" AND overall < 21
sql_create_context
CREATE TABLE table_name_6 ( year_joined VARCHAR, city VARCHAR )
What year did the team based in the city of Winamac join the conference?
SELECT year_joined FROM table_name_6 WHERE city = "winamac"
sql_create_context
CREATE TABLE table_29007 ( "Pick #" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
what is the college/junior/club team for the player alfie turcotte?
SELECT "College/junior/club team" FROM table_29007 WHERE "Player" = 'Alfie Turcotte'
wikisql
CREATE TABLE PERFORMERS ( Customer_Phone VARCHAR, Customer_Name VARCHAR )
What is the phone number of the performer Ashley?
SELECT Customer_Phone FROM PERFORMERS WHERE Customer_Name = "Ashley"
sql_create_context
CREATE TABLE table_202_80 ( id number, "name" text, "metres" number, "feet" number )
how many peaks in the dolomites are above 10,000 feet ?
SELECT COUNT(*) FROM table_202_80 WHERE "feet" >= 10000
squall
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 ...
有多少门诊手术费是在2005年2月6日到2017年8月25日期间参保人姜舒方交的?
SELECT SUM(t_kc22.AMOUNT) FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '姜舒方' AND t_kc21.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2005-02-06' AND '2017-08-25' AND t_kc22.MED_INV_IT...
css
CREATE TABLE table_1341423_46 ( results VARCHAR, incumbent VARCHAR )
What was the result of the election featuring incumbent norman sisisky?
SELECT results FROM table_1341423_46 WHERE incumbent = "Norman Sisisky"
sql_create_context
CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE cite ( citi...
who has papers at NIPS ?
SELECT DISTINCT writes.authorid FROM paper, venue, writes WHERE venue.venueid = paper.venueid AND venue.venuename = 'NIPS' AND writes.paperid = paper.paperid
scholar
CREATE TABLE table_60311 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" real )
Which Place has a Country of united states, and a Money ($) larger than 0, and a Player of craig wood?
SELECT "Place" FROM table_60311 WHERE "Country" = 'united states' AND "Money ( $ )" > '0' AND "Player" = 'craig wood'
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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
count the number of patients who were admitted before the year 2150 with the lab test category blood gas.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2150" AND lab."CATEGORY" = "Blood Gas"
mimicsql_data
CREATE TABLE table_name_54 ( circuit VARCHAR, winning_driver VARCHAR )
Which circuit did fran ois eysermann win ?
SELECT circuit FROM table_name_54 WHERE winning_driver = "françois eysermann"
sql_create_context
CREATE TABLE table_68247 ( "Date" text, "Opponents" text, "Result F\u2013A" text, "Attendance" real, "League position" text )
What was the result with West Ham United with more than 67,577 in attendance?
SELECT "Result F\u2013A" FROM table_68247 WHERE "Attendance" > '67,577' AND "Opponents" = 'west ham united'
wikisql
CREATE TABLE table_name_29 ( points INTEGER, player VARCHAR, goals VARCHAR )
What is Ivan Ciernik's average points with less than 11 goals?
SELECT AVG(points) FROM table_name_29 WHERE player = "ivan ciernik" AND goals < 11
sql_create_context
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 treatment ( treatmentid...
patient 027-136480 received the procedure of pulmonary resection - tumor in other hospitals since 2105?
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '027-136480' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '027-136480' AND patient.hospitaldischargetime IS NULL)) AND ...
eicu
CREATE TABLE table_78377 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
What is the time/retired for phil hill with over 67 laps and a grad smaller than 18?
SELECT "Time/Retired" FROM table_78377 WHERE "Laps" > '67' AND "Grid" < '18' AND "Driver" = 'phil hill'
wikisql
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
看看零六年十月三十一日到一四年六月十九日医疗机构5872925外地门诊有多少次就诊记录
SELECT COUNT(*) FROM mzjzjlb WHERE YLJGDM = '5872925' AND JZKSRQ BETWEEN '2006-10-31' AND '2014-06-19' AND WDBZ > 0
css
CREATE TABLE table_name_13 ( list_entry_number VARCHAR, name VARCHAR )
What is the entry number on the list for Fairfield Moravian Church?
SELECT list_entry_number FROM table_name_13 WHERE name = "fairfield moravian church"
sql_create_context
CREATE TABLE table_name_24 ( player VARCHAR, country VARCHAR, score VARCHAR )
Who is the player from the United States with a score of 71-75=146?
SELECT player FROM table_name_24 WHERE country = "united states" AND score = 71 - 75 = 146
sql_create_context
CREATE TABLE table_29043 ( "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 (millions)" text )
What is the episode number of the episode with a production code of 4aky14?
SELECT "No. in season" FROM table_29043 WHERE "Production code" = '4AKY14'
wikisql
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime tim...
what is the procedure, which patient 51200 underwent two times the last month?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 512...
mimic_iii
CREATE TABLE table_27650 ( "Letters" text, "Organization" text, "Nickname" text, "Founding Date" text, "Founding University" text, "Type" text )
What is the founding date if the letters are ?
SELECT "Founding Date" FROM table_27650 WHERE "Letters" = 'ΚΨΚ'
wikisql
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate...
has patient 60136 been prescribed amlodipine besylate this year.
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 60136) AND prescriptions.drug = 'amlodipine besylate' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
mimic_iii
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, ...
List a user's rejected suggested edits. List all the rejected suggested edits proposed by a given user.
SELECT 'site://suggested-edits/' + CAST(s.Id AS TEXT(20)) + '|' + CASE LENGTH(LTRIM(s.Comment)) WHEN 0 THEN 'none' ELSE s.Comment END AS "suggested_edit", s.PostId AS "post_link", s.CreationDate AS "creation_date", s.RejectionDate AS "rejection_date" FROM SuggestedEdits AS s WHERE s.OwnerUserId = '##UserId##' AND NOT s...
sede
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE treatment ( ...
what is the daily maximum value of patient 011-35642's base excess until 30 months ago?
SELECT MAX(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-35642')) AND lab.labname = 'base excess' AND DATETIME(lab.labresulttime) <= DA...
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
provide the number of patients whose year of birth is less than 2047 and lab test fluid is cerebrospinal fluid (csf)?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2047" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
mimicsql_data
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid numb...
how many days has it been since last time patient 025-50213 was prescribed dextrose 50% 25 gram/50 ml syr during this hospital encounter?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', medication.drugstarttime)) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-502...
eicu
CREATE TABLE table_name_50 ( pick INTEGER, position VARCHAR )
What was the highest guard picked?
SELECT MAX(pick) FROM table_name_50 WHERE position = "guard"
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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime t...
what was the last output that patient 23042 has had until 11/06/2104?
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT outputevents.itemid FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23042)) AND STRFTIME('%y-%m-%d', outputeve...
mimic_iii
CREATE TABLE table_name_24 ( time INTEGER, number VARCHAR )
What is number 21's highest time?
SELECT MAX(time) FROM table_name_24 WHERE number = 21
sql_create_context
CREATE TABLE table_67603 ( "Name" text, "League" real, "Play-offs" real, "FA Cup" real, "League Cup" real, "Total" real )
What's the total for a league cup less than 1?
SELECT COUNT("League Cup") FROM table_67603 WHERE "Total" < '1'
wikisql
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid numb...
give me patient 013-12480's length of stay of his first stay in the icu.
SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-12480') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime LIMIT 1
eicu
CREATE TABLE table_38635 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
Which country does Adam Scott play for?
SELECT "Country" FROM table_38635 WHERE "Player" = 'adam scott'
wikisql
CREATE TABLE table_name_86 ( first_aired VARCHAR, money_requested__£_ INTEGER )
Name the first aired with money requested more than 85,000
SELECT first_aired FROM table_name_86 WHERE money_requested__£_ > 85 OFFSET 000
sql_create_context
CREATE TABLE table_43353 ( "Spoofed Title" text, "Actual Title" text, "Writer" text, "Artist" text, "Issue" real )
What is the spoofed title for Parks and Recreation with an issue larger than 509?
SELECT "Spoofed Title" FROM table_43353 WHERE "Issue" > '509' AND "Actual Title" = 'parks and recreation'
wikisql
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...
are there any results of patient 031-3355's microbiological test on the first hospital visit?
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi...
eicu
CREATE TABLE table_203_109 ( id number, "treaty" text, "organization" text, "introduced" number, "signed" number, "ratified" number )
what is the only organization whose treaties morocco has signed ?
SELECT DISTINCT "organization" FROM table_203_109 WHERE NOT "signed" IS NULL
squall
CREATE TABLE employees ( id INTEGER, last_name VARCHAR(20), first_name VARCHAR(20), title VARCHAR(30), reports_to INTEGER, birth_date TIMESTAMP, hire_date TIMESTAMP, address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code VARCHAR(10), ...
What are the names of the countries and average invoice size of the top countries by size.
SELECT billing_country, AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10
nvbench
CREATE TABLE ref_budget_codes ( budget_type_code text, budget_type_description text ) CREATE TABLE documents ( document_id number, document_type_code text, project_id number, document_date time, document_name text, document_description text, other_details text ) CREATE TABLE accoun...
What are the ids of documents with letter 's' in the name with any expense budgets.
SELECT T1.document_id FROM documents AS T1 JOIN documents_with_expenses AS T2 ON T1.document_id = T2.document_id WHERE T1.document_name LIKE '%s%'
spider
CREATE TABLE albums ( aid number, title text, year number, label text, type text ) CREATE TABLE instruments ( songid number, bandmateid number, instrument text ) CREATE TABLE tracklists ( albumid number, position number, songid number ) CREATE TABLE vocals ( songid num...
What are the types of vocals used in the song 'Le Pop'?
SELECT type FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE title = "Le Pop"
spider
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, ...
what were the four most frequently ordered laboratory tests for patients who had been diagnosed with respiratory acidosis - acute previously within 2 months, in this year?
SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'respiratory acidosis - acute' AND DATETIME(diagnosis...
eicu
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 CloseAsOffTopicReasonTypes ( Id number, IsUniversal bool...
Users from a given place ranked by Rep.
SELECT U.Id AS "user_link", U.Location, U.Age, U.Reputation, SUM(U.Reputation) / P."number_of_posts" AS "average_reputation_per_post" FROM Users AS U JOIN (SELECT OwnerUserId, COUNT(*) AS "number_of_posts" FROM Posts GROUP BY OwnerUserId) AS P ON U.Id = P.OwnerUserId WHERE U.Location LIKE '%##Location##' GROUP BY U.Id,...
sede
CREATE TABLE table_29903 ( "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 the high rebounds were by lamarcus aldridge (6)?
SELECT "Date" FROM table_29903 WHERE "High rebounds" = 'LaMarcus Aldridge (6)'
wikisql
CREATE TABLE loan ( loan_ID varchar(3), loan_type varchar(15), cust_ID varchar(3), branch_ID varchar(3), amount int ) CREATE TABLE customer ( cust_ID varchar(3), cust_name varchar(20), acc_type char(1), acc_bal int, no_of_loans int, credit_score int, branch_ID int, s...
Give me a histogram for what are the different names and credit scores of customers who have taken a loan?, and sort in descending by the cust_name.
SELECT cust_name, credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_ID = T2.cust_ID ORDER BY cust_name DESC
nvbench
CREATE TABLE table_3482 ( "Episode #" real, "Series #" real, "Title" text, "Director" text, "Writer" text, "Original airdate" text, "Viewers (in millions)" text )
What is the original airdate of the episode that had 8.23 million viewers?
SELECT "Original airdate" FROM table_3482 WHERE "Viewers (in millions)" = '8.23'
wikisql
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ...
what was the total hospital bill of patient 29611's stay on their last hospital encounter?
SELECT SUM(cost.cost) FROM cost WHERE cost.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 29611 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)
mimic_iii
CREATE TABLE table_name_42 ( original_title VARCHAR, director VARCHAR )
What is the original title where Paul Verhoeven is the director?
SELECT original_title FROM table_name_42 WHERE director = "paul verhoeven"
sql_create_context
CREATE TABLE table_name_13 ( team VARCHAR, time VARCHAR )
What team was the player that received a penalty at time 32:17 playing for?
SELECT team FROM table_name_13 WHERE time = "32:17"
sql_create_context
CREATE TABLE table_28470 ( "Institution" text, "Location" text, "Nickname" text, "Founded" real, "Enrollment" real, "Joined" real )
Name the number of locations for geneva college
SELECT COUNT("Location") FROM table_28470 WHERE "Institution" = 'Geneva College'
wikisql
CREATE TABLE table_name_35 ( rank INTEGER, silver VARCHAR, bronze VARCHAR, gold VARCHAR )
What is the highest rank with less than 2 bronze, more than 1 gold, and less than 1 silver?
SELECT MAX(rank) FROM table_name_35 WHERE bronze < 2 AND gold > 1 AND silver < 1
sql_create_context
CREATE TABLE table_53986 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text )
Who was the visitor when phoenix was at home?
SELECT "Visitor" FROM table_53986 WHERE "Home" = 'phoenix'
wikisql
CREATE TABLE table_29499399_2 ( money_list_rank VARCHAR, player VARCHAR )
Where is Cameron Beckman's rank on the money list?
SELECT money_list_rank FROM table_29499399_2 WHERE player = "Cameron Beckman"
sql_create_context
CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcit...
who published the most at chi
SELECT DISTINCT COUNT(DISTINCT paper.paperid), writes.authorid FROM paper, venue, writes WHERE venue.venueid = paper.venueid AND venue.venuename = 'chi' AND writes.paperid = paper.paperid GROUP BY writes.authorid ORDER BY COUNT(DISTINCT paper.paperid) DESC
scholar
CREATE TABLE table_name_71 ( results VARCHAR, incumbent VARCHAR )
What are the results for Bill Shuster?
SELECT results FROM table_name_71 WHERE incumbent = "bill shuster"
sql_create_context
CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE ReviewTaskResults ( Id number, ...
What are the most popular first 3 words in question titles?.
SELECT SUBSTRING(p.Title, 1, STR_POSITION(p.Title, ' ', STR_POSITION(p.Title, ' ', STR_POSITION(p.Title, ' ') + 1) + 1)) AS First3Words, COUNT(DISTINCT p.Id) AS Questions, AVG(p.Score) AS AvgScore FROM dbo.Posts AS p WHERE p.PostTypeId = 1 AND STR_POSITION(p.Title, ' ', STR_POSITION(p.Title, ' ', STR_POSITION(p.Title, ...
sede
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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 te...
检验结果指标记录46721684467的设备编码是什么?仪器编号是什么?名称是什么?
SELECT jyjgzbb.SBBM, jyjgzbb.YQBH, jyjgzbb.YQMC FROM jyjgzbb WHERE jyjgzbb.JYZBLSH = '46721684467'
css
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDa...
how many times have I said 'pivot table'?.
SELECT 'Pivot Table comments' AS pType, UserId AS "user_link", COUNT(Id) AS numMentions FROM Comments WHERE UserId IN ('##UserID##') AND Text LIKE '%pivot table%' COLLATE SQL_Latin1_General_CP1_CI_AS GROUP BY UserId UNION SELECT 'Pivot Table posts' AS pType, OwnerUserId AS "user_link", COUNT(Id) AS numMentions FROM Pos...
sede
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean...
Total number of comments that contains keyword by year and month.
SELECT CAST(YEAR(CreationDate) AS TEXT(4)) + '-' + RIGHT('00' + CAST(MONTH(CreationDate) AS TEXT(2)), 2) AS year_month, COUNT(*) AS total FROM Comments WHERE (UPPER(Text) LIKE '%DEVOPS%') GROUP BY CAST(YEAR(CreationDate) AS TEXT(4)) + '-' + RIGHT('00' + CAST(MONTH(CreationDate) AS TEXT(2)), 2) ORDER BY CAST(YEAR(Creati...
sede
CREATE TABLE table_name_26 ( grid INTEGER, driver VARCHAR, laps VARCHAR )
What is the average grid for johnny dumfries with less than 8 laps?
SELECT AVG(grid) FROM table_name_26 WHERE driver = "johnny dumfries" AND laps < 8
sql_create_context
CREATE TABLE artist ( Artist_ID int, Artist text, Age int, Famous_Title text, Famous_Release_date text ) CREATE TABLE volume ( Volume_ID int, Volume_Issue text, Issue_Date text, Weeks_on_Top real, Song text, Artist_ID int ) CREATE TABLE music_festival ( ID int, Musi...
Plot the number of result by grouped by result as a bar graph, and I want to rank from high to low by the X.
SELECT Result, COUNT(Result) FROM music_festival GROUP BY Result ORDER BY Result DESC
nvbench
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, v...
what was the four most frequently taken lab tests until 3 years ago for patients 60 or above?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t1.itemid FROM (SELECT labevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age >= 60) AND DATETIME(labevents.charttime) <= DATET...
mimic_iii