instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
calculate the maximum days for which patients admitted on or after 2177 were hospitalized. | 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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug tex... | SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.admityear >= "2177" |
Tell me the declination for consellaion of ophiuchus and apparent magnitude less than 8.6 with right ascension of 16h47m14.5s | CREATE TABLE table_57243 ("NGC number" real,"Object type" text,"Constellation" text,"Right ascension (J2000)" text,"Declination (J2000)" text,"Apparent magnitude" real) | SELECT "Declination ( J2000 )" FROM table_57243 WHERE "Constellation" = 'ophiuchus' AND "Apparent magnitude" < '8.6' AND "Right ascension ( J2000 )" = '16h47m14.5s' |
Number of posts by year. | CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE Comments (Id number,PostId number,Score nu... | SELECT DATEDIFF(day, CreationDate, GETDATE()) / 365 AS yearsBack, COUNT(Id) AS postsCount FROM Posts GROUP BY DATEDIFF(day, CreationDate, GETDATE()) / 365 ORDER BY DATEDIFF(day, CreationDate, GETDATE()) / 365 DESC |
Which PD per game has a Rank smaller than 4, a Winning % of 78.6%, a Streak of w1, and a PA per game smaller than 81.5? | CREATE TABLE table_name_49 (pd_per_game INTEGER,pa_per_game VARCHAR,streak VARCHAR,rank VARCHAR,winning__percentage VARCHAR) | SELECT MIN(pd_per_game) FROM table_name_49 WHERE rank < 4 AND winning__percentage = "78.6%" AND streak = "w1" AND pa_per_game < 81.5 |
tell me the average roll for the featherston area and integrated authority. | CREATE TABLE table_name_48 (roll INTEGER,area VARCHAR,authority VARCHAR) | SELECT AVG(roll) FROM table_name_48 WHERE area = "featherston" AND authority = "integrated" |
Tell me the date for johanna konta | CREATE TABLE table_31947 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Opponent in the final" text,"Score" text) | SELECT "Date" FROM table_31947 WHERE "Opponent in the final" = 'johanna konta' |
how many patients whose marital status is widowed and drug route is neb? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethni... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.marital_status = "WIDOWED" AND prescriptions.route = "NEB" |
What is the kickoff time for the Miami Dolphins? | CREATE TABLE table_name_81 (kickoff VARCHAR,opponent VARCHAR) | SELECT kickoff FROM table_name_81 WHERE opponent = "miami dolphins" |
Bin the Year into weekday interval, then group and count by Year, display Y-axis in desc order. | CREATE TABLE exhibition (Exhibition_ID int,Year int,Theme text,Artist_ID int,Ticket_Price real)CREATE TABLE artist (Artist_ID int,Name text,Country text,Year_Join int,Age int)CREATE TABLE exhibition_record (Exhibition_ID int,Date text,Attendance int) | SELECT Year, COUNT(Year) FROM exhibition ORDER BY COUNT(Year) DESC |
Which driver had a grid of 22? | CREATE TABLE table_51336 ("Driver" text,"Constructor" text,"Laps" text,"Time/Retired" text,"Grid" text) | SELECT "Driver" FROM table_51336 WHERE "Grid" = '22' |
Find the location of the club 'Pen and Paper Gaming'. | CREATE TABLE club (clubid number,clubname text,clubdesc text,clublocation text)CREATE TABLE member_of_club (stuid number,clubid number,position text)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text) | SELECT clublocation FROM club WHERE clubname = "Pen and Paper Gaming" |
What was the 2011 Wimbledon result? | CREATE TABLE table_4696 ("Tournament" text,"2007" text,"2009" text,"2010" text,"2011" text) | SELECT "2011" FROM table_4696 WHERE "Tournament" = 'wimbledon' |
What's the record during 1925? | CREATE TABLE table_name_99 (record VARCHAR,year VARCHAR) | SELECT record FROM table_name_99 WHERE year = 1925 |
How many attended the game at Busch Stadium (ii) when the time was 3:54? | CREATE TABLE table_name_88 (attendance VARCHAR,location VARCHAR,time VARCHAR) | SELECT attendance FROM table_name_88 WHERE location = "busch stadium (ii)" AND time = "3:54" |
What is the Proto-Austronesian word for the Proto-Polynesian word *tui? | CREATE TABLE table_name_53 (proto_austronesian VARCHAR,proto_polynesian VARCHAR) | SELECT proto_austronesian FROM table_name_53 WHERE proto_polynesian = "*tui" |
Which award show had the category of best supporting actress? | CREATE TABLE table_55135 ("Year" real,"Award" text,"Category" text,"Nominated work" text,"Result" text) | SELECT "Award" FROM table_55135 WHERE "Category" = 'best supporting actress' |
What is the height in ft for number 42 for the rockets in 1993-94? | CREATE TABLE table_11734041_16 (height_in_ft VARCHAR,no_s_ VARCHAR,years_for_rockets VARCHAR) | SELECT height_in_ft FROM table_11734041_16 WHERE no_s_ = "42" AND years_for_rockets = "1993-94" |
Which teams classification winners had a general classification winner of Allan Davis? | CREATE TABLE table_30283 ("Stage" real,"Winner" text,"General classification \u017b\u00f3\u0142ta koszulka" text,"Mountains classification Klasyfikacja g\u00f3rska" text,"Intermediate Sprints Classification Klasyfikacja najaktywniejszych" text,"Points classification Klasyfikacja punktowa" text,"Teams classification" te... | SELECT "Teams classification" FROM table_30283 WHERE "General classification \u017b\u00f3\u0142ta koszulka" = 'Allan Davis' |
What is the Away with a Score that is 46-82? | CREATE TABLE table_6967 ("Date" text,"Time" text,"Home" text,"Away" text,"Score" text,"Ground" text) | SELECT "Away" FROM table_6967 WHERE "Score" = '46-82' |
What is 1995 Grand Slam Tournament if 1996 is also grand slam tournaments? | CREATE TABLE table_62774 ("Tournament" text,"1987" text,"1988" text,"1989" text,"1990" text,"1991" text,"1992" text,"1993" text,"1994" text,"1995" text,"1996" text,"1997" text) | SELECT "1990" FROM table_62774 WHERE "1996" = 'grand slam tournaments' |
uncorrected visual or hearing problem | CREATE TABLE table_train_259 ("id" int,"systolic_blood_pressure_sbp" int,"hiv_infection" bool,"hemoglobin_a1c_hba1c" float,"hearing_problem" bool,"heart_disease" bool,"high_blood_pressure" bool,"diabetic" string,"immune_deficiency_disorder" bool,"visual_impairment" bool,"diastolic_blood_pressure_dbp" int,"NOUSE" float) | SELECT * FROM table_train_259 WHERE visual_impairment = 1 OR hearing_problem = 1 |
count the number of patients whose admission type is emergency and admission year is less than 2163? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethni... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.admityear < "2163" |
Which province got a swimsuit score of 8.43 | CREATE TABLE table_1177 ("Province" text,"Swimsuit" text,"Evening Gown" text,"Interview" text,"Average" text) | SELECT "Province" FROM table_1177 WHERE "Swimsuit" = '8.43' |
Which Authority is set for Hauturu School? | CREATE TABLE table_name_23 (authority VARCHAR,name VARCHAR) | SELECT authority FROM table_name_23 WHERE name = "hauturu school" |
Which Base has a Name of .44 wcf? | CREATE TABLE table_name_2 (base VARCHAR,name VARCHAR) | SELECT base FROM table_name_2 WHERE name = ".44 wcf" |
List the name of technicians whose team is not 'NYY', and count them by a bar chart, rank x axis in ascending order. | CREATE TABLE repair (repair_ID int,name text,Launch_Date text,Notes text)CREATE TABLE repair_assignment (technician_id int,repair_ID int,Machine_ID int)CREATE TABLE machine (Machine_ID int,Making_Year int,Class text,Team text,Machine_series text,value_points real,quality_rank int)CREATE TABLE technician (technician_id ... | SELECT Name, COUNT(Name) FROM technician WHERE Team <> "NYY" GROUP BY Name ORDER BY Name |
What is the nationality of the ship when the principle victims are civilians? | CREATE TABLE table_79837 ("Estimate" real,"Name" text,"Nat." text,"Ship Type" text,"Principal victims" text,"Date" text) | SELECT "Nat." FROM table_79837 WHERE "Principal victims" = 'civilians' |
what was the name of the drug that until 57 months ago patient 72107 was last prescribed? | CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,disch... | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 72107) AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-57 month') ORDER BY prescriptions.startdate DESC LIMIT 1 |
What is Score, when Song is ? | CREATE TABLE table_40380 ("Index" text,"Name" text,"Song" text,"Group Song" text,"Score" text) | SELECT "Score" FROM table_40380 WHERE "Song" = '第九夜' |
provide the number of patients whose admission type is elective and item id is 51256. | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.itemid = "51256" |
Which Tournament was played in NH in 2011? | CREATE TABLE table_name_38 (tournament VARCHAR) | SELECT tournament FROM table_name_38 WHERE 2011 = "nh" |
In how many different years did schools located in Logan Township, Pennsylvania join the Conference? | CREATE TABLE table_23184 ("Institution" text,"Location" text,"Nickname" text,"Founded" real,"Type" text,"Enrollment" real,"Joined" real) | SELECT COUNT("Joined") FROM table_23184 WHERE "Location" = 'Logan Township, Pennsylvania' |
Which tournament's 2001 and 2006s were a? | CREATE TABLE table_37947 ("Tournament" text,"1998" text,"1999" text,"2000" text,"2001" text,"2002" text,"2003" text,"2004" text,"2005" text,"2006" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text) | SELECT "Tournament" FROM table_37947 WHERE "2001" = 'a' AND "2006" = 'a' |
Who are the nominees who were nominated for either of the Bob Fosse or Cleavant Derricks awards, and count them by a pie chart | CREATE TABLE musical (Musical_ID int,Name text,Year int,Award text,Category text,Nominee text,Result text)CREATE TABLE actor (Actor_ID int,Name text,Musical_ID int,Character text,Duration text,age int) | SELECT Nominee, COUNT(Nominee) FROM musical WHERE Award = "Tony Award" OR Award = "Cleavant Derricks" GROUP BY Nominee |
Name the landesliga nord for freier tus regensburg | CREATE TABLE table_20181270_3 (landesliga_nord VARCHAR,landesliga_mitte VARCHAR) | SELECT landesliga_nord FROM table_20181270_3 WHERE landesliga_mitte = "Freier TuS Regensburg" |
Show me the comparison of the total number of every ship type with a bar graph, and display in desc by the Y-axis. | CREATE TABLE ship (Ship_ID int,Name text,Type text,Nationality text,Tonnage int)CREATE TABLE mission (Mission_ID int,Ship_ID int,Code text,Launched_Year int,Location text,Speed_knots int,Fate text) | SELECT Type, COUNT(Type) FROM ship GROUP BY Type ORDER BY COUNT(Type) DESC |
Which record has a Loss of eichhorn (8-5)? | CREATE TABLE table_68230 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Record" text) | SELECT "Record" FROM table_68230 WHERE "Loss" = 'eichhorn (8-5)' |
what was the top three diagnosis with the highest four year mortality rate? | CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom 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 text,charttim... | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t4.icd9_code FROM (SELECT t3.icd9_code, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.icd9_code, 100 - SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t2.chartt... |
Do all of Prof. James Kosinski 's classes meet on Friday ? | CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE program_course (program_id int,course_id int,workload int,category varchar)CREATE TABLE course_offering (offering_id int,course_id int,semester int,secti... | SELECT COUNT(*) = 0 FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE course_offering.friday = ... |
count the number of patients whose admission location is transfer from hosp/extram and primary disease is squamous cell carcinoma oral tongue/sda? | 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 text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.diagnosis = "SQUAMOUS CELL CARCINOMA ORAL TONGUE/SDA" |
Which driver earned 32 points from the Andretti Green team? | CREATE TABLE table_name_91 (driver VARCHAR,team VARCHAR,points VARCHAR) | SELECT driver FROM table_name_91 WHERE team = "andretti green" AND points = "32" |
give me the number of patients whose age is less than 89 and days of hospital stay is greater than 34? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethni... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "89" AND demographic.days_stay > "34" |
how many of the patients aged below 89 received drug via pb route? | 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 text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "89" AND prescriptions.route = "PB" |
jow many seasons with the number of division 4 | CREATE TABLE table_204_738 (id number,"season" number,"level" text,"division" text,"section" text,"position" text,"movements" text) | SELECT COUNT("season") FROM table_204_738 WHERE "division" = 4 |
what was the number of hospitalized patients? | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,g... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.hospitaldischargetime IS NULL |
What is the earliest year that had under 26 points and a toyota v8 engine? | CREATE TABLE table_name_99 (year INTEGER,engine VARCHAR,points VARCHAR) | SELECT MIN(year) FROM table_name_99 WHERE engine = "toyota v8" AND points < 26 |
Bronze of 22 has what average silver? | CREATE TABLE table_35263 ("Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT AVG("Silver") FROM table_35263 WHERE "Bronze" = '22' |
Top posts with tag html (test). | CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Ta... | SELECT Posts.Id AS "post_link", ViewCount, AnswerCount, FavoriteCount, Tags, Score FROM Posts WHERE ClosedDate IS NULL AND Tags LIKE '%maven%' ORDER BY ViewCount DESC LIMIT 500 |
What series was directed by Frank Tashlin and has the production number, 8053? | CREATE TABLE table_name_28 (series VARCHAR,director VARCHAR,production_num VARCHAR) | SELECT series FROM table_name_28 WHERE director = "frank tashlin" AND production_num = "8053" |
Which physician was trained in the procedure that costs the most. | CREATE TABLE appointment (appointmentid number,patient number,prepnurse number,physician number,start time,end time,examinationroom text)CREATE TABLE block (blockfloor number,blockcode number)CREATE TABLE procedures (code number,name text,cost number)CREATE TABLE medication (code number,name text,brand text,description... | SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1 |
Who was the writer of the episode title 'Divine Intervention'? | CREATE TABLE table_30041 ("Episode No." real,"Series No." real,"Episode" text,"Director" text,"Writer(s)" text,"Original airdate" text,"Viewers (millions)" text) | SELECT "Writer(s)" FROM table_30041 WHERE "Episode" = 'Divine Intervention' |
how many times do patient 51858's urine out foley come out on this month/30. | CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)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,... | SELECT COUNT(*) 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 = 51858)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine out foley' A... |
What are the names of photos taken with the lens brand 'Sigma' or 'Olympus'? | CREATE TABLE camera_lens (id number,brand text,name text,focal_length_mm number,max_aperture number)CREATE TABLE mountain (id number,name text,height number,prominence number,range text,country text)CREATE TABLE photos (id number,camera_lens_id number,mountain_id number,color text,name text) | SELECT T1.name FROM camera_lens AS T1 JOIN photos AS T2 ON T2.camera_lens_id = T1.id WHERE T1.brand = 'Sigma' OR T1.brand = 'Olympus' |
What is the distribution of views for users?. | CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text... | SELECT nested.view_bins, COUNT(nested.view_bins) AS COUNT FROM (SELECT ROUND(Views / 100, 2) * 100 AS view_bins FROM Users) AS nested GROUP BY nested.view_bins ORDER BY nested.view_bins |
Generalist Badge, Progress toward -- with improved sort. Of the top 40 tags, how many do I have a score of 15 in?
Need 15 score, or better, in at least 20 of the top 40 tags, to get the badge. | CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,Las... | WITH tags40 AS (SELECT TagId, COUNT(*) AS postCount FROM PostTags GROUP BY TagId ORDER BY COUNT(*) DESC LIMIT 40), answers AS (SELECT Score, ParentId FROM Posts WHERE CommunityOwnedDate IS NULL AND PostTypeId = 2 AND OwnerUserId = '##userid##') SELECT * FROM answers AS a INNER JOIN PostTags AS pt ON pt.PostId = a.Paren... |
What was South Melbourne's home team score? | CREATE TABLE table_32572 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Home team score" FROM table_32572 WHERE "Home team" = 'south melbourne' |
For those records from the products and each product's manufacturer, a bar chart shows the distribution of headquarter and the sum of price , and group by attribute headquarter. | 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) | SELECT Headquarter, SUM(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter |
indicate the monthly maximum dose of volume (ml) milrinone that patient 007-4322 has received since 1038 days ago. | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd... | SELECT MAX(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-4322')) AND intakeoutput.celllabel = 'volume... |
What courses are useful precursors to GERMAN 127 ? | 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 TABLE student (student_id int,lastname varchar,firstname varcha... | SELECT DISTINCT advisory_requirement FROM course WHERE department = 'GERMAN' AND number = 127 |
Who's the Socialist Labor ticket with a Republican ticket of cuthbert w. pound? | CREATE TABLE table_39757 ("Office" text,"Democratic ticket" text,"Republican ticket" text,"Law Preservation ticket" text,"Socialist ticket" text,"Socialist Labor ticket" text) | SELECT "Socialist Labor ticket" FROM table_39757 WHERE "Republican ticket" = 'cuthbert w. pound' |
At what venue did the home team score 12.19 (91)? | CREATE TABLE table_32846 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Venue" FROM table_32846 WHERE "Home team score" = '12.19 (91)' |
What are the election date for elections held in the province of Albacete? | CREATE TABLE table_26362472_1 (election_date VARCHAR,province VARCHAR) | SELECT election_date FROM table_26362472_1 WHERE province = "Albacete" |
Users with greatest fraction of CW answers. | CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId numb... | SELECT COUNT(*), SUM(CASE WHEN CommunityOwnedDate IS NULL THEN 0 ELSE 1 END), OwnerUserId FROM Posts GROUP BY OwnerUserId |
what is gender and primary disease of subject id 1121? | 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)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime tex... | SELECT demographic.gender, demographic.diagnosis FROM demographic WHERE demographic.subject_id = "1121" |
when did the last time patient 012-4131 had the minimum respiration on 11/24/this year? | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid numbe... | 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 = '012-4131')) AND NOT vitalperiodic.respiration IS NU... |
What is the most households with a median household income of $54,086 with less than 231,236 in population? | CREATE TABLE table_5142 ("County" text,"Per capita income" text,"Median household income" text,"Median family income" text,"Population" real,"Number of households" real) | SELECT MAX("Number of households") FROM table_5142 WHERE "Median household income" = '$54,086' AND "Population" < '231,236' |
how many patients have received a ck-mb index test since 2101? | CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TAB... | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'ck-mb index') AND STRFTIME('%y', labevents.charttime) >= '2101') |
what was the last year the tv show lynch aired ? | CREATE TABLE table_204_871 (id number,"ano" text,"title" text,"role" text,"channel" text,"notes" text) | SELECT MAX("ano") FROM table_204_871 |
What is the number for the guanay municipality when combaya municipality is 0? | CREATE TABLE table_27405 ("Language" text,"Sorata Municipality" text,"Guanay Municipality" text,"Tacacoma Municipality" text,"Quiabaya Municipality" text,"Combaya Municipality" text,"Tipuani Municipality" text,"Mapiri Municipality" text,"Teoponte Municipality" text) | SELECT "Guanay Municipality" FROM table_27405 WHERE "Combaya Municipality" = '0' |
what is the person there the numbers is 2343 | CREATE TABLE table_28498999_6 (player VARCHAR,points VARCHAR) | SELECT player FROM table_28498999_6 WHERE points = 2343 |
Name the volume line for number 8 | CREATE TABLE table_19534677_1 (volume_line VARCHAR,_number VARCHAR) | SELECT volume_line FROM table_19534677_1 WHERE _number = 8 |
how many patients have received aortocor bypas-1 cor art within 2 months after having previously received cont inv mec ven <96 hrs? | 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 time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,ro... | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'cont inv me... |
what is the drug patient 002-44624 was prescribed for the first time during the last hospital visit via j tube route? | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,... | SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-44624' AND NOT patient.hospitaldischargetime IS NULL ORDER BY p... |
What is the lowest year for the game called The Elder Scrolls v: Skyrim? | CREATE TABLE table_name_99 (year INTEGER,game VARCHAR) | SELECT MIN(year) FROM table_name_99 WHERE game = "the elder scrolls v: skyrim" |
questions tagged qt over the years. | CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number,ApprovalDate time,ApprovalModeratorId number,DeactivationDat... | SELECT YEAR(CreationDate) AS "year", SUM(CASE WHEN PostHistoryTypeId = 3 THEN 1 ELSE 0 END) AS InitialTags, SUM(CASE WHEN PostHistoryTypeId = 6 THEN 1 ELSE 0 END) AS EditedTags, SUM(1) AS TotalQuestionsWithTag FROM PostHistory WHERE PostHistoryTypeId IN (3, 6) AND 'text' LIKE '%<##tag##>%' GROUP BY YEAR(CreationDate) |
how many sections does each course has?, and could you list x axis in descending order? | CREATE TABLE ENROLL (CLASS_CODE varchar(5),STU_NUM int,ENROLL_GRADE varchar(50))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 in... | SELECT CRS_CODE, COUNT(*) FROM CLASS GROUP BY CRS_CODE ORDER BY CRS_CODE DESC |
count the number of patients whose year of death is less than or equal to 2168 and procedure icd9 code is 14? | 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)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,sho... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2168.0" AND procedures.icd9_code = "14" |
For those dates that have the 5 highest cloud cover rates, please bin the date into weekdays interval and compute their total cloud cover, and show total number in descending order. | CREATE TABLE trip (id INTEGER,duration INTEGER,start_date TEXT,start_station_name TEXT,start_station_id INTEGER,end_date TEXT,end_station_name TEXT,end_station_id INTEGER,bike_id INTEGER,subscription_type TEXT,zip_code INTEGER)CREATE TABLE station (id INTEGER,name TEXT,lat NUMERIC,long NUMERIC,dock_count INTEGER,city T... | SELECT date, SUM(cloud_cover) FROM weather ORDER BY SUM(cloud_cover) DESC |
when was the first time in 01/this year that patient 018-99743 was prescribed mupirocin 2 % oint 1 g syringe and albuterol/ipratropium at the same time? | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid numbe... | SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'mupirocin 2 % oint 1 g syringe' AND patient.uniquepid = '018-99743' AND DATETIME(medication.drugstarttime, 'start of year... |
what are the three most frequently prescribed drugs? | CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid numb... | SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication GROUP BY medication.drugname) AS t1 WHERE t1.c1 <= 3 |
what is the average year when the title is baka to test to sh kanj ? | CREATE TABLE table_9570 ("Year" real,"Character" text,"Title" text,"Author" text,"Artist" text,"Imprint" text) | SELECT AVG("Year") FROM table_9570 WHERE "Title" = 'baka to test to shōkanjū' |
How many weeks did the single that entered the charts 14 september 2002 stay on the charts ? | CREATE TABLE table_69948 ("Title" text,"Entered chart (UK)" text,"Peak position (UK)" real,"Weeks on Chart (UK)" real,"Sent to CBeebies Album" text) | SELECT COUNT("Weeks on Chart (UK)") FROM table_69948 WHERE "Entered chart (UK)" = '14 september 2002' |
What is the record at the opponent's venue against the team for which the record for the last 5 meetings is mu, 4-1 and the record at the neutral site is tied, 0-0? | CREATE TABLE table_16201038_4 (at_opponents_venue VARCHAR,last_5_meetings VARCHAR,at_neutral_site VARCHAR) | SELECT at_opponents_venue FROM table_16201038_4 WHERE last_5_meetings = "MU, 4-1" AND at_neutral_site = "Tied, 0-0" |
In which round was Jerry Butler chosen? | CREATE TABLE table_name_58 (round VARCHAR,player VARCHAR) | SELECT round FROM table_name_58 WHERE player = "jerry butler" |
what is the number of total gold medals awarded ? | CREATE TABLE table_203_548 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number) | SELECT SUM("gold") FROM table_203_548 |
Who lost to moyer (9 4)? | CREATE TABLE table_51469 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text) | SELECT "Opponent" FROM table_51469 WHERE "Loss" = 'moyer (9–4)' |
What is Prize, when Season is '2'? | CREATE TABLE table_name_56 (prize VARCHAR,season VARCHAR) | SELECT prize FROM table_name_56 WHERE season = "2" |
what is 1980 when 1978 is 2.3? | CREATE TABLE table_76816 ("1976" text,"1977" text,"1978" text,"1979" text,"1980" text) | SELECT "1980" FROM table_76816 WHERE "1978" = '2.3' |
How many times was there a record of 49-15-11? | CREATE TABLE table_23308178_9 (attendance VARCHAR,record VARCHAR) | SELECT COUNT(attendance) FROM table_23308178_9 WHERE record = "49-15-11" |
what is the number of patients whose insurance is private and year of birth is less than 2152? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)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 ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.dob_year < "2152" |
How many faculty members do we have for each faculty rank Show bar chart, I want to list in asc by the Y. | CREATE TABLE Faculty (FacID INTEGER,Lname VARCHAR(15),Fname VARCHAR(15),Rank VARCHAR(15),Sex VARCHAR(1),Phone INTEGER,Room VARCHAR(5),Building VARCHAR(13))CREATE TABLE Participates_in (stuid INTEGER,actid INTEGER)CREATE TABLE Activity (actid INTEGER,activity_name varchar(25))CREATE TABLE Student (StuID INTEGER,LName VA... | SELECT Rank, COUNT(*) FROM Faculty GROUP BY Rank ORDER BY COUNT(*) |
what album is 4:30 long | CREATE TABLE table_name_95 (album VARCHAR,length VARCHAR) | SELECT album FROM table_name_95 WHERE length = "4:30" |
What was spent per voter when total amount spent was 210,280,000? | CREATE TABLE table_24773 ("Candidate (Party)" text,"Amount raised (PHP)" text,"Amount spent (PHP)" text,"Votes" real,"Spent per vote (PHP)" text,"Spent per voter (PHP)" text) | SELECT "Spent per voter ( PHP )" FROM table_24773 WHERE "Amount spent ( PHP )" = '210,280,000' |
what is the partnering name above chanelle scheepers ? | CREATE TABLE table_204_94 (id number,"outcome" text,"date" text,"tournament" text,"surface" text,"partnering" text,"opponent in the final" text,"score in the final" text) | SELECT "partnering" FROM table_204_94 WHERE id = (SELECT id FROM table_204_94 WHERE "partnering" = 'chanelle scheepers') - 1 |
What was the score of the game against Milwaukee? | CREATE TABLE table_name_9 (score VARCHAR,visitor VARCHAR) | SELECT score FROM table_name_9 WHERE visitor = "milwaukee" |
How many millions of U.S. viewers watched the episode directed by Rob Bailey and written by Pam Veasey? | CREATE TABLE table_72318 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"U.S. viewers (millions)" text) | SELECT "U.S. viewers (millions)" FROM table_72318 WHERE "Directed by" = 'Rob Bailey' AND "Written by" = 'Pam Veasey' |
Show the musical nominee with award 'Bob Fosse' or 'Cleavant Derricks', and count them by a bar chart, display by the x-axis in asc please. | CREATE TABLE actor (Actor_ID int,Name text,Musical_ID int,Character text,Duration text,age int)CREATE TABLE musical (Musical_ID int,Name text,Year int,Award text,Category text,Nominee text,Result text) | SELECT Nominee, COUNT(Nominee) FROM musical WHERE Award = "Tony Award" OR Award = "Cleavant Derricks" GROUP BY Nominee ORDER BY Nominee |
What is the smallest decile with an Area of otumoetai? | CREATE TABLE table_66697 ("Name" text,"Gender" text,"Area" text,"Authority" text,"Decile" real) | SELECT MIN("Decile") FROM table_66697 WHERE "Area" = 'otumoetai' |
What is the relationship between School_ID and All_Games_Percent , and group by attribute All_Neutral? | CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Percent int,All_Home text,All_Road text,All_Neutral text)CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,En... | SELECT School_ID, All_Games_Percent FROM basketball_match GROUP BY All_Neutral |
I am looking for any 500 -level courses in the Fall or Winter term . | CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE program_course (program_id int,course_id int,workload int,category varchar)CREATE TABLE gsi (course_offering_id int,student_id int)CREATE T... | SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE ((semester.semester = 'FA' AND semester.year = 2016) OR (semester.semester = 'WN' AND semester.year = 2017)) AND course.course_id = course_offering.course_id AND course.department = 'department0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.