instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
return me the number of organizations in Databases area . | CREATE TABLE publication_keyword (kid int,pid int)CREATE TABLE organization (continent varchar,homepage varchar,name varchar,oid int)CREATE TABLE domain (did int,name varchar)CREATE TABLE cite (cited int,citing int)CREATE TABLE journal (homepage varchar,jid int,name varchar)CREATE TABLE conference (cid int,homepage var... | SELECT COUNT(DISTINCT (organization.name)) FROM author, domain, domain_author, organization WHERE domain_author.aid = author.aid AND domain.did = domain_author.did AND domain.name = 'Databases' AND organization.oid = author.oid |
what are the five year survival rate of fetal/neonatal jaund nos patients who were prescribed with morphine sulfate? | 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,short_title text,long_title text)CREATE TABLE admissions (row_id numb... | SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 5 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.subject_id, t2.charttime FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd... |
Which season had 10 draws? | CREATE TABLE table_38794 ("Season" text,"Team" text,"Wins" text,"Losses" text,"Draws" text) | SELECT "Season" FROM table_38794 WHERE "Draws" = '10' |
Which country is the airport that has the highest altitude located in? | CREATE TABLE airports (country VARCHAR,elevation VARCHAR) | SELECT country FROM airports ORDER BY elevation DESC LIMIT 1 |
What Winning team has 22 July as a Date? | CREATE TABLE table_name_79 (winning_team VARCHAR,date VARCHAR) | SELECT winning_team FROM table_name_79 WHERE date = "22 july" |
Do I need UKR 351 to graduate ? | 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 varchar,friday varchar,saturday varchar,sunday varchar,has_final_project varchar,has_final_exam varchar,textbook varchar,class_address varch... | SELECT COUNT(*) > 0 FROM course, program_course WHERE course.department = 'UKR' AND course.number = 351 AND program_course.category LIKE '%Core%' AND program_course.course_id = course.course_id |
what are the number of patients who were admitted to hospital in a year before? | CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE admissions (row_id number,subject_id number,... | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') |
What is the figure for December 27 for ang tanging ina mo (last na 'to!)? | CREATE TABLE table_29217650_1 (december_27 VARCHAR,movies VARCHAR) | SELECT december_27 FROM table_29217650_1 WHERE movies = "Ang Tanging Ina Mo (Last na 'To!)" |
What is the score with a time at 18:00 and a score for set 3 of 13 25? | CREATE TABLE table_49822 ("Date" text,"Time" text,"Score" text,"Set 1" text,"Set 2" text,"Set 3" text,"Total" text) | SELECT "Score" FROM table_49822 WHERE "Time" = '18:00' AND "Set 3" = '13–25' |
Posts with links to files with particular extension (by CreationDate, only body). | 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 number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Tags text,Ans... | SELECT Body FROM Posts WHERE Body LIKE '%http%##ext?jpg##%' AND CreationDate >= '##Date1?2019-01-01##' AND CreationDate <= '##Date2?2020-01-01##' ORDER BY Id |
What is the name and country of origin for each artist who has released a song with a resolution higher than 900? | CREATE TABLE genre (g_name text,rating text,most_popular_in text)CREATE TABLE artist (artist_name text,country text,gender text,preferred_genre text)CREATE TABLE files (f_id number,artist_name text,file_size text,duration text,formats text)CREATE TABLE song (song_name text,artist_name text,country text,f_id number,genr... | SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.resolution > 900 GROUP BY T2.artist_name HAVING COUNT(*) >= 1 |
What years did the player ranked less than 8 and had 447 matches play? | CREATE TABLE table_name_83 (years VARCHAR,rank VARCHAR,matches VARCHAR) | SELECT years FROM table_name_83 WHERE rank < 8 AND matches = 447 |
database schema for questions and answers. | 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 * FROM Posts WHERE Id BETWEEN 6000 AND 6500 |
count the number of patients whose gender is f and year of birth is less than 2087? | 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.gender = "F" AND demographic.dob_year < "2087" |
How fast do my questions get answered?. | 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)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE Tags (Id number,Tag... | SELECT CAST((JULIANDAY(AnswerDate) - JULIANDAY(SQ.QuestionDate)) * 1440.0 AS INT) AS Diff FROM (SELECT Questions.Id, Questions.CreationDate AS QuestionDate, MIN(Answers.CreationDate) AS AnswerDate FROM Posts AS Questions INNER JOIN Posts AS Answers ON Questions.Id = Answers.ParentId WHERE Questions.PostTypeId = 1 AND Q... |
What is the record for April 21? | CREATE TABLE table_37421 ("Date" text,"Opponent" text,"Score" text,"Attendance" real,"Record" text) | SELECT "Record" FROM table_37421 WHERE "Date" = 'april 21' |
A User Rank In A Given Tag. | CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE PostNotices (Id n... | SELECT T2.Rank, T2.Id AS "user_link", T2.UpVotes AS "total_up_votes" FROM (SELECT ROW_NUMBER() OVER (ORDER BY T.UpVotes DESC) AS Rank, T.Id, T.UpVotes FROM (SELECT u.Id, COUNT(*) AS UpVotes 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.P... |
Give me a bar chart for the average of team id of each acc road, and sort in ascending by the x-axis. | 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 ACC_Road, AVG(Team_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY ACC_Road |
What was the margin of the Masters Tournament? | CREATE TABLE table_17937 ("Year" text,"Championship" text,"54 holes" text,"Winning score" text,"Margin" text,"Runner(s)-up" text) | SELECT "Margin" FROM table_17937 WHERE "Championship" = 'Masters Tournament' |
what was their award at the janison short sharp film festival ? | CREATE TABLE table_204_337 (id number,"festival" text,"year" number,"award" text,"nominee" text,"result" text) | SELECT "award" FROM table_204_337 WHERE "festival" = 'janison short sharp film festival' |
how many patients whose admission type is urgent and lab test name is amylase, body fluid? | 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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text... | 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.label = "Amylase, Body Fluid" |
What is the sum of the [3 H]CFT with an N D less than 393.8 and a [3H] paroxetine of 1045 (45)? | CREATE TABLE table_65228 ("[ 3 H]CFT" real,"[ 3 H]Nisoxetine" text,"[ 3 H]Paroxetine" text,"N \u00f7 D" real,"S \u00f7 D" real) | SELECT SUM("[ 3 H]CFT") FROM table_65228 WHERE "N \u00f7 D" < '393.8' AND "[ 3 H]Paroxetine" = '1045 (45)' |
Which Wednesday has a Monday of getsuy bi? | CREATE TABLE table_name_46 (wednesday VARCHAR,monday VARCHAR) | SELECT wednesday FROM table_name_46 WHERE monday = "月曜日 getsuyōbi" |
Who was the home team for tie number 11? | CREATE TABLE table_name_26 (home_team VARCHAR,tie_no VARCHAR) | SELECT home_team FROM table_name_26 WHERE tie_no = "11" |
Which lowest position has goals against smaller than 78, Points of 42-2, and Wins larger than 15? | CREATE TABLE table_name_63 (position INTEGER,wins VARCHAR,goals_against VARCHAR,points VARCHAR) | SELECT MIN(position) FROM table_name_63 WHERE goals_against < 78 AND points = "42-2" AND wins > 15 |
What is the CBS airdate of the episode with a number under 70 with a USA airdate of 1 April 2005? | CREATE TABLE table_name_26 (cbs_airdate VARCHAR,episode VARCHAR,airdate__usa_ VARCHAR) | SELECT cbs_airdate FROM table_name_26 WHERE episode < 70 AND airdate__usa_ = "1 april 2005" |
Name the height for the player born in 1981 | CREATE TABLE table_23670057_6 (height__m_ VARCHAR,year_born VARCHAR) | SELECT height__m_ FROM table_23670057_6 WHERE year_born = 1981 |
count the number of patients who had received a microbiological test of the bronchoalveolar lavage since 2100. | 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 TABLE labevents (row_id number,subject_id number,hadm_id number,item... | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT microbiologyevents.hadm_id FROM microbiologyevents WHERE microbiologyevents.spec_type_desc = 'bronchoalveolar lavage' AND STRFTIME('%y', microbiologyevents.charttime) >= '2100') |
Which competition had a year of 2010 with Snatch weight of 185kg? | CREATE TABLE table_name_23 (competition VARCHAR,year VARCHAR,snatch VARCHAR) | SELECT competition FROM table_name_23 WHERE year = 2010 AND snatch = "185kg" |
How many employees are living in Canada? | CREATE TABLE employees (country VARCHAR) | SELECT COUNT(*) FROM employees WHERE country = "Canada" |
What is the lowest Rank for the Name, 'area of permanent crops', Out of a number smaller than 181? | CREATE TABLE table_name_66 (rank INTEGER,name VARCHAR,out_of VARCHAR) | SELECT MIN(rank) FROM table_name_66 WHERE name = "area of permanent crops" AND out_of < 181 |
5000 newest answers to bad questions. | CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREA... | SELECT CASE WHEN q.AcceptedAnswerId = a.Id THEN 1 ELSE 0 END AS "accepted", a.Score AS "score", a.Id AS "post_link", q.ClosedDate AS "date_closed", a.CreationDate AS "date_posted" FROM Posts AS a INNER JOIN Posts AS q ON a.ParentId = q.Id WHERE NOT q.ClosedDate IS NULL AND NOT EXISTS(SELECT 1 FROM PostHistory WHERE Pos... |
What rank is the parish with 482.81 km^2? | CREATE TABLE table_171356_2 (census_ranking VARCHAR,area_km_2 VARCHAR) | SELECT census_ranking FROM table_171356_2 WHERE area_km_2 = "482.81" |
What's the highest grid of Ronnie Bremer, who had more than 18 points? | CREATE TABLE table_35695 ("Driver" text,"Team" text,"Laps" real,"Time/Retired" text,"Grid" real,"Points" real) | SELECT MAX("Grid") FROM table_35695 WHERE "Driver" = 'ronnie bremer' AND "Points" > '18' |
what was the first s/p cabg < 7 days diagnosis time of patient 015-16479 on their first hospital encounter? | 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 diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,... | SELECT diagnosis.diagnosistime FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-16479' AND NOT patient.hospitaldischargetime IS NULL ORDER BY... |
What city was the home team Tigre? | CREATE TABLE table_name_5 (city VARCHAR,home_team_s_ VARCHAR) | SELECT city FROM table_name_5 WHERE home_team_s_ = "tigre" |
List all the reviews by Michelle for Italian restaurant | CREATE TABLE business (bid int,business_id varchar,name varchar,full_address varchar,city varchar,latitude varchar,longitude varchar,review_count bigint,is_open tinyint,rating float,state varchar)CREATE TABLE tip (tip_id int,business_id varchar,text longtext,user_id varchar,likes int,year int,month varchar)CREATE TABLE... | SELECT review.text FROM business, category AS CATEGORY_0, category AS CATEGORY_1, review, user WHERE CATEGORY_0.business_id = business.business_id AND CATEGORY_0.category_name = 'Italian' AND CATEGORY_1.business_id = business.business_id AND CATEGORY_1.category_name = 'restaurant' AND review.business_id = business.busi... |
What is the average number of audience for festivals? | CREATE TABLE festival_detail (Num_of_Audience INTEGER) | SELECT AVG(Num_of_Audience) FROM festival_detail |
Wha argon has helium of 1.0000684? | CREATE TABLE table_name_54 (argon VARCHAR,helium VARCHAR) | SELECT argon FROM table_name_54 WHERE helium = "1.0000684" |
How many pateints younger than 74 years of age are tested with drug code neut? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "74" AND prescriptions.formulary_drug_cd = "NEUT" |
What is the lowest Draws, when Against is '1547', and when Wins is greater than 3? | CREATE TABLE table_61145 ("Golden Rivers" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real) | SELECT MIN("Draws") FROM table_61145 WHERE "Against" = '1547' AND "Wins" > '3' |
What home team scored 20.15 (135)? | CREATE TABLE table_4751 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Home team" FROM table_4751 WHERE "Home team score" = '20.15 (135)' |
List all mbit/s with profiles of 8b. | CREATE TABLE table_26427 ("Profile" text,"Bandwidth (MHz)" text,"Number of carriers" real,"Carrier bandwidth (kHz)" text,"Power (dBm)" text,"Max. downstream throughput (Mbit/s)" real) | SELECT "Max. downstream throughput ( Mbit/s )" FROM table_26427 WHERE "Profile" = '8b' |
A scatter chart shows the correlation between Team_ID and All_Games_Percent . | CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,Enrollment real,Nickname text,Primary_conference text)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_Perce... | SELECT Team_ID, All_Games_Percent FROM basketball_match |
What are the distinct years in which the competitions type is not 'Tournament'? | CREATE TABLE club (club_id number,name text,region text,start_year text)CREATE TABLE competition_result (competition_id number,club_id_1 number,club_id_2 number,score text)CREATE TABLE player (player_id number,name text,position text,club_id number,apps number,tries number,goals text,points number)CREATE TABLE club_ran... | SELECT DISTINCT year FROM competition WHERE competition_type <> "Tournament" |
give me the number of patients whose diagnoses icd9 code is 42789? | 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 procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.icd9_code = "42789" |
For the film titled 1997, what was the gross in Singapore? | CREATE TABLE table_name_3 (singapore_gross VARCHAR,title VARCHAR) | SELECT singapore_gross FROM table_name_3 WHERE title = "1997" |
How many flights for each origin city? Return a bar chart. | CREATE TABLE aircraft (aid number(9,0),name varchar2(30),distance number(6,0))CREATE TABLE certificate (eid number(9,0),aid number(9,0))CREATE TABLE flight (flno number(4,0),origin varchar2(20),destination varchar2(20),distance number(6,0),departure_date date,arrival_date date,price number(7,2),aid number(9,0))CREATE T... | SELECT origin, COUNT(origin) FROM flight GROUP BY origin ORDER BY origin |
Who had the pole position in Detroit? | CREATE TABLE table_27913160_3 (pole_position VARCHAR,race VARCHAR) | SELECT pole_position FROM table_27913160_3 WHERE race = "Detroit" |
has patient 83466 undergone any excise lg intestine les last year? | 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,discharge_location text,insurance text,language text,marital_status text,ethnicity text,age number)CREATE TABL... | SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'excise lg intestine les') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 83466) AND DATETIME(pro... |
tell me the top five most common output events until 2100? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE intakeoutput (intakeoutputid number,patientunitst... | SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%output%' AND STRFTIME('%y', intakeoutput.intakeoutputtime) <= '2100' GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 5 |
WHen joaqui mendoza is the name how long is the duration? | CREATE TABLE table_22781 ("Name" text,"Home or representative town or province" text,"Age" real,"Edition" text,"Total days in PBB House" real,"Duration" text,"Status" text) | SELECT "Duration" FROM table_22781 WHERE "Name" = 'Joaqui Mendoza' |
What is the prize money for Virginia? | CREATE TABLE table_11622496_1 (location VARCHAR) | SELECT 1 AS st_prize__$__ FROM table_11622496_1 WHERE location = "Virginia" |
Can I take 400 -level classes in the Fall or Winter term ? | CREATE TABLE course_tags_count (course_id int,clear_grading int,pop_quiz int,group_projects int,inspirational int,long_lectures int,extra_credit int,few_tests int,good_feedback int,tough_tests int,heavy_papers int,cares_for_students int,heavy_assignments int,respected int,participation int,heavy_reading int,tough_grade... | SELECT DISTINCT COURSEalias0.department, COURSEalias0.name, COURSEalias0.number, SEMESTERalias0.semester FROM (SELECT course_id FROM student_record WHERE earn_credit = 'Y' AND student_id = 1) AS DERIVED_TABLEalias0, course AS COURSEalias0, course_offering AS COURSE_OFFERINGalias0, semester AS SEMESTERalias0 WHERE ((SEM... |
Spain with a total of more than 4 medals is in what rank? | CREATE TABLE table_name_15 (rank VARCHAR,total VARCHAR,nation VARCHAR) | SELECT rank FROM table_name_15 WHERE total > 4 AND nation = "spain" |
how many assists did the top three have in total ? | CREATE TABLE table_204_575 (id number,"place" number,"position" text,"number" number,"name" text,"league one" number,"fa cup" number,"league cup" number,"football league trophy" number,"total" number) | SELECT SUM("total") FROM table_204_575 WHERE "place" <= 3 |
i would like to get the top four diagnosis that has the highest three year mortality rate. | 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 TABLE outputevents (row_id number,subject_id number,hadm_id number,i... | 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... |
Which 1988 has a 1982 of 104? | CREATE TABLE table_34848 ("Tournament" text,"1981" text,"1982" text,"1983" text,"1984" text,"1985" text,"1986" text,"1987" text,"1988" text,"1989" text) | SELECT "1988" FROM table_34848 WHERE "1982" = '104' |
in this year, what are the five most frequent drugs prescribed to male patients 40s within 2 months after having been diagnosed with crnry athrscl natve vssl? | CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime ... | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ... |
Give me the name and description of the location with code x. | CREATE TABLE documents_to_be_destroyed (document_id number,destruction_authorised_by_employee_id number,destroyed_by_employee_id number,planned_destruction_date time,actual_destruction_date time,other_details text)CREATE TABLE ref_document_types (document_type_code text,document_type_name text,document_type_description... | SELECT location_name, location_description FROM ref_locations WHERE location_code = "x" |
what name comes next fairfield ? | CREATE TABLE table_204_476 (id number,"name" text,"date built" number,"builder" text,"works no." number,"wheels" text,"cylinders" text,"notes" text,"withdrawn" number) | SELECT "name" FROM table_204_476 WHERE id = (SELECT id FROM table_204_476 WHERE "name" = 'fairfield') + 1 |
What is the average crowd size for Richmond home games? | CREATE TABLE table_53693 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT AVG("Crowd") FROM table_53693 WHERE "Home team" = 'richmond' |
Which Team has a Location Attendance of fedexforum 11,731? | CREATE TABLE table_name_4 (team VARCHAR,location_attendance VARCHAR) | SELECT team FROM table_name_4 WHERE location_attendance = "fedexforum 11,731" |
What Week 5 has a Week 1 of mysti sherwood? | CREATE TABLE table_name_10 (week_5 VARCHAR,week_1 VARCHAR) | SELECT week_5 FROM table_name_10 WHERE week_1 = "mysti sherwood" |
What time was the game with a record of 7-3? | CREATE TABLE table_name_96 (game_time VARCHAR,record VARCHAR) | SELECT game_time FROM table_name_96 WHERE record = "7-3" |
Users by the number of answers since a given date. | CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number... | SELECT p.OwnerUserId, COUNT(p.Id) AS "number_of_answers" FROM Posts AS p WHERE DATEDIFF(day, p.CreationDate, GETDATE()) <= 90 GROUP BY p.OwnerUserId ORDER BY COUNT(p.Id) DESC |
What is the first and last name of the faculty members who participated in at least one activity? For each of them, also show the number of activities they participated in. | CREATE TABLE faculty (facid number,lname text,fname text,rank text,sex text,phone number,room text,building text)CREATE TABLE activity (actid number,activity_name text)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE participates_in (st... | SELECT T1.fname, T1.lname, COUNT(*), T1.facid FROM faculty AS T1 JOIN faculty_participates_in AS T2 ON T1.facid = T2.facid GROUP BY T1.facid |
tell me the number of times they were in the division of honor . | CREATE TABLE table_204_636 (id number,"season" text,"tier" number,"division" text,"pos." text,"notes" text) | SELECT COUNT(*) FROM table_204_636 WHERE "division" = 'division de honor' |
Which Works number has a Builder of avonside engine company, and a Type of 4-6-0, and a Number smaller than 12, and a Date of december 1871? | CREATE TABLE table_name_76 (works_number VARCHAR,date VARCHAR,number VARCHAR,builder VARCHAR,type VARCHAR) | SELECT works_number FROM table_name_76 WHERE builder = "avonside engine company" AND type = "4-6-0" AND number < 12 AND date = "december 1871" |
For those employees who was hired before 2002-06-21, visualize a line chart about the change of employee_id over hire_date , and could you display in asc by the HIRE_DATE? | CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID d... | SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE |
Which policy type appears most frequently in the available policies? | CREATE TABLE available_policies (policy_id number,policy_type_code text,customer_phone text)CREATE TABLE first_notification_of_loss (fnol_id number,customer_id number,policy_id number,service_id number)CREATE TABLE services (service_id number,service_name text)CREATE TABLE claims (claim_id number,fnol_id number,effecti... | SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1 |
What country did Jonas Geirnaert direct a film in? | CREATE TABLE table_name_30 (country VARCHAR,director_s_ VARCHAR) | SELECT country FROM table_name_30 WHERE director_s_ = "jonas geirnaert" |
For all employees who have the letters D or S in their first name, show me about the distribution of job_id and the sum of manager_id , and group by attribute job_id in a bar chart, list by the y axis in descending. | CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))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_... | SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID) DESC |
Which round's position is according to official website? | CREATE TABLE table_35026 ("Round" text,"Pick" text,"Player" text,"Position" text,"College" text) | SELECT "Round" FROM table_35026 WHERE "Position" = 'according to official website' |
on the current hospital encounter did patient 016-18575 excret any chest tube output: l lateral? | 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 medication (medicationid number,patientunitstayid number,drugname text,dos... | 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 = '016-18575' AND patient.hospitaldischargetime IS NULL)) AND intakeoutpu... |
A bar chart about how many different professors are there for the different schools?, and list y axis from high to low order. | CREATE TABLE COURSE (CRS_CODE varchar(10),DEPT_CODE varchar(10),CRS_DESCRIPTION varchar(35),CRS_CREDIT float(8))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),... | SELECT SCHOOL_CODE, COUNT(*) FROM DEPARTMENT AS T1 JOIN PROFESSOR AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.SCHOOL_CODE ORDER BY COUNT(*) DESC |
whats the last height of patient 013-33898 this month? | 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,hospitaladmitsource text,unitadmittime time,unitdischargetime tim... | SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-33898') AND NOT patient.admissionheight IS NULL AND DATETIME(patient.unitadmittime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', ... |
Which classes have more than two captains? | CREATE TABLE captain (captain_id number,name text,ship_id number,age text,class text,rank text)CREATE TABLE ship (ship_id number,name text,type text,built_year number,class text,flag text) | SELECT class FROM captain GROUP BY class HAVING COUNT(*) > 2 |
Anonymous feedback for a certain question and its answers. | CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,Is... | SELECT COUNT(P.Id) AS VoteCount, VT.Name AS VoteType, P.Id AS "post_link", P.Id, U.DisplayName, P.Score, P.CreationDate, P.LastActivityDate FROM PostFeedback AS PF JOIN Posts AS P ON P.Id = PF.PostId JOIN Users AS U ON U.Id = P.OwnerUserId JOIN VoteTypes AS VT ON PF.VoteTypeId = VT.Id WHERE PF.IsAnonymous = 1 AND (P.Id... |
When has Clark University joined the Conference? | CREATE TABLE table_1974782_1 (joined INTEGER,institution VARCHAR) | SELECT MAX(joined) FROM table_1974782_1 WHERE institution = "Clark University" |
history of severe hypoglycemia ( seizure ) | CREATE TABLE table_train_199 ("id" int,"t2dm" bool,"hemoglobin_a1c_hba1c" float,"renal_disease" bool,"diabetic" string,"hypoglycemia" bool,"diabetes" bool,"seizure_disorder" bool,"glaucoma" bool,"hypertension" bool,"age" float,"NOUSE" float) | SELECT * FROM table_train_199 WHERE hypoglycemia = 1 OR seizure_disorder = 1 |
bmi > 25 kg / m2 | CREATE TABLE table_train_158 ("id" int,"systolic_blood_pressure_sbp" int,"hemoglobin_a1c_hba1c" float,"moca_score" int,"diastolic_blood_pressure_dbp" int,"body_mass_index_bmi" float,"age" float,"NOUSE" float) | SELECT * FROM table_train_158 WHERE body_mass_index_bmi > 25 |
What is the house colour associated with the house name of Kupe? | CREATE TABLE table_1942683_1 (house_colour VARCHAR,house_name VARCHAR) | SELECT house_colour FROM table_1942683_1 WHERE house_name = "Kupe" |
A bar chart for what are the number of the dates of transactions with at least 100 share count or amount bigger than 100?, and sort by the Y from high to low. | CREATE TABLE Lots (lot_id INTEGER,investor_id INTEGER,lot_details VARCHAR(255))CREATE TABLE Transactions_Lots (transaction_id INTEGER,lot_id INTEGER)CREATE TABLE Transactions (transaction_id INTEGER,investor_id INTEGER,transaction_type_code VARCHAR(10),date_of_transaction DATETIME,amount_of_transaction DECIMAL(19,4),sh... | SELECT date_of_transaction, COUNT(date_of_transaction) FROM Transactions WHERE share_count >= 100 OR amount_of_transaction >= 100 ORDER BY COUNT(date_of_transaction) DESC |
How many games have been played when there are 13 wins and 45 goals were conceded? | CREATE TABLE table_name_58 (games_played VARCHAR,wins VARCHAR,goals_conceded VARCHAR) | SELECT games_played FROM table_name_58 WHERE wins = 13 AND goals_conceded = 45 |
Name the attendance for 4 january 2004 | CREATE TABLE table_name_72 (attendance VARCHAR,date VARCHAR) | SELECT attendance FROM table_name_72 WHERE date = "4 january 2004" |
When Anchero Pantaleone was the elector what is under nationality? | CREATE TABLE table_name_11 (nationality VARCHAR,elector VARCHAR) | SELECT nationality FROM table_name_11 WHERE elector = "anchero pantaleone" |
What is the average Bronze, when Total is 4, and when Silver is less than 2? | CREATE TABLE table_name_36 (bronze INTEGER,total VARCHAR,silver VARCHAR) | SELECT AVG(bronze) FROM table_name_36 WHERE total = 4 AND silver < 2 |
what is the english american name that the most people have ? | CREATE TABLE table_203_573 (id number,"name" text,"rank - 2000" number,"number" number,"country of origin" text,"england - 2001" text) | SELECT "name" FROM table_203_573 ORDER BY "number" DESC LIMIT 1 |
what was patient 95986 diagnosed with last time on the last hospital visit. | CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx ... | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT diagnoses_icd.icd9_code FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 95986 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime D... |
What is the rating of the episode with a rating/share of 0.9/4? | CREATE TABLE table_1710 ("Episode #" real,"US air date" text,"Rating" text,"Share" text,"Rating/Share (18\u201349)" text,"Viewers (millions)" text) | SELECT "Rating" FROM table_1710 WHERE "Rating/Share (18\u201349)" = '0.9/4' |
What is the acronym used for Beirut Arab University? | CREATE TABLE table_1160660_1 (acronym VARCHAR,university_name VARCHAR) | SELECT acronym FROM table_1160660_1 WHERE university_name = "Beirut Arab University" |
At what race does jim clark has a Pole position on the Circuit of monaco? | CREATE TABLE table_57913 ("Race" text,"Circuit" text,"Date" text,"Pole position" text,"Fastest lap" text,"Winning driver" text,"Constructor" text,"Tyre" text,"Report" text) | SELECT "Race" FROM table_57913 WHERE "Pole position" = 'jim clark' AND "Circuit" = 'monaco' |
Compare the total number of different product type codes, and I want to sort how many product type code from high to low order. | CREATE TABLE Locations (Location_ID INTEGER,Other_Details VARCHAR(255))CREATE TABLE Events (Event_ID INTEGER,Address_ID INTEGER,Channel_ID INTEGER,Event_Type_Code CHAR(15),Finance_ID INTEGER,Location_ID INTEGER)CREATE TABLE Parties_in_Events (Party_ID INTEGER,Event_ID INTEGER,Role_Code CHAR(15))CREATE TABLE Finances (F... | SELECT Product_Type_Code, COUNT(Product_Type_Code) FROM Products GROUP BY Product_Type_Code ORDER BY COUNT(Product_Type_Code) DESC |
What is the status of the London Aquatics Centre project at the time of production? | CREATE TABLE table_21996 ("No. in series" real,"No. in season" real,"Title" text,"Country" text,"Project" text,"Status at production" text,"Original air date" text) | SELECT "Status at production" FROM table_21996 WHERE "Project" = 'London Aquatics Centre' |
How many players are from each country Visualize by bar chart, list by the Y in asc. | CREATE TABLE match_season (Season real,Player text,Position text,Country int,Team int,Draft_Pick_Number int,Draft_Class text,College text)CREATE TABLE team (Team_id int,Name text)CREATE TABLE player (Player_ID int,Player text,Years_Played text,Total_WL text,Singles_WL text,Doubles_WL text,Team int)CREATE TABLE country ... | SELECT Country_name, COUNT(*) FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country GROUP BY T1.Country_name ORDER BY COUNT(*) |
show me the yearly minimum drain out #1 t tube of patient 72107 until 03/29/2102. | 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 TABLE icustays (row_id number,subject_id number,hadm_id number,icust... | SELECT MIN(outputevents.value) 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 = 72107)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'dra... |
is the arterial bp [systolic] of patient 31854's body second measured on the current icu visit less than the value first measured on the current icu visit? | CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)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 cost (row_id number,subject_id number,hadm_id number,event_type t... | SELECT (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 = 31854) AND icustays.outtime IS NULL) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_i... |
What was the opponent in the final when the score was 6 3, 2 6, 7 5? | CREATE TABLE table_name_69 (opponent_in_the_final VARCHAR,score VARCHAR) | SELECT opponent_in_the_final FROM table_name_69 WHERE score = "6–3, 2–6, 7–5" |
Please tell me the total star ratings of each movie title using a bar chart, and order bar in ascending order. | CREATE TABLE Movie (mID int,title text,year int,director text)CREATE TABLE Rating (rID int,mID int,stars int,ratingDate date)CREATE TABLE Reviewer (rID int,name text) | SELECT title, SUM(stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY title ORDER BY title |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.