table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE furniture ( name VARCHAR, furniture_id VARCHAR, market_rate VARCHAR )
Return the name and id of the furniture with the highest market rate.
SELECT name, furniture_id FROM furniture ORDER BY market_rate DESC LIMIT 1
CREATE TABLE table_31015 ( "Team" text, "Contest and round" text, "Opponent" text, "1st leg score*" text, "2nd leg score**" text, "Aggregate score" text )
what was the name of the team opponent to elfsborg
SELECT "Team" FROM table_31015 WHERE "Opponent" = 'Elfsborg'
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 number of patients admitted before the year 2110 were diagnosed with cholelith/ac gb inf-obst?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2110" AND diagnoses.short_title = "Cholelith/ac gb inf-obst"
CREATE TABLE table_name_46 ( country VARCHAR, name VARCHAR )
Name the country for pieroni
SELECT country FROM table_name_46 WHERE name = "pieroni"
CREATE TABLE table_69027 ( "Appearances" real, "Team" text, "Wins" real, "Losses" real, "Winning percentage" real, "Season(s)" text )
In 2009, what Appearances had a Winning Percentage of less than 0?
SELECT AVG("Appearances") FROM table_69027 WHERE "Season(s)" = '2009' AND "Winning percentage" < '0'
CREATE TABLE table_9807 ( "Rank" real, "Title" text, "Studio" text, "Director" text, "Worldwide Gross" text )
What studio is director Reginald Hudlin from?
SELECT "Studio" FROM table_9807 WHERE "Director" = 'reginald hudlin'
CREATE TABLE table_44094 ( "Usage" text, "Class" text, "Performance" text, "Performance test" text, "Particulate size approaching 100% retention" text, "Test Standard" text )
Which Test Standard has a Usage of secondary filters, and a Class of f5? Question 4
SELECT "Test Standard" FROM table_44094 WHERE "Usage" = 'secondary filters' AND "Class" = 'f5'
CREATE TABLE table_name_38 ( year_started INTEGER, current_car VARCHAR, number_of_cars VARCHAR )
Which Year started is the highest one that has a Current car of arctic sun, and a Number of cars smaller than 1?
SELECT MAX(year_started) FROM table_name_38 WHERE current_car = "arctic sun" AND number_of_cars < 1
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 ( id int, name text, Type text, Principal_activities text, Incorporated_in text, Group_Equ...
How many companies that have ever operated a flight for each type? Draw a bar chart, I want to rank from low to high by the x axis.
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
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,...
When did the patient Paul Edwards die?
SELECT demographic.dod FROM demographic WHERE demographic.name = "Paul Edwards"
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...
how many hispanic or latino patients were aged below 20 years?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND demographic.age < "20"
CREATE TABLE table_65835 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
How many Gold medals for the Nations with 6 or more Bronze medals and 18 or more Silver?
SELECT AVG("Gold") FROM table_65835 WHERE "Bronze" > '6' AND "Silver" > '18'
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...
tell me the birth date and marital status of patient jerry deberry.
SELECT demographic.marital_status, demographic.dob FROM demographic WHERE demographic.name = "Jerry Deberry"
CREATE TABLE table_60255 ( "Opposing Teams" text, "Against" real, "Date" text, "Venue" text, "Status" text )
What is the highest number against on 12/04/1969?
SELECT MAX("Against") FROM table_60255 WHERE "Date" = '12/04/1969'
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...
give me the number of patients whose primary disease is upper gi bleed and procedure icd9 code is 66?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "UPPER GI BLEED" AND procedures.icd9_code = "66"
CREATE TABLE table_21058823_1 ( result VARCHAR, record VARCHAR )
What did they do in the game when their record was 3-2-1?
SELECT result FROM table_21058823_1 WHERE record = "3-2-1"
CREATE TABLE storm ( Storm_ID int, Name text, Dates_active text, Max_speed int, Damage_millions_USD real, Number_Deaths int ) CREATE TABLE affected_region ( Region_id int, Storm_ID int, Number_city_affected real ) CREATE TABLE region ( Region_id int, Region_code text, R...
For all storms with at least 1 death, compare the total number of deaths by dates_active attribute.
SELECT Dates_active, Number_Deaths FROM storm WHERE Number_Deaths >= 1
CREATE TABLE table_name_92 ( score VARCHAR, visitor VARCHAR, date VARCHAR )
What is the score of the Boston Bruins away game on March 13?
SELECT score FROM table_name_92 WHERE visitor = "boston bruins" AND date = "march 13"
CREATE TABLE table_56443 ( "Rank" real, "Movie" text, "Year" real, "Studio(s)" text, "Opening Day Net Gross" real, "Day of Week" text )
What is the average rank of the Reliance Entertainment movie with an opening day on Wednesday before 2012?
SELECT AVG("Rank") FROM table_56443 WHERE "Day of Week" = 'wednesday' AND "Year" < '2012' AND "Studio(s)" = 'reliance entertainment'
CREATE TABLE table_name_79 ( swimsuit INTEGER, average VARCHAR, interview VARCHAR )
What is the sum of Swimsuit scores where the average score is 9.733 and the interview score is higher than 9.654?
SELECT SUM(swimsuit) FROM table_name_79 WHERE average = 9.733 AND interview > 9.654
CREATE TABLE table_name_44 ( cuts_made VARCHAR, events VARCHAR, top_25 VARCHAR )
What is the total number of cuts made for events played more than 3 times and under 2 top-25s?
SELECT COUNT(cuts_made) FROM table_name_44 WHERE events > 3 AND top_25 < 2
CREATE TABLE table_52963 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
Which away team scored 10.14 (74)?
SELECT "Away team" FROM table_52963 WHERE "Away team score" = '10.14 (74)'
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, Creati...
Most popular tags during a time period.
SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS PeriodRank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS Questions, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostId AND ...
CREATE TABLE table_1473672_4 ( college_junior_club_team VARCHAR, pick__number VARCHAR )
Name the college/junior club team for pick number 63
SELECT college_junior_club_team FROM table_1473672_4 WHERE pick__number = 63
CREATE TABLE table_name_27 ( byes INTEGER, draws INTEGER )
How many byes were there recorded with 0 draws?
SELECT SUM(byes) FROM table_name_27 WHERE draws < 0
CREATE TABLE table_name_5 ( region VARCHAR, catalog VARCHAR )
What is the Region, when the Catalog is SM 2965-05?
SELECT region FROM table_name_5 WHERE catalog = "sm 2965-05"
CREATE TABLE table_57591 ( "Race" text, "Circuit" text, "Date" text, "Pole position" text, "Fastest lap" text, "Winning driver" text, "Constructor" text, "Tyre" text, "Report" text )
What is the Tyre when Jerry Hoyt was the pole position?
SELECT "Tyre" FROM table_57591 WHERE "Pole position" = 'jerry hoyt'
CREATE TABLE submission ( Submission_ID int, Scores real, Author text, College text ) CREATE TABLE workshop ( Workshop_ID int, Date text, Venue text, Name text ) CREATE TABLE Acceptance ( Submission_ID int, Workshop_ID int, Result text )
Visualize a bar chart for how many workshops did each author submit to? Return the author name and the number of workshops, display names from low to high order.
SELECT Author, COUNT(DISTINCT T1.Workshop_ID) FROM Acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY Author
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 ...
give me the number of patients whose admission type is urgent and diagnoses icd9 code is 7596?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.icd9_code = "7596"
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 ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, ...
count the number of patients diagnosed with ami nos, initial in the same hospital encounter after they have been diagnosed with brain lacer nec-coma nos since 2105.
SELECT COUNT(DISTINCT t1.subject_id) 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 diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title =...
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 prescriptions ( subject_id text, hadm_id...
what is admission type and death status of subject id 10317?
SELECT demographic.admission_type, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "10317"
CREATE TABLE table_20799905_1 ( obama_percentage VARCHAR, county VARCHAR )
What percentage did Obama get in Rutherford county?
SELECT obama_percentage FROM table_20799905_1 WHERE county = "RUTHERFORD"
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE cost ( row_id numbe...
how many times has patient 86791 had received insert gastric tube nec in a year before?
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'insert gastric tube nec') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 86791) AND DATETIME(procedu...
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( ...
give me the number of patients whose admission type is newborn and discharge location is disc-tran cancer/chldrn h?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.discharge_location = "DISC-TRAN CANCER/CHLDRN H"
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varc...
Show the total salary by each hire date of employees, and please bin the hire date into the day of week interval for showing a bar chart.
SELECT HIRE_DATE, SUM(SALARY) FROM employees
CREATE TABLE table_train_191 ( "id" int, "gender" string, "hemoglobin_a1c_hba1c" float, "diabetic" string, "serum_creatinine" float, "allergy_to_glyburide" bool, "kidney_disease" bool, "drug_abuse" bool, "age" float, "NOUSE" float )
hba1c levels between 6 and 9.5 to be enrolled in the study.
SELECT * FROM table_train_191 WHERE hemoglobin_a1c_hba1c >= 6 AND hemoglobin_a1c_hba1c <= 9.5
CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text ) CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text )
Stacked bar of class and the number of class colored by Rank, sort Y in descending order.
SELECT Class, COUNT(Class) FROM captain GROUP BY Rank, Class ORDER BY COUNT(Class) DESC
CREATE TABLE table_47781 ( "Date" text, "Home" text, "Score" text, "Away" text, "Attendance" real )
Who was the home team with 3305 in attendance?
SELECT "Home" FROM table_47781 WHERE "Attendance" = '3305'
CREATE TABLE table_77411 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is Player, when Place is '1'?
SELECT "Player" FROM table_77411 WHERE "Place" = '1'
CREATE TABLE election ( Election_ID int, Counties_Represented text, District int, Delegate text, Party int, First_Elected real, Committee text ) CREATE TABLE party ( Party_ID int, Year real, Party text, Governor text, Lieutenant_Governor text, Comptroller text, A...
Show me population by county name in a histogram, sort by the y-axis in desc please.
SELECT County_name, Population FROM county ORDER BY Population DESC
CREATE TABLE table_35396 ( "Ranking" real, "Nationality" text, "Name" text, "Position" text, "Years" text, "League" real, "Europe" real, "Others" real, "Total" real )
What is the sum of the Europe totals for players with other appearances of 0, league appearances under 328, and a position of MF?
SELECT SUM("Europe") FROM table_35396 WHERE "Others" = '0' AND "League" < '328' AND "Position" = 'mf'
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40)...
For those employees who did not have any job in the past, show me about the distribution of hire_date and the average of employee_id bin hire_date by weekday in a bar chart, and list in descending by the Y.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(EMPLOYEE_ID) DESC
CREATE TABLE table_name_61 ( score VARCHAR, home_team VARCHAR )
Which score has a Home Team of saskatoon accelerators?
SELECT score FROM table_name_61 WHERE home_team = "saskatoon accelerators"
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, Creati...
Number of votes on answers and votes on questions per month - only non-CW.
SELECT LAST_DATE_OF_MONTH(v.CreationDate), COUNT(v.Id) AS "total_upvotes", SUM(CASE WHEN p.PostTypeId = 1 THEN 1 ELSE 0 END) AS "question_upvotes", SUM(CASE WHEN p.PostTypeId = 2 THEN 1 ELSE 0 END) AS "answer_upvotes" FROM Posts AS p INNER JOIN Votes AS v ON v.PostId = p.Id WHERE v.VoteTypeId = 2 AND (p.CommunityOwnedD...
CREATE TABLE table_train_271 ( "id" int, "renal_disease" bool, "hepatic_disease" bool, "smoking" bool, "coronary_artery_disease_cad" bool, "serum_creatinine" float, "body_mass_index_bmi" float, "myocardial_infarction" bool, "NOUSE" float )
coronary artery disease ( cad ) : documented by history of myocardial infarction
SELECT * FROM table_train_271 WHERE coronary_artery_disease_cad = 1 OR myocardial_infarction = 1
CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varch...
Last semester in CZECH 242 , who were the GSIs ?
SELECT DISTINCT student.firstname, student.lastname FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN gsi ON gsi.course_offering_id = course_offering.offering_id INNER JOIN student ON student.student_id = gsi.student_id INNER JOIN semester ON semester.semester_id = course...
CREATE TABLE table_59943 ( "Tournament" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text )
what is 2012 when the tournament is cincinnati masters?
SELECT "2012" FROM table_59943 WHERE "Tournament" = 'cincinnati masters'
CREATE TABLE table_46548 ( "Name" text, "Date" text, "Defending forces" text, "Brigade" text, "Population" text )
What is the Defending forces when the population was 120?
SELECT "Defending forces" FROM table_46548 WHERE "Population" = '120'
CREATE TABLE table_26230 ( "No" real, "Player" text, "Height (m)" text, "Height (f)" text, "Position" text, "Year born" real, "Current Club" text )
Identify every player's height in meters if the player is exactly 6' 07' tall in feet
SELECT "Height (m)" FROM table_26230 WHERE "Height (f)" = '6'' 07'
CREATE TABLE table_70437 ( "Name" text, "Years" text, "Gender" text, "Area" text, "Authority" text, "Decile" real, "Roll" real )
Which school in Balclutha has a roll smaller than 55?
SELECT "Name" FROM table_70437 WHERE "Area" = 'balclutha' AND "Roll" < '55'
CREATE TABLE table_202_231 ( id number, "party" text, "votes" number, "%" number, "seats" number, "+/-" number )
which party finished last in the election ?
SELECT "party" FROM table_202_231 ORDER BY "%" LIMIT 1
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of founder and the sum of revenue , and group by attribute founder.
SELECT Founder, SUM(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder
CREATE TABLE table_53777 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
What driver has BRM as a constructor and had more than 30 laps?
SELECT "Driver" FROM table_53777 WHERE "Constructor" = 'brm' AND "Laps" > '30'
CREATE TABLE table_name_67 ( conference_joined VARCHAR, location VARCHAR, mascot VARCHAR )
Can you tell me the Conference Joined that has the Location of terre haute, and the Mascot of golden bears?
SELECT conference_joined FROM table_name_67 WHERE location = "terre haute" AND mascot = "golden bears"
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE TAB...
list the AS flights arriving in BURBANK
SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'BURBANK' AND flight.airline_code = 'AS' AND flight.to_airport = airport_service.airport_code
CREATE TABLE table_49970 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" real, "Money ( $ )" text )
how many times is the country united states and the score 72-71-73-73=289?
SELECT COUNT("To par") FROM table_49970 WHERE "Country" = 'united states' AND "Score" = '72-71-73-73=289'
CREATE TABLE table_name_86 ( score VARCHAR, date VARCHAR )
What is the score when november 15 is the date?
SELECT score FROM table_name_86 WHERE date = "november 15"
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
provide the number of patients whose admission location is clinic referral/premature and age is less than 45?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.age < "45"
CREATE TABLE table_76736 ( "School" text, "Locality" text, "Ages" text, "Capacity" real, "Ofsted" real )
What is heaton chapel's capacity?
SELECT MAX("Capacity") FROM table_76736 WHERE "Locality" = 'heaton chapel'
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, s...
in this year, patient 49654 has made an admission?
SELECT COUNT(*) > 0 FROM admissions WHERE admissions.subject_id = 49654 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code tex...
what was patient 57023's last blood culture ( myco/f lytic bottle)'s microbiology test time in the last month?
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 57023) AND microbiologyevents.spec_type_desc = 'blood culture ( myco/f lytic bottle)' AND DATETIME(microbiologyevents.charttime, 'start of month') = DA...
CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TE...
Return a bar chart on how many wines are there for each grape?
SELECT Grape, COUNT(*) FROM wine GROUP BY Grape
CREATE TABLE people ( People_ID int, Name text, Height real, Weight real, Birth_Date text, Birth_Place text ) CREATE TABLE body_builder ( Body_Builder_ID int, People_ID int, Snatch real, Clean_Jerk real, Total real )
Visualize a scatter chart about the correlation between People_ID and Snatch .
SELECT People_ID, Snatch FROM body_builder
CREATE TABLE table_name_90 ( status VARCHAR, area_km_2 VARCHAR, population VARCHAR )
What status has an area km 2 less than 27.82, with 352 as the population?
SELECT status FROM table_name_90 WHERE area_km_2 < 27.82 AND population = 352
CREATE TABLE table_name_33 ( country VARCHAR, player VARCHAR )
What country does Mark Hayes play for?
SELECT country FROM table_name_33 WHERE player = "mark hayes"
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) C...
Users with at least n gold badges.
WITH tagbadges_cte AS (SELECT b.UserId AS uid, SUM(CASE WHEN b.Class = 1 THEN 1 ELSE 0 END) AS gold, SUM(CASE WHEN b.Class = 2 THEN 1 ELSE 0 END) AS silver, SUM(CASE WHEN b.Class = 3 THEN 1 ELSE 0 END) AS bronze, COUNT(b.Id) AS total FROM Badges AS b INNER JOIN Tags AS t ON t.TagName = Name GROUP BY UserId) SELECT u.Id...
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...
how many patients with elective admission type were born before the year 2107?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.admityear < "2107"
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDat...
Interesting Ubuntu trends (# of Questions per Month).
SELECT DATEADD(mm, (YEAR(Posts.CreationDate) - 1900) * 12 + MONTH(Posts.CreationDate) - 1, 0) AS Month, Tags.TagName, COUNT(*) AS Questions FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Tags.TagName IN ...
CREATE TABLE table_76124 ( "Television service" text, "Country" text, "Language" text, "Content" text, "HDTV" text, "Package/Option" text )
What is the HDTV when documentaries are the content?
SELECT "HDTV" FROM table_76124 WHERE "Content" = 'documentaries'
CREATE TABLE table_16409745_1 ( interface VARCHAR, pages_per_minute__color_ VARCHAR )
What interface is used on the scanner that has a 36 pages per minute?
SELECT interface FROM table_16409745_1 WHERE pages_per_minute__color_ = 36
CREATE TABLE table_203_798 ( id number, "party" text, "votes" text, "%" number, "swing" number, "seats" number, "change" number )
how many seats did the independent party get ?
SELECT "seats" FROM table_203_798 WHERE "party" = 'independent'
CREATE TABLE table_10367 ( "State" text, "Swimsuit" real, "Interview" real, "Evening Gown" real, "Average" real )
What is the lowest swimsuit for a contestant with an average of 9.125?
SELECT MIN("Swimsuit") FROM table_10367 WHERE "Average" = '9.125'
CREATE TABLE table_name_79 ( to_par VARCHAR, place VARCHAR, score VARCHAR )
What is the To par of the T8 Place Player with a Score of 72-70-66=208?
SELECT to_par FROM table_name_79 WHERE place = "t8" AND score = 72 - 70 - 66 = 208
CREATE TABLE table_70765 ( "Name" text, "Country" text, "Type" text, "Moving from" text, "Transfer window" text, "Ends" real, "Transfer fee" text, "Source" text )
Which transfer window was moving from borussia dortmund?
SELECT "Transfer window" FROM table_70765 WHERE "Moving from" = 'borussia dortmund'
CREATE TABLE table_42909 ( "Year" real, "Champion" text, "Runner-up" text, "Third place" text, "Fourth place" text, "Jack Tompkins Trophy (MVP)" text )
What is the Fourth place with a Year that is 1966?
SELECT "Fourth place" FROM table_42909 WHERE "Year" = '1966'
CREATE TABLE table_14186 ( "Question #" real, "Prize Level (in Rupees)" real, "Range (in %)" real, "Walk-Away Prize" real, "Prize If Wrong" real )
What is the prize level when the Prize if Wrong is 1,000 and the question is less than 2?
SELECT SUM("Prize Level (in Rupees)") FROM table_14186 WHERE "Prize If Wrong" = '1,000' AND "Question #" < '2'
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), CO...
For all employees who have the letters D or S in their first name, show me about the distribution of hire_date and the average of employee_id bin hire_date by time in a bar chart, sort by the y axis in ascending.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(EMPLOYEE_ID)
CREATE TABLE table_46912 ( "Driver" text, "Team" text, "Laps" real, "Time/Retired" text, "Grid" real, "Points" real )
Which Points have a Time/Retired of +49.222 secs?
SELECT MAX("Points") FROM table_46912 WHERE "Time/Retired" = '+49.222 secs'
CREATE TABLE table_62999 ( "Pick" real, "Team" text, "Player" text, "Position" text, "College" text )
Which college did the player picked larger than 130 by the New York Jets go to?
SELECT "College" FROM table_62999 WHERE "Pick" > '130' AND "Team" = 'new york jets'
CREATE TABLE table_20573232_1 ( nader_percentage VARCHAR, obama_percentage VARCHAR )
What is Nader's percentage when Obama is 44.6%?
SELECT nader_percentage FROM table_20573232_1 WHERE obama_percentage = "44.6%"
CREATE TABLE table_name_23 ( ties VARCHAR, goals_against INTEGER )
What are the number of Ties for games with Goals Against smaller than 33?
SELECT ties FROM table_name_23 WHERE goals_against < 33
CREATE TABLE table_30353 ( "Late Old English (Anglian)" text, "Early Middle English" text, "Late Middle English" text, "Early Modern English" text, "Modern English" text, "Example" text )
What is the modern English phonology used in the example weg > 'way'; regn > 'rain'?
SELECT "Modern English" FROM table_30353 WHERE "Example" = 'weg > "way"; regn > "rain'
CREATE TABLE locations ( location_id number, street_address text, postal_code text, city text, state_province text, country_id text ) CREATE TABLE employees ( employee_id number, first_name text, last_name text, email text, phone_number text, hire_date time, job_id t...
What is the average salary for each job title?
SELECT job_title, AVG(salary) FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id GROUP BY T2.job_title
CREATE TABLE table_261927_2 ( institution VARCHAR, primary_conference VARCHAR )
Which institutions primary conference is merged into the university of Massachusetts boston?
SELECT institution FROM table_261927_2 WHERE primary_conference = "Merged into the University of Massachusetts Boston"
CREATE TABLE table_203_279 ( id number, "interferometer and observing mode" text, "waveband" text, "limiting magnitude" number, "minimum baseline (m)\n(un-projected)" number, "maximum baseline (m)" number, "approx. no. visibility measurements per year\n(measurements per night x nights used p...
what 's the total limiting matitude of coast visible and coast infrared ?
SELECT SUM("limiting magnitude") FROM table_203_279 WHERE "interferometer and observing mode" IN ('coast visible', 'coast infrared')
CREATE TABLE Roles ( Role_Code CHAR(15), Role_Name VARCHAR(255), Role_Description VARCHAR(255) ) CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destr...
Show the number of documents in different starting date and group by starting date with a line chart.
SELECT Date_in_Location_From, COUNT(Date_in_Location_From) FROM Document_Locations GROUP BY Date_in_Location_From
CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREAT...
get SATURDAY fares from WASHINGTON to MONTREAL
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MONTREAL' AND DAYS_1.day_name ...
CREATE TABLE table_2757 ( "Pos" text, "##" real, "Name" text, "Team" text, "Lap One" text, "Lap Two" text, "Lap Three" text, "Lap Four" text, "Total Time" text, "Avg. Speed" text )
What is tthe lowest number on team 3g?
SELECT MIN("##") FROM table_2757 WHERE "Team" = 'Team 3G'
CREATE TABLE table_28954 ( "Rd." text, "Circuit" text, "City / State" text, "Date" text, "Championship" text, "Challenge" text, "Production" text )
What was the location for the date 7 10 october?
SELECT "City / State" FROM table_28954 WHERE "Date" = '7–10 October'
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, sh...
what procedure was last taken to patient 25696 in 2105?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT procedures_icd.icd9_code FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25696) AND STRFTIME('%y', procedures_icd.charttime) = '2105' ORDER B...
CREATE TABLE table_name_10 ( decile INTEGER, name VARCHAR )
What is the lowest decile that Ohau School has?
SELECT MIN(decile) FROM table_name_10 WHERE name = "ohau school"
CREATE TABLE table_name_48 ( player VARCHAR, position VARCHAR, hometown VARCHAR )
Which player has a Position of infielder, and a Hometown of atlanta, ga?
SELECT player FROM table_name_48 WHERE position = "infielder" AND hometown = "atlanta, ga"
CREATE TABLE table_33647 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the largest crowd where Carlton was the away team?
SELECT MAX("Crowd") FROM table_33647 WHERE "Away team" = 'carlton'
CREATE TABLE table_8405 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ($)" text )
What country is the player who earned $9,000 from?
SELECT "Country" FROM table_8405 WHERE "Money ($)" = '9,000'
CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, ...
i would like to travel from BOSTON to DENVER
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 = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER'...
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...
find the number of american indian/alaska native patients who were born before 2134.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND demographic.dob_year < "2134"
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 labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, ...
what was patient 30044 first height until 71 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 = 30044)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit ht'...
CREATE TABLE table_name_61 ( cuts_made INTEGER, wins VARCHAR, top_25 VARCHAR, top_5 VARCHAR )
Name the most cuts made with top-25 more than 4 and top 5 of 1 with wins more than 0
SELECT MAX(cuts_made) FROM table_name_61 WHERE top_25 > 4 AND top_5 = 1 AND wins > 0
CREATE TABLE table_203_650 ( id number, "ceremony" text, "award" text, "category" text, "name" text, "outcome" text )
what is the total number of awards that the film won or was nominated for ?
SELECT COUNT(*) FROM table_203_650
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 ) ...
give the number of patients whose diagnosis long title is malignant neoplasm of descending colon and lab test category is hematology.
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.long_title = "Malignant neoplasm of descending colon" AND lab."CATEGORY" = "Hematology"