table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
What are some of the most useful courses to take before taking NEUROSCI 619 ?
SELECT DISTINCT advisory_requirement FROM course WHERE department = 'NEUROSCI' AND number = 619
CREATE TABLE table_name_34 ( intergiro_classification VARCHAR, points_classification VARCHAR, winner VARCHAR )
What is the Intergiro classification of Nicolaj bo Larsen, who has a Fabrizio guidi point classification?
SELECT intergiro_classification FROM table_name_34 WHERE points_classification = "fabrizio guidi" AND winner = "nicolaj bo larsen"
CREATE TABLE table_78059 ( "Track" real, "Recorded" text, "Catalogue" text, "Release Date" text, "Song Title" text, "Time" text )
Tell me the track that has the catalogue of apbo 0280
SELECT "Track" FROM table_78059 WHERE "Catalogue" = 'apbo 0280'
CREATE TABLE table_name_45 ( date VARCHAR, place VARCHAR )
When 7th place, what is the date?
SELECT date FROM table_name_45 WHERE place = "7th"
CREATE TABLE table_name_55 ( seats INTEGER, share_of_votes VARCHAR )
What is the lowest number of seats from the election with 27.0% of votes?
SELECT MIN(seats) FROM table_name_55 WHERE share_of_votes = "27.0%"
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, Deletio...
Top 1000 users with keywords sorted by reputation. Top 100 by votes users in tag c#
SELECT Users.Id, Users.DisplayName, Users.Reputation FROM Users WHERE EXISTS(SELECT u.Id FROM Tags AS t WITH (nolock) INNER JOIN PostTags AS pt WITH (nolock) ON pt.TagId = t.Id INNER JOIN Posts AS p WITH (nolock) ON p.ParentId = pt.PostId INNER JOIN Users AS u WITH (nolock) ON u.Id = p.OwnerUserId WHERE p.CommunityOwne...
CREATE TABLE table_65442 ( "Rank" real, "Player" text, "County" text, "Tally" text, "Total" real, "Matches" real, "Average" real )
What is the number of matches with an average larger than 6.33, with a rank of 1?
SELECT SUM("Matches") FROM table_65442 WHERE "Average" > '6.33' AND "Rank" = '1'
CREATE TABLE table_name_75 ( ties INTEGER, years VARCHAR, pct VARCHAR )
How many Ties have Years of 1919 1925, and a Pct larger than 0.734?
SELECT SUM(ties) FROM table_name_75 WHERE years = "1919–1925" AND pct > 0.734
CREATE TABLE table_64811 ( "Class" text, "Railway number(s)" text, "DRG number(s)" text, "Quantity" real, "Year(s) of manufacture" text, "Axle arrangement ( UIC ) Bauart" text )
Which DRG number has xxx railway number?
SELECT "DRG number(s)" FROM table_64811 WHERE "Railway number(s)" = 'xxx'
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE patients ( row_id n...
what is the monthly minimum ca-125 value for patient 10425 during a year before?
SELECT MIN(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10425) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'ca-125') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURR...
CREATE TABLE table_name_53 ( _percentage_of_popular_vote VARCHAR, _number_of_seats_available VARCHAR )
What is the percentage of the popular vote when there were 90 seats available?
SELECT _percentage_of_popular_vote FROM table_name_53 WHERE _number_of_seats_available = 90
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TAB...
Find any name change in the history..
SELECT Id, LEFT(SUBSTRING(Text, STR_POSITION(Text, '@') + 1, LENGTH(Text)), PATINDEX('%^a-z%', SUBSTRING(Text, STR_POSITION(Text, '@') + 1, LENGTH(Text))) - 1) AS oldName, Text FROM Comments AS msq WHERE Id = 246568
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
what did patient 23929 first have as his intake?
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT inputevents_cv.itemid FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23929)) ORDER BY inputevents_cv.char...
CREATE TABLE table_name_83 ( position VARCHAR, jersey__number VARCHAR, birthdate VARCHAR )
What is the position of the player with a jersey # greater than 30 and a December 23, 1986 birthdate?
SELECT position FROM table_name_83 WHERE jersey__number > 30 AND birthdate = "december 23, 1986"
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 was the top three most frequent procedures given to patients in the same hospital visit after they were diagnosed with s/p aortobifemoral bypass until 4 years ago?
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 's/p a...
CREATE TABLE table_17118006_2 ( department VARCHAR, local_investment__us$_ VARCHAR )
What was the department that got $626,798 in local investments?
SELECT department FROM table_17118006_2 WHERE local_investment__us$_ = "626,798"
CREATE TABLE Accounts ( Account_ID INTEGER, Statement_ID INTEGER, Account_Details VARCHAR(255) ) CREATE TABLE Projects ( Project_ID INTEGER, Project_Details VARCHAR(255) ) CREATE TABLE Statements ( Statement_ID INTEGER, Statement_Details VARCHAR(255) ) CREATE TABLE Documents ( Documen...
Show the number of documents created in each day and bin document date by year interval and group by document type with a group line chart, and I want to order by the x-axis in asc.
SELECT Document_Date, COUNT(Document_Date) FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code GROUP BY Document_Type_Name ORDER BY Document_Date
CREATE TABLE table_name_99 ( venue VARCHAR, club VARCHAR )
Which Venue has a Club of west bromwich albion?
SELECT venue FROM table_name_99 WHERE club = "west bromwich albion"
CREATE TABLE table_203_138 ( id number, "#" number, "date" text, "venue" text, "opponent" text, "score" text, "result" text, "competition" text )
how many competitions were not friendly ?
SELECT COUNT(DISTINCT "date") FROM table_203_138 WHERE "competition" <> 'friendly'
CREATE TABLE table_26227 ( "No" real, "Player" text, "Height (m)" text, "Height (f)" text, "Position" text, "Year born" real, "Current Club" text )
Name the number for 1.96 height
SELECT "No" FROM table_26227 WHERE "Height (m)" = '1.96'
CREATE TABLE table_30291 ( "Religion" text, "Births" real, "Conversions" text, "New adherents per year" real, "Growth rate" text )
Name the religion that has a growth rate of 1.56%
SELECT "Religion" FROM table_30291 WHERE "Growth rate" = '1.56%'
CREATE TABLE table_name_32 ( total INTEGER, nation VARCHAR, silver VARCHAR )
What is the lowest Total for Italy with less than 0 silver?
SELECT MIN(total) FROM table_name_32 WHERE nation = "italy" AND silver < 0
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...
Tell me the number of patients with bladder cancer/sda primary disease who died in or before 2173.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "BLADDER CANCER/SDA" AND demographic.dod_year <= "2173.0"
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 ) ...
provide the number of patients whose item id is 50915?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "50915"
CREATE TABLE table_7279 ( "Place" text, "Player" text, "Country" text, "To par" text, "Hole" real )
How many holes does Player Vijay Singh have?
SELECT COUNT("Hole") FROM table_7279 WHERE "Player" = 'vijay singh'
CREATE TABLE table_name_49 ( runner_up VARCHAR, year VARCHAR, champion VARCHAR )
Which Runner-up has a Year smaller than 2008, and a Champion of jos acasuso?
SELECT runner_up FROM table_name_49 WHERE year < 2008 AND champion = "josé acasuso"
CREATE TABLE table_51465 ( "Driver" text, "Constructor" text, "Laps" text, "Time/Retired" text, "Grid" text )
What's the time for someone on grid 9?
SELECT "Time/Retired" FROM table_51465 WHERE "Grid" = '9'
CREATE TABLE table_name_17 ( final_placing VARCHAR, season VARCHAR )
What was the 2009 final placing?
SELECT final_placing FROM table_name_17 WHERE season = 2009
CREATE TABLE table_name_76 ( bsu_head_coach VARCHAR, opponent VARCHAR, year VARCHAR )
Who is the BSU head coach of the tournament after 1994 with louisville as the opponent?
SELECT bsu_head_coach FROM table_name_76 WHERE opponent = "louisville" AND year > 1994
CREATE TABLE table_71497 ( "Direction" text, "Name" text, "Japanese" text, "Terminals" text, "Length (km)" real )
What line is 24.7 km and head towards Toyohashi East?
SELECT "Name" FROM table_71497 WHERE "Direction" = 'toyohashi east' AND "Length (km)" = '24.7'
CREATE TABLE Ref_Budget_Codes ( Budget_Type_Code CHAR(15), Budget_Type_Description VARCHAR(255) ) CREATE TABLE Statements ( Statement_ID INTEGER, Statement_Details VARCHAR(255) ) CREATE TABLE Documents_with_Expenses ( Document_ID INTEGER, Budget_Type_Code CHAR(15), Document_Details VARCHAR...
Give me a bar chart for the total number of each budget type code, I want to sort x axis in asc order.
SELECT Budget_Type_Code, COUNT(*) FROM Documents_with_Expenses GROUP BY Budget_Type_Code ORDER BY Budget_Type_Code
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
Comments telling people to migrate to ELL.
SELECT Id AS "post_link", Score, ClosedDate FROM Posts AS P WHERE P.Id IN (SELECT PostId FROM Comments WHERE Text LIKE '%on ELL%' OR Text LIKE '%on English Language Learners%') AND PostTypeId = 1 ORDER BY Id
CREATE TABLE table_76412 ( "Name" text, "Championship" real, "FA Cup" real, "League Cup" real, "Total" real )
What is the total championships of James Henry that has a league cup more than 1?
SELECT SUM("Championship") FROM table_76412 WHERE "League Cup" > '1' AND "Name" = 'james henry'
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId ...
Comments asking for a jurisdiction on a question.
SELECT Posts.Id AS "post_link", Comments.Text FROM Comments, Posts WHERE Text LIKE '%which%jurisdiction%' AND Comments.PostId = Posts.Id AND Posts.PostTypeId = 1
CREATE TABLE table_11562 ( "HP Model" text, "Command Set" text, "# FDD" real, "FDD Type" text, "Sides" text, "FDD Capacity (each)" text, "# HDD" real, "HDD Capacity" text )
Tell me the HDD capacity for # FDD larger than 0 when FDD capacity is 710kb
SELECT "HDD Capacity" FROM table_11562 WHERE "# FDD" > '0' AND "FDD Capacity (each)" = '710kb'
CREATE TABLE party ( minister VARCHAR, took_office VARCHAR )
Show the minister who took office after 1961 or before 1959.
SELECT minister FROM party WHERE took_office > 1961 OR took_office < 1959
CREATE TABLE table_39494 ( "Rank" real, "Player" text, "Country" text, "Earnings ( $ )" real, "Wins" real )
What's the smallest amount of earnings when the wins are less than 72 and the rank is more than 3?
SELECT MIN("Earnings ( $ )") FROM table_39494 WHERE "Wins" < '72' AND "Rank" > '3'
CREATE TABLE Students ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40) ) CREATE TABLE Course_Authors_and_Tutors ( author_id IN...
Find the number of courses for each subject in a bar chart, and list by the Y in asc please.
SELECT subject_name, COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT(*)
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, d...
how many days has passed since patient 739 last received a lab test for hematocrit in this hospital encounter?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'hematocrit') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 739 AND admissions...
CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_...
Are there any FIN classes besides on Friday ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course_offering.friday = 'N' AND course.department = 'FIN' AND semester.semester = 'WN' AND se...
CREATE TABLE table_10156 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
Which home team has an away team score of 4.9 (33)?
SELECT "Home team" FROM table_10156 WHERE "Away team score" = '4.9 (33)'
CREATE TABLE table_name_98 ( average INTEGER, week VARCHAR, yards VARCHAR, team VARCHAR )
Which Average has Yards larger than 167, and a Team of at tb, and a Week larger than 7?
SELECT MIN(average) FROM table_name_98 WHERE yards > 167 AND team = "at tb" AND week > 7
CREATE TABLE table_44967 ( "Pollutant" text, "Type" text, "Standard" text, "Averaging Time" text, "Regulatory Citation" text )
what is the standard when the pollutant is o 3 and averaging time is 8-hour?
SELECT "Standard" FROM table_44967 WHERE "Pollutant" = 'o 3' AND "Averaging Time" = '8-hour'
CREATE TABLE table_name_52 ( opponent VARCHAR, date VARCHAR )
Which Opponent was played on 1991-10-13?
SELECT opponent FROM table_name_52 WHERE date = "1991-10-13"
CREATE TABLE table_42914 ( "m\u00e5cha" text, "indicative" text, "imperative" text, "subjunctive" text, "inverse subjunctive" text )
What subjunctive also has an inverse subjunctive of m chadns?
SELECT "subjunctive" FROM table_42914 WHERE "inverse subjunctive" = 'måchadns'
CREATE TABLE table_204_850 ( id number, "name" text, "railway" text, "series" text, "maker" text, "dates" text, "drive" text, "wheel arrangement" text, "weight" text, "power" text, "notes" text )
how many locomotives make the list of the largest locomotives ?
SELECT COUNT("name") FROM table_204_850
CREATE TABLE table_69241 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
What team 2 had a second leg of 3-2?
SELECT "Team 2" FROM table_69241 WHERE "2nd leg" = '3-2'
CREATE TABLE table_10700 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Attendance" real, "Record" text )
How many people were in attendance for the game with a score of 98 111?
SELECT SUM("Attendance") FROM table_10700 WHERE "Score" = '98–111'
CREATE TABLE table_80455 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
Which loss has an attendance greater than 49,688 and 11-8 as the record?
SELECT "Loss" FROM table_80455 WHERE "Attendance" > '49,688' AND "Record" = '11-8'
CREATE TABLE table_11677691_1 ( position VARCHAR, hometown VARCHAR )
What position did the player from Jersey City, New Jersey play?
SELECT position FROM table_11677691_1 WHERE hometown = "Jersey City, New Jersey"
CREATE TABLE table_204_988 ( id number, "responsible minister(s)" text, "crown entities" text, "monitoring department(s)" text, "category / type" text, "empowering legislation" text )
which monitoring department is listed the most ?
SELECT "monitoring department(s)" FROM table_204_988 GROUP BY "monitoring department(s)" ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE table_16469 ( "No. in season" real, "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (million)" text )
How many millions of views in the country watched 'Line of Departure'?
SELECT "U.S. viewers (million)" FROM table_16469 WHERE "Title" = 'Line of Departure'
CREATE TABLE table_25355501_2 ( november_3 VARCHAR, august_21_22 VARCHAR )
What is shown for november 3 when august 21-22 is august 22, 1998?
SELECT november_3 FROM table_25355501_2 WHERE august_21_22 = "August 22, 1998"
CREATE TABLE table_30209 ( "Event Date" text, "Event Day" text, "Approx. Duration" text, "Starting Time" text, "Event Details" text )
How many event dates occurred when event details were women's sabre?
SELECT COUNT("Event Date") FROM table_30209 WHERE "Event Details" = 'Women''s Sabre'
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic (...
Give me the number of patients diagnosed with chronic kidney disease nos and have drug route as sc.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Chronic kidney dis NOS" AND prescriptions.route = "SC"
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
what is the number of urgent hospital admission patients for whom joint fluid lab test was ordered?
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 = "Joint Fluid"
CREATE TABLE film_market_estimation ( estimation_id number, low_estimate number, high_estimate number, film_id number, type text, market_id number, year number ) CREATE TABLE market ( market_id number, country text, number_cities number ) CREATE TABLE film ( film_id number,...
Return the average gross sales in dollars across all films.
SELECT AVG(gross_in_dollar) FROM film
CREATE TABLE table_15300 ( "Club" text, "Winners" text, "Finalists" text, "Winning editions" text, "Not winning editions" text )
Who is Winners that has editions of 1992, 2003 as Not Winning
SELECT "Winners" FROM table_15300 WHERE "Not winning editions" = '1992, 2003'
CREATE TABLE table_6481 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
Which score has a visitor of New York?
SELECT "Score" FROM table_6481 WHERE "Visitor" = 'new york'
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
give me the number of patients whose diagnoses short title is b-complex defic nec and lab test abnormal status is abnormal?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "B-complex defic NEC" AND lab.flag = "abnormal"
CREATE TABLE table_name_75 ( unit VARCHAR, authors VARCHAR )
What is varricchio's unit?
SELECT unit FROM table_name_75 WHERE authors = "varricchio"
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE patient ( uniquep...
count the number of patients who in this year had an intake of iv flush.
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT intakeoutput.patientunitstayid FROM intakeoutput WHERE intakeoutput.celllabel = 'iv flush' AND intakeoutput.cellpath LIKE '%input%' AND DATETIME(intakeoutput.intakeoutputtime, 'start of year') = DATETIME(CURRENT_TIME(), 'st...
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime t...
calculate the duration of stay of patient 017-87754 of the first hospital stay.
SELECT STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', patient.hospitaladmittime) FROM patient WHERE patient.uniquepid = '017-87754' AND NOT patient.hospitaladmittime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1
CREATE TABLE table_name_87 ( date VARCHAR, tournament VARCHAR )
What is Date, when Tournament is Alfred Dunhill Championship 1?
SELECT date FROM table_name_87 WHERE tournament = "alfred dunhill championship 1"
CREATE TABLE table_14903491_1 ( year VARCHAR, womens_doubles VARCHAR )
Name the year for victoria hristova neli nedialkova
SELECT year FROM table_14903491_1 WHERE womens_doubles = "Victoria Hristova Neli Nedialkova"
CREATE TABLE people ( people_id number, name text, height number, weight number, home town text ) CREATE TABLE perpetrator ( perpetrator_id number, people_id number, date text, year number, location text, country text, killed number, injured number )
List the names of people that are not perpetrators.
SELECT name FROM people WHERE NOT people_id IN (SELECT people_id FROM perpetrator)
CREATE TABLE table_2597876_2 ( year VARCHAR, avg_start VARCHAR )
What is every year with average start of 27.2?
SELECT year FROM table_2597876_2 WHERE avg_start = "27.2"
CREATE TABLE table_23502 ( "No. in series" text, "No. in season" text, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (millions)" text )
How many millions of people in the US saw the episode with production code 214?
SELECT "U.S. viewers (millions)" FROM table_23502 WHERE "Production code" = '214'
CREATE TABLE table_51273 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text )
What was the record when chicago was the visiting team?
SELECT "Record" FROM table_51273 WHERE "Visitor" = 'chicago'
CREATE TABLE engineer_visits ( engineer_visit_id number, contact_staff_id number, engineer_id number, fault_log_entry_id number, fault_status text, visit_start_datetime time, visit_end_datetime time, other_visit_details text ) CREATE TABLE engineer_skills ( engineer_id number, s...
How many assets does each third party company supply? List the count and the company id.
SELECT COUNT(*), T1.company_id FROM third_party_companies AS T1 JOIN assets AS T2 ON T1.company_id = T2.supplier_company_id GROUP BY T1.company_id
CREATE TABLE table_79400 ( "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the average Gold entry for the Netherlands that also has a Bronze entry that is greater than 0?
SELECT AVG("Gold") FROM table_79400 WHERE "Nation" = 'netherlands' AND "Bronze" > '0'
CREATE TABLE table_77515 ( "Name" text, "Position" text, "Height" text, "Weight" real, "Year" text, "Home Town" text, "High School" text )
What is the Name with a Year with freshman, and a Home Town with los angeles, ca, and a Height of 6 4?
SELECT "Name" FROM table_77515 WHERE "Year" = 'freshman' AND "Home Town" = 'los angeles, ca' AND "Height" = '6–4'
CREATE TABLE table_19744915_3 ( order VARCHAR, public_vote VARCHAR )
what is the order when public vote was 18.155%
SELECT order FROM table_19744915_3 WHERE public_vote = "18.155%"
CREATE TABLE table_77992 ( "Name" text, "Location" text, "Length in km (mi)" text, "Year Completed" text, "Line" text )
What year was the Line of Gardermobanen completed?
SELECT "Year Completed" FROM table_77992 WHERE "Line" = 'gardermobanen'
CREATE TABLE table_25246 ( "Year" text, "Date" text, "Driver" text, "Team" text, "Manufacturer" text, "Laps" real, "Miles (km)" text, "Race Time" text, "Average Speed (mph)" text, "Report" text )
In what year was the average speed 92.68?
SELECT "Year" FROM table_25246 WHERE "Average Speed (mph)" = '92.68'
CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE date_day ( ...
show me the flights that go from ATLANTA to WASHINGTON on THURSDAY mornings
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, days, flight WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name =...
CREATE TABLE table_70796 ( "Player" text, "Height" real, "Position" text, "Year born" real, "Current Club" text )
What year was the Guard who currently plays for the Memphis Grizzlies born?
SELECT "Year born" FROM table_70796 WHERE "Position" = 'guard' AND "Current Club" = 'memphis grizzlies'
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
enteral two kal hn had ever been given to patient 006-80884 on the first intensive care unit visit?
SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-80884') AND NOT patient.unitdischargetime IS NULL ORDER BY patient...
CREATE TABLE table_44303 ( "Date" text, "Round" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real )
What was the result when the opponent was manchester united in venue h?
SELECT "Result" FROM table_44303 WHERE "Opponent" = 'manchester united' AND "Venue" = 'h'
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost numbe...
when was last the systemicsystolic of patient 002-56853 measured since 07/25/2105?
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-56853')) AND NOT vitalperiodic.systemicsystolic...
CREATE TABLE table_name_40 ( class VARCHAR, sport VARCHAR, year VARCHAR )
What class is volleyball in 2000?
SELECT class FROM table_name_40 WHERE sport = "volleyball" AND year = 2000
CREATE TABLE constructorResults ( constructorResultsId INTEGER, raceId INTEGER, constructorId INTEGER, points REAL, status TEXT ) CREATE TABLE status ( statusId INTEGER, status TEXT ) CREATE TABLE seasons ( year INTEGER, url TEXT ) CREATE TABLE constructors ( constructorId INT...
How many races that had any driver whose forename is Lewis? Show me a line chart, sort in ascending by the x-axis.
SELECT year, COUNT(year) FROM results AS T1 JOIN races AS T2 ON T1.raceId = T2.raceId JOIN drivers AS T3 ON T1.driverId = T3.driverId WHERE T3.forename = "Lewis" GROUP BY year ORDER BY year
CREATE TABLE table_26355 ( "Team" text, "Location" text, "Home Ground" text, "First year in Qld Cup" real, "Last year in Qld Cup" real, "Qld Cup Premierships" text )
What is every value for first year in QLD Cup if home ground is Corbett Park, Crosby Park, Lang Park, ANZ Stadium?
SELECT "First year in Qld Cup" FROM table_26355 WHERE "Home Ground" = 'Corbett Park, Crosby Park, Lang Park, ANZ Stadium'
CREATE TABLE entrepreneur ( Entrepreneur_ID int, People_ID int, Company text, Money_Requested real, Investor text ) CREATE TABLE people ( People_ID int, Name text, Height real, Weight real, Date_of_Birth text )
How many entrepreneurs correspond to each investor.
SELECT Investor, COUNT(*) FROM entrepreneur GROUP BY Investor
CREATE TABLE table_name_87 ( pick__number VARCHAR, position VARCHAR, round VARCHAR )
What was the pick # for a center picked before round 6?
SELECT COUNT(pick__number) FROM table_name_87 WHERE position = "center" AND round < 6
CREATE TABLE table_name_80 ( points INTEGER, premiers VARCHAR )
What's the total sum of points scored by the Brisbane Broncos?
SELECT SUM(points) FROM table_name_80 WHERE premiers = "brisbane broncos"
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 ReviewTasks ( Id number, ReviewTaskTypeId number, Cr...
Questions with multiple bounties by any users.
SELECT questions.Id AS "post_link", 'site://posts/' + CAST(questions.Id AS TEXT) + '/timeline|timeline' AS "Timeline link", COUNT(*) AS "Number of bounties", SUM(Votes.BountyAmount) AS "Total bounty amount" FROM Posts AS questions LEFT JOIN Votes AS votes ON Votes.PostId = questions.Id WHERE Votes.VoteTypeId = 8 GROUP ...
CREATE TABLE table_25617 ( "date (dd.mm.yyyy)" text, "Tail number" text, "Location" text, "Fatalities" text, "Brief description" text )
How many fatalities were there in the crash described as ditched 300 m short of runway?
SELECT "Fatalities" FROM table_25617 WHERE "Brief description" = 'Ditched 300 m short of runway'
CREATE TABLE table_34465 ( "Round" real, "Pick #" real, "Overall" real, "Name" text, "Position" text, "College" text )
Which cornerback has the highest round?
SELECT MAX("Round") FROM table_34465 WHERE "Position" = 'cornerback'
CREATE TABLE table_name_3 ( incumbent VARCHAR, district VARCHAR )
Who is the Incumbent that has a District of ohio 13 in Democratic Party?
SELECT incumbent FROM table_name_3 WHERE district = "ohio 13"
CREATE TABLE table_60410 ( "Date" real, "Name" text, "Venue" text, "Winner" text, "Runner-up" text, "Score" text )
What is Name, when Venue is 'Motherwell'?
SELECT "Name" FROM table_60410 WHERE "Venue" = 'motherwell'
CREATE TABLE table_204_839 ( id number, "et" text, "days available" text, "program" text, "host(s)" text, "description" text )
how many days is fbn live available each week ?
SELECT "days available" - "days available" + 1 FROM table_204_839 WHERE "program" = 'fbn live'
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...
what were the new prescriptions of patient 016-38131 today compared to the prescription they received yesterday?
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '016-38131') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT medication.drugname FROM medica...
CREATE TABLE table_name_89 ( year INTEGER, position VARCHAR )
What is the total year with a Position of 12th?
SELECT SUM(year) FROM table_name_89 WHERE position = "12th"
CREATE TABLE table_57963 ( "Region" text, "Date" text, "Label" text, "Format" text, "Catalogue" text )
What region is the catalogue number 9362486152 that was from September 3, 2004 from?
SELECT "Region" FROM table_57963 WHERE "Catalogue" = '9362486152' AND "Date" = 'september 3, 2004'
CREATE TABLE table_51661 ( "Edition" text, "Round" text, "Date" text, "Surface" text, "Opponent" text, "Result" text )
What surface was the April 24, 2003 match played on?
SELECT "Surface" FROM table_51661 WHERE "Date" = 'april 24, 2003'
CREATE TABLE table_name_27 ( gpu_frequency VARCHAR, release_date VARCHAR, sspec_number VARCHAR )
What is the GPU frequency for the processor released in June 2013, with a sSpec number of sr17l(c0)?
SELECT gpu_frequency FROM table_name_27 WHERE release_date = "june 2013" AND sspec_number = "sr17l(c0)"
CREATE TABLE table_29012710_1 ( province VARCHAR, number_of_dairy_farms VARCHAR )
what is the location where there are over 200 cattle businesses
SELECT province FROM table_29012710_1 WHERE number_of_dairy_farms = 200
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic (...
count the number of patients whose insurance is medicare and diagnoses icd9 code is 41021?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicare" AND diagnoses.icd9_code = "41021"
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE prescriptions ( row_id number, s...
how much did patient 57169 pay in hospital in total during their stay?
SELECT SUM(cost.cost) FROM cost WHERE cost.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 57169)