table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
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 the number of patients whose year of birth is less than 2098 and drug name is clonazepam?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2098" AND prescriptions.drug = "Clonazepam"
CREATE TABLE table_25346763_1 ( Major VARCHAR, facility VARCHAR )
Is the Washington Corrections Center for Women (WCCW) a major facility?
SELECT Major AS facility FROM table_25346763_1 WHERE facility = "Washington Corrections Center for Women (WCCW)"
CREATE TABLE table_12647 ( "Year" real, "Champion" text, "Runner-Up" text, "Score" text, "Venue" text )
What champion has north melbourne as the runner-up?
SELECT "Champion" FROM table_12647 WHERE "Runner-Up" = 'north melbourne'
CREATE TABLE station ( id int, network_name text, services text, local_authority text ) CREATE TABLE train ( id int, train_number int, name text, origin text, destination text, time text, interval text ) CREATE TABLE weekly_weather ( station_id int, day_of_week text...
Visualize a bar chart for the number of trains for each station by the station network name, I want to list by the y axis from low to high.
SELECT network_name, COUNT(*) FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id GROUP BY t2.station_id ORDER BY COUNT(*)
CREATE TABLE teaches ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0) ) CREATE TABLE section ( course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), building varchar(15), room_number varchar(7), t...
Give the number of departments with greater than average budget in each building with a bar chart, and order the number of building from low to high order.
SELECT building, COUNT(building) FROM department WHERE budget > (SELECT AVG(budget) FROM department) GROUP BY building ORDER BY COUNT(building)
CREATE TABLE table_19068566_1 ( written_by VARCHAR, production_code VARCHAR )
When 3t7458 is the production code who are the writers?
SELECT written_by FROM table_19068566_1 WHERE production_code = "3T7458"
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, ...
what was the top four most frequent diagnoses since 2103 that patients were diagnosed with within 2 months after receiving contr cerebr arteriogram?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissi...
CREATE TABLE table_70401 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
What is the week with a date of October 9, 1983, and attendance smaller than 40,492?
SELECT COUNT("Week") FROM table_70401 WHERE "Date" = 'october 9, 1983' AND "Attendance" < '40,492'
CREATE TABLE table_name_60 ( season VARCHAR, opponent VARCHAR, location VARCHAR, decision VARCHAR )
What season was played at Safeco Field, against the Boston Red Sox, with a decision of L?
SELECT season FROM table_name_60 WHERE location = "safeco field" AND decision = "l" AND opponent = "boston red sox"
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 prescriptions ( subject_id text, hadm_id...
Bring me the number of patients under 55 years of age who had wbc and other fluid lab test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "55" AND lab.label = "WBC, Other Fluid"
CREATE TABLE table_18639 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
In how many districts is the incumbent Dave E. Satterfield, Jr.
SELECT COUNT("Result") FROM table_18639 WHERE "Incumbent" = 'Dave E. Satterfield, Jr.'
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( ...
what were the four most frequent diagnoses that patients were diagnosed with within 2 months after being diagnosed with prickly heat since 6 years ago?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions...
CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text...
Find the number of the names of swimmers who has a result of 'win'.
SELECT name, COUNT(name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID WHERE Result = 'Win' GROUP BY name
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...
Among patients admitted before the year 2184, how many of them were on phys referral/normal deli?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.admityear < "2184"
CREATE TABLE table_name_93 ( long VARCHAR, player VARCHAR )
Tell me the long for charles frederick
SELECT long FROM table_name_93 WHERE player = "charles frederick"
CREATE TABLE table_name_61 ( october VARCHAR, november VARCHAR )
Who is in October when Carina Ragnarsson is in November?
SELECT october FROM table_name_61 WHERE november = "carina ragnarsson"
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 patient 20165's weight the first time until 6 months ago?
SELECT 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 = 20165)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt'...
CREATE TABLE table_204_240 ( id number, "name" text, "current use" text, "completed" text, "namesake" text, "info" text )
which building is after the bonds hall ?
SELECT "name" FROM table_204_240 WHERE id = (SELECT id FROM table_204_240 WHERE "name" = 'bonds hall') + 1
CREATE TABLE airport ( id int, City text, Country text, IATA text, ICAO text, name text ) CREATE TABLE flight ( id int, Vehicle_Flight_number text, Date text, Pilot text, Velocity real, Altitude real, airport_id int, company_id int ) CREATE TABLE operate_company...
How many companies that have ever operated a flight for each type? Draw a bar chart, sort from high to low by the Type please.
SELECT Type, COUNT(Type) FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id GROUP BY Type ORDER BY Type DESC
CREATE TABLE table_name_36 ( nationality VARCHAR, round VARCHAR, college_team VARCHAR )
What is Nationality, when Round is less than 2, and when College/Team is 'CB L'Hospitalet'?
SELECT nationality FROM table_name_36 WHERE round < 2 AND college_team = "cb l'hospitalet"
CREATE TABLE table_26708 ( "Major version" text, "Minor version" text, "WebKit version" text, "Operating System" text, "Release date" text, "Features" text )
What is the webkit version when the minor version was 3.1.2.?
SELECT "WebKit version" FROM table_26708 WHERE "Minor version" = '3.1.2'
CREATE TABLE table_name_90 ( percentage___percentage_ VARCHAR, language VARCHAR )
What is the percentage for Russian?
SELECT percentage___percentage_ FROM table_name_90 WHERE language = "russian"
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
tell me the number of urgent hospital admission patients who were born before 2184.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.dob_year < "2184"
CREATE TABLE table_66226 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location" text, "Record" text )
Which High rebounds has a Score of w 81-69?
SELECT "High rebounds" FROM table_66226 WHERE "Score" = 'w 81-69'
CREATE TABLE table_name_17 ( song VARCHAR, issue_date_s_ VARCHAR )
Which Song has an Issue date(s) of 29 may - 26 june?
SELECT song FROM table_name_17 WHERE issue_date_s_ = "29 may - 26 june"
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 demographic ( subject_id text, hadm_id t...
count the number of patients whose marital status is divorced and admission year is less than 2120?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.admityear < "2120"
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,...
count the number of patients whose gender is f and age is less than 68?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.age < "68"
CREATE TABLE table_14670060_1 ( transmitting_from VARCHAR, call_sign VARCHAR )
How many times does the call sign XEZV appear?
SELECT COUNT(transmitting_from) FROM table_14670060_1 WHERE call_sign = "XEZV"
CREATE TABLE table_8813 ( "Round" real, "Pick" real, "Overall" real, "Name" text, "Position" text, "College" text )
What position does the player from Mississippi state play?
SELECT "Position" FROM table_8813 WHERE "College" = 'mississippi state'
CREATE TABLE table_name_30 ( year VARCHAR, bärenklau VARCHAR, schwante VARCHAR, eichstädt VARCHAR )
What year has a Schwante smaller than 2.043, an Eichst dt smaller than 848, and a B renklau smaller than 1.262?
SELECT COUNT(year) FROM table_name_30 WHERE schwante < 2.043 AND eichstädt < 848 AND bärenklau < 1.262
CREATE TABLE table_name_46 ( venue VARCHAR, result VARCHAR )
Where did the competition take place that had a 4-2 result?
SELECT venue FROM table_name_46 WHERE result = "4-2"
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 the maximum age of patients with medicare insurance whose admission type is elective.
SELECT MAX(demographic.age) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.insurance = "Medicare"
CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) CREATE TABLE CL...
Find the number of students in each department that has the top 3 highest number of students. Show the department address and number of students with a bar chart.
SELECT DEPT_ADDRESS, COUNT(*) FROM STUDENT AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.DEPT_CODE ORDER BY COUNT(*) DESC LIMIT 3
CREATE TABLE table_name_15 ( points INTEGER, wins INTEGER )
Which Points have Wins larger than 1?
SELECT AVG(points) FROM table_name_15 WHERE wins > 1
CREATE TABLE table_1341549_10 ( district VARCHAR, incumbent VARCHAR )
Name the district of lawrence j. smith
SELECT district FROM table_1341549_10 WHERE incumbent = "Lawrence J. Smith"
CREATE TABLE table_21740 ( "Number" text, "Builder" text, "Type" text, "Date built" text, "Heritage" text, "Disposition" text, "Notes" text )
Name the number of builders for number 96
SELECT COUNT("Builder") FROM table_21740 WHERE "Number" = '96'
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...
calculate the number of patients for whom urine test was ordered and were admitted on an urgent basis.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.fluid = "Urine"
CREATE TABLE table_name_97 ( leading_scorer VARCHAR, attendance VARCHAR )
What is the leading scorer of the game with an attendance of 14,096?
SELECT leading_scorer FROM table_name_97 WHERE attendance = "14,096"
CREATE TABLE table_15650 ( "Region" text, "Date" text, "Label" text, "Format" text, "Catalog" text )
What date is associated with the label Village Records?
SELECT "Date" FROM table_15650 WHERE "Label" = 'village records'
CREATE TABLE table_18269 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
In what district was the incumbent Michael Bilirakis?
SELECT "District" FROM table_18269 WHERE "Incumbent" = 'Michael Bilirakis'
CREATE TABLE table_name_56 ( debut_year INTEGER, player VARCHAR, goals VARCHAR )
What is the highest debut year for player Joe Youlden, with goals larger than 0?
SELECT MAX(debut_year) FROM table_name_56 WHERE player = "joe youlden" AND goals > 0
CREATE TABLE table_22496344_1 ( high_school VARCHAR, year VARCHAR )
Which highschool has senior (rs) for the year?
SELECT high_school FROM table_22496344_1 WHERE year = "Senior (RS)"
CREATE TABLE table_57826 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
How many bronze medals for the nation with less than 1 total?
SELECT MAX("Bronze") FROM table_57826 WHERE "Total" < '1'
CREATE TABLE table_2009095_2 ( championship VARCHAR, outcome VARCHAR, opponents VARCHAR )
Name the championship for winner and judy tegart dalton lesley turner bowrey
SELECT COUNT(championship) FROM table_2009095_2 WHERE outcome = "Winner" AND opponents = "Judy Tegart Dalton Lesley Turner Bowrey"
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE...
Most viewed posts by tag w/o tag in post title.
SELECT Id AS "post_link", Tags, ViewCount, CreationDate, Title FROM Posts WHERE LastActivityDate > DATEADD(m, -12, GETDATE()) AND Tags LIKE '<##Tag##>' AND NOT Title LIKE '<##Tag##>' AND NOT Title LIKE '<##ExcludeTitle##>' ORDER BY ViewCount DESC
CREATE TABLE table_24485 ( "Day" text, "Stage" text, "Time (EET)" text, "Name" text, "Length" text, "Winner" text, "Time" text, "Avg. spd." text, "Rally leader" text )
What is the time when ss12 is stage?
SELECT "Time" FROM table_24485 WHERE "Stage" = 'SS12'
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...
count the number of patients whose year of death is less than or equal to 2131 and procedure icd9 code is 9907?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2131.0" AND procedures.icd9_code = "9907"
CREATE TABLE table_18598175_2 ( method_of_elimination VARCHAR, time VARCHAR )
What was the styled used to defeat the opponent within the time frame of 32:32?
SELECT method_of_elimination FROM table_18598175_2 WHERE time = "32:32"
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 ) ...
provide the number of patients whose diagnoses icd9 code is 60000?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.icd9_code = "60000"