instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
what is the total number of years ele opeloge was the samoa flag bearer at the olympics ? | CREATE TABLE table_204_986 (id number,"#" number,"event year" number,"season" text,"flag bearer" text) | SELECT COUNT("event year") FROM table_204_986 WHERE "flag bearer" = 'ele opeloge' |
What is the average crowd size when Collingwood is the away team? | CREATE TABLE table_74583 ("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_74583 WHERE "Away team" = 'collingwood' |
What is the smallest Against with a Date of 18/02/1989? | CREATE TABLE table_61815 ("Opposing Teams" text,"Against" real,"Date" text,"Venue" text,"Status" text) | SELECT MIN("Against") FROM table_61815 WHERE "Date" = '18/02/1989' |
what are the top three most common diagnoses of people in 60 or above until 2104? | CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_... | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age >= 60) ... |
What is the highest region number with a 499 population? | CREATE TABLE table_53052 ("Code" real,"Type" text,"Name" text,"Area (km 2)" real,"Population" real,"Regional County Municipality" text,"Region" real) | SELECT MAX("Region") FROM table_53052 WHERE "Population" = '499' |
How many titles were directed in series 79? | CREATE TABLE table_16782 ("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 COUNT("Directed by") FROM table_16782 WHERE "No. in series" = '79' |
In what venue was the 1978 FIFA world cup qualification played in? | CREATE TABLE table_11874 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text) | SELECT "Venue" FROM table_11874 WHERE "Competition" = '1978 fifa world cup qualification' |
Find the id of the order whose shipment tracking number is '3452'. | CREATE TABLE products (product_id number,product_name text,product_details text)CREATE TABLE shipment_items (shipment_id number,order_item_id number)CREATE TABLE order_items (order_item_id number,product_id number,order_id number,order_item_status text,order_item_details text)CREATE TABLE invoices (invoice_number numbe... | SELECT order_id FROM shipments WHERE shipment_tracking_number = "3452" |
where did they place the last season ? | CREATE TABLE table_204_532 (id number,"season" text,"tier" number,"division" text,"place" text) | SELECT "place" FROM table_204_532 ORDER BY "season" DESC LIMIT 1 |
what is discharge location and discharge time of subject name thomas nazario? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime te... | SELECT demographic.discharge_location, demographic.dischtime FROM demographic WHERE demographic.name = "Thomas Nazario" |
Name the average founded with joined less than 2008 | CREATE TABLE table_name_88 (founded INTEGER,joined INTEGER) | SELECT AVG(founded) FROM table_name_88 WHERE joined < 2008 |
Name the IHSAA class with county 18 delaware and tigers mascot | CREATE TABLE table_name_82 (ihsaa_class VARCHAR,_number___county VARCHAR,mascot VARCHAR) | SELECT ihsaa_class FROM table_name_82 WHERE _number___county = "18 delaware" AND mascot = "tigers" |
what was the difference in r & b ranking between come go with me and dance 4 me . ? | CREATE TABLE table_204_438 (id number,"year" number,"title" text,"album" text,"us r&b" number,"us pop" number,"us dance" number) | SELECT ABS((SELECT "us r&b" FROM table_204_438 WHERE "title" = '"come go with me"') - (SELECT "us r&b" FROM table_204_438 WHERE "title" = '"dance 4 me"')) |
What is Country, when Previous Team (League) is 'Kingston Frontenacs ( OHL )', and when Player is 'Anthony Stewart Category:Articles with hCards'? | CREATE TABLE table_name_45 (country VARCHAR,previous_team__league_ VARCHAR,player VARCHAR) | SELECT country FROM table_name_45 WHERE previous_team__league_ = "kingston frontenacs ( ohl )" AND player = "anthony stewart category:articles with hcards" |
Which goals/game ratio has fewer than 201 goals and fewer than 170 appearances? | CREATE TABLE table_41629 ("Name" text,"Career" text,"Goals" real,"Appearances" real,"Goals/Game Ratio" real) | SELECT "Goals/Game Ratio" FROM table_41629 WHERE "Goals" < '201' AND "Appearances" < '170' |
My suggested edit votes that got overruled. Provides links to the suggested edits that you voted on, where the outcome went against your vote. | CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDi... | SELECT edit.PostId, edit.Id AS "suggested_edit_link" FROM SuggestedEditVotes AS vote, SuggestedEdits AS edit WHERE vote.UserId = @UserId AND vote.SuggestedEditId = edit.Id AND (NOT edit.ApprovalDate IS NULL AND vote.VoteTypeId = 3 OR NOT edit.RejectionDate IS NULL AND vote.VoteTypeId = 2) |
For those employees who do not work in departments with managers that have ids between 100 and 200, return a line chart about the change of salary over hire_date , could you sort by the x axis in asc please? | CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))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,JO... | SELECT HIRE_DATE, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY HIRE_DATE |
What was the minimum population in 2011? | CREATE TABLE table_2328113_1 (population__2011_ INTEGER) | SELECT MIN(population__2011_) FROM table_2328113_1 |
What are the date of ceremony of music festivals with category 'Best Song' and result 'Awarded'? | CREATE TABLE music_festival (Date_of_ceremony VARCHAR,Category VARCHAR,RESULT VARCHAR) | SELECT Date_of_ceremony FROM music_festival WHERE Category = "Best Song" AND RESULT = "Awarded" |
What is the Country of the Player in Place 1? | CREATE TABLE table_59980 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text) | SELECT "Country" FROM table_59980 WHERE "Place" = '1' |
users by location (stack overflow). | CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDa... | SELECT u.Id, u.DisplayName, u.Reputation, u.WebsiteUrl, u.Age, u.LastAccessDate, u.Location FROM Users AS u WHERE (LOWER(u.Location) LIKE LOWER('##Location:string##')) OR (LOWER(u.Location) LIKE LOWER('##AltLocation:string##')) OR (LOWER(u.Location) LIKE LOWER('##AltLocation2:string##')) ORDER BY u.Reputation DESC LIMI... |
Which tournament was played on 12 February 2001? | CREATE TABLE table_41301 ("Date" text,"Tournament" text,"Surface" text,"Partnering" text,"Opponent in the final" text,"Score" text) | SELECT "Tournament" FROM table_41301 WHERE "Date" = '12 february 2001' |
Who is the leading scorer when they were at home of the Clippers? | CREATE TABLE table_56788 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Leading scorer" text,"Attendance" real,"Record" text) | SELECT "Leading scorer" FROM table_56788 WHERE "Home" = 'clippers' |
What is the Prize, when the Event is Ept Deauville? | CREATE TABLE table_name_10 (prize VARCHAR,event VARCHAR) | SELECT prize FROM table_name_10 WHERE event = "ept deauville" |
What is the lowest density of alessandria where the area is bigger than 16.02 and altitude is less than 116? | CREATE TABLE table_34022 ("Rank" text,"City" text,"Population" real,"Area (km 2)" real,"Density (inhabitants/km 2)" real,"Altitude (mslm)" real) | SELECT MIN("Density (inhabitants/km 2 )") FROM table_34022 WHERE "Area (km 2 )" > '16.02' AND "Altitude (mslm)" < '116' AND "City" = 'alessandria' |
what is the surface when the round is gii play-offs and the edition is 2009 fed cup europe/africa group ii? | CREATE TABLE table_name_65 (surface VARCHAR,round VARCHAR,edition VARCHAR) | SELECT surface FROM table_name_65 WHERE round = "gii play-offs" AND edition = "2009 fed cup europe/africa group ii" |
How many laps were there for a grid of 13? | CREATE TABLE table_name_35 (laps VARCHAR,grid VARCHAR) | SELECT COUNT(laps) FROM table_name_35 WHERE grid = 13 |
What was the number of 'The Word' segments for episode number 727? | CREATE TABLE table_3381 ("Episode #" real,"The W\u00f8rd" text,"Guest" text,"Introductory phrase" text,"Original airdate" text,"Production code" real) | SELECT COUNT("The W\u00f8rd") FROM table_3381 WHERE "Episode #" = '727' |
which was the only song to earn less than 60 points ? | CREATE TABLE table_203_695 (id number,"draw" number,"artist" text,"song" text,"points" number,"place" text) | SELECT "song" FROM table_203_695 WHERE "points" < 60 |
Who were the comptrollers of the parties associated with the delegates from district 1 or district 2, and count them by a bar chart, and show in desc by the Y. | CREATE TABLE county (County_Id int,County_name text,Population real,Zip_code text)CREATE TABLE party (Party_ID int,Year real,Party text,Governor text,Lieutenant_Governor text,Comptroller text,Attorney_General text,US_Senate text)CREATE TABLE election (Election_ID int,Counties_Represented text,District int,Delegate text... | SELECT Comptroller, COUNT(Comptroller) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2 GROUP BY Comptroller ORDER BY COUNT(Comptroller) DESC |
Return the name and id of the furniture with the highest market rate. | CREATE TABLE furniture (name VARCHAR,furniture_id VARCHAR,market_rate VARCHAR) | SELECT name, furniture_id FROM furniture ORDER BY market_rate DESC LIMIT 1 |
what was the name of the team opponent to elfsborg | CREATE TABLE table_31015 ("Team" text,"Contest and round" text,"Opponent" text,"1st leg score*" text,"2nd leg score**" text,"Aggregate score" text) | SELECT "Team" FROM table_31015 WHERE "Opponent" = 'Elfsborg' |
what number of patients admitted before the year 2110 were diagnosed with cholelith/ac gb inf-obst? | 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2110" AND diagnoses.short_title = "Cholelith/ac gb inf-obst" |
Name the country for pieroni | CREATE TABLE table_name_46 (country VARCHAR,name VARCHAR) | SELECT country FROM table_name_46 WHERE name = "pieroni" |
In 2009, what Appearances had a Winning Percentage of less than 0? | CREATE TABLE table_69027 ("Appearances" real,"Team" text,"Wins" real,"Losses" real,"Winning percentage" real,"Season(s)" text) | SELECT AVG("Appearances") FROM table_69027 WHERE "Season(s)" = '2009' AND "Winning percentage" < '0' |
What studio is director Reginald Hudlin from? | CREATE TABLE table_9807 ("Rank" real,"Title" text,"Studio" text,"Director" text,"Worldwide Gross" text) | SELECT "Studio" FROM table_9807 WHERE "Director" = 'reginald hudlin' |
Which Test Standard has a Usage of secondary filters, and a Class of f5? Question 4 | CREATE TABLE table_44094 ("Usage" text,"Class" text,"Performance" text,"Performance test" text,"Particulate size approaching 100% retention" text,"Test Standard" text) | SELECT "Test Standard" FROM table_44094 WHERE "Usage" = 'secondary filters' AND "Class" = 'f5' |
Which Year started is the highest one that has a Current car of arctic sun, and a Number of cars smaller than 1? | CREATE TABLE table_name_38 (year_started INTEGER,current_car VARCHAR,number_of_cars VARCHAR) | SELECT MAX(year_started) FROM table_name_38 WHERE current_car = "arctic sun" AND number_of_cars < 1 |
How many companies that have ever operated a flight for each type? Draw a bar chart, I want to rank from low to high by the x axis. | CREATE TABLE flight (id int,Vehicle_Flight_number text,Date text,Pilot text,Velocity real,Altitude real,airport_id int,company_id int)CREATE TABLE operate_company (id int,name text,Type text,Principal_activities text,Incorporated_in text,Group_Equity_Shareholding real)CREATE TABLE airport (id int,City text,Country text... | SELECT Type, COUNT(Type) FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id GROUP BY Type ORDER BY Type |
When did the patient Paul Edwards die? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id tex... | SELECT demographic.dod FROM demographic WHERE demographic.name = "Paul Edwards" |
how many hispanic or latino patients were aged below 20 years? | 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.ethnicity = "HISPANIC OR LATINO" AND demographic.age < "20" |
How many Gold medals for the Nations with 6 or more Bronze medals and 18 or more Silver? | CREATE TABLE table_65835 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT AVG("Gold") FROM table_65835 WHERE "Bronze" > '6' AND "Silver" > '18' |
tell me the birth date and marital status of patient jerry deberry. | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ... | SELECT demographic.marital_status, demographic.dob FROM demographic WHERE demographic.name = "Jerry Deberry" |
What is the highest number against on 12/04/1969? | CREATE TABLE table_60255 ("Opposing Teams" text,"Against" real,"Date" text,"Venue" text,"Status" text) | SELECT MAX("Against") FROM table_60255 WHERE "Date" = '12/04/1969' |
give me the number of patients whose primary disease is upper gi bleed and procedure icd9 code is 66? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "UPPER GI BLEED" AND procedures.icd9_code = "66" |
What did they do in the game when their record was 3-2-1? | CREATE TABLE table_21058823_1 (result VARCHAR,record VARCHAR) | SELECT result FROM table_21058823_1 WHERE record = "3-2-1" |
For all storms with at least 1 death, compare the total number of deaths by dates_active attribute. | CREATE TABLE storm (Storm_ID int,Name text,Dates_active text,Max_speed int,Damage_millions_USD real,Number_Deaths int)CREATE TABLE affected_region (Region_id int,Storm_ID int,Number_city_affected real)CREATE TABLE region (Region_id int,Region_code text,Region_name text) | SELECT Dates_active, Number_Deaths FROM storm WHERE Number_Deaths >= 1 |
What is the score of the Boston Bruins away game on March 13? | CREATE TABLE table_name_92 (score VARCHAR,visitor VARCHAR,date VARCHAR) | SELECT score FROM table_name_92 WHERE visitor = "boston bruins" AND date = "march 13" |
What is the average rank of the Reliance Entertainment movie with an opening day on Wednesday before 2012? | CREATE TABLE table_56443 ("Rank" real,"Movie" text,"Year" real,"Studio(s)" text,"Opening Day Net Gross" real,"Day of Week" text) | SELECT AVG("Rank") FROM table_56443 WHERE "Day of Week" = 'wednesday' AND "Year" < '2012' AND "Studio(s)" = 'reliance entertainment' |
What is the sum of Swimsuit scores where the average score is 9.733 and the interview score is higher than 9.654? | CREATE TABLE table_name_79 (swimsuit INTEGER,average VARCHAR,interview VARCHAR) | SELECT SUM(swimsuit) FROM table_name_79 WHERE average = 9.733 AND interview > 9.654 |
What is the total number of cuts made for events played more than 3 times and under 2 top-25s? | CREATE TABLE table_name_44 (cuts_made VARCHAR,events VARCHAR,top_25 VARCHAR) | SELECT COUNT(cuts_made) FROM table_name_44 WHERE events > 3 AND top_25 < 2 |
Which away team scored 10.14 (74)? | CREATE TABLE table_52963 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Away team" FROM table_52963 WHERE "Away team score" = '10.14 (74)' |
Most popular tags during a time period. | CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId num... | SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS PeriodRank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS Questions, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostId AND ... |
Name the college/junior club team for pick number 63 | CREATE TABLE table_1473672_4 (college_junior_club_team VARCHAR,pick__number VARCHAR) | SELECT college_junior_club_team FROM table_1473672_4 WHERE pick__number = 63 |
How many byes were there recorded with 0 draws? | CREATE TABLE table_name_27 (byes INTEGER,draws INTEGER) | SELECT SUM(byes) FROM table_name_27 WHERE draws < 0 |
What is the Region, when the Catalog is SM 2965-05? | CREATE TABLE table_name_5 (region VARCHAR,catalog VARCHAR) | SELECT region FROM table_name_5 WHERE catalog = "sm 2965-05" |
What is the Tyre when Jerry Hoyt was the pole position? | CREATE TABLE table_57591 ("Race" text,"Circuit" text,"Date" text,"Pole position" text,"Fastest lap" text,"Winning driver" text,"Constructor" text,"Tyre" text,"Report" text) | SELECT "Tyre" FROM table_57591 WHERE "Pole position" = 'jerry hoyt' |
Visualize a bar chart for how many workshops did each author submit to? Return the author name and the number of workshops, display names from low to high order. | CREATE TABLE submission (Submission_ID int,Scores real,Author text,College text)CREATE TABLE workshop (Workshop_ID int,Date text,Venue text,Name text)CREATE TABLE Acceptance (Submission_ID int,Workshop_ID int,Result text) | SELECT Author, COUNT(DISTINCT T1.Workshop_ID) FROM Acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY Author |
give me the number of patients whose admission type is urgent and diagnoses icd9 code is 7596? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.icd9_code = "7596" |
count the number of patients diagnosed with ami nos, initial in the same hospital encounter after they have been diagnosed with brain lacer nec-coma nos since 2105. | CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE transfers (row_id number,subject_id number... | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title =... |
what is admission type and death status of subject id 10317? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t... | SELECT demographic.admission_type, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "10317" |
What percentage did Obama get in Rutherford county? | CREATE TABLE table_20799905_1 (obama_percentage VARCHAR,county VARCHAR) | SELECT obama_percentage FROM table_20799905_1 WHERE county = "RUTHERFORD" |
how many times has patient 86791 had received insert gastric tube nec in a year before? | CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number... | SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'insert gastric tube nec') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 86791) AND DATETIME(procedu... |
give me the number of patients whose admission type is newborn and discharge location is disc-tran cancer/chldrn h? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.discharge_location = "DISC-TRAN CANCER/CHLDRN H" |
Show the total salary by each hire date of employees, and please bin the hire date into the day of week interval for showing a bar chart. | CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE departments (DEPARTMENT_ID decima... | SELECT HIRE_DATE, SUM(SALARY) FROM employees |
hba1c levels between 6 and 9.5 to be enrolled in the study. | CREATE TABLE table_train_191 ("id" int,"gender" string,"hemoglobin_a1c_hba1c" float,"diabetic" string,"serum_creatinine" float,"allergy_to_glyburide" bool,"kidney_disease" bool,"drug_abuse" bool,"age" float,"NOUSE" float) | SELECT * FROM table_train_191 WHERE hemoglobin_a1c_hba1c >= 6 AND hemoglobin_a1c_hba1c <= 9.5 |
Stacked bar of class and the number of class colored by Rank, sort Y in descending order. | CREATE TABLE captain (Captain_ID int,Name text,Ship_ID int,age text,Class text,Rank text)CREATE TABLE Ship (Ship_ID int,Name text,Type text,Built_Year real,Class text,Flag text) | SELECT Class, COUNT(Class) FROM captain GROUP BY Rank, Class ORDER BY COUNT(Class) DESC |
Who was the home team with 3305 in attendance? | CREATE TABLE table_47781 ("Date" text,"Home" text,"Score" text,"Away" text,"Attendance" real) | SELECT "Home" FROM table_47781 WHERE "Attendance" = '3305' |
What is Player, when Place is '1'? | CREATE TABLE table_77411 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text) | SELECT "Player" FROM table_77411 WHERE "Place" = '1' |
Show me population by county name in a histogram, sort by the y-axis in desc please. | CREATE TABLE election (Election_ID int,Counties_Represented text,District int,Delegate text,Party int,First_Elected real,Committee text)CREATE TABLE party (Party_ID int,Year real,Party text,Governor text,Lieutenant_Governor text,Comptroller text,Attorney_General text,US_Senate text)CREATE TABLE county (County_Id int,Co... | SELECT County_name, Population FROM county ORDER BY Population DESC |
What is the sum of the Europe totals for players with other appearances of 0, league appearances under 328, and a position of MF? | CREATE TABLE table_35396 ("Ranking" real,"Nationality" text,"Name" text,"Position" text,"Years" text,"League" real,"Europe" real,"Others" real,"Total" real) | SELECT SUM("Europe") FROM table_35396 WHERE "Others" = '0' AND "League" < '328' AND "Position" = 'mf' |
For those employees who did not have any job in the past, show me about the distribution of hire_date and the average of employee_id bin hire_date by weekday in a bar chart, and list in descending by the Y. | CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STAT... | SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(EMPLOYEE_ID) DESC |
Which score has a Home Team of saskatoon accelerators? | CREATE TABLE table_name_61 (score VARCHAR,home_team VARCHAR) | SELECT score FROM table_name_61 WHERE home_team = "saskatoon accelerators" |
Number of votes on answers and votes on questions per month - only non-CW. | CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId num... | SELECT LAST_DATE_OF_MONTH(v.CreationDate), COUNT(v.Id) AS "total_upvotes", SUM(CASE WHEN p.PostTypeId = 1 THEN 1 ELSE 0 END) AS "question_upvotes", SUM(CASE WHEN p.PostTypeId = 2 THEN 1 ELSE 0 END) AS "answer_upvotes" FROM Posts AS p INNER JOIN Votes AS v ON v.PostId = p.Id WHERE v.VoteTypeId = 2 AND (p.CommunityOwnedD... |
coronary artery disease ( cad ) : documented by history of myocardial infarction | CREATE TABLE table_train_271 ("id" int,"renal_disease" bool,"hepatic_disease" bool,"smoking" bool,"coronary_artery_disease_cad" bool,"serum_creatinine" float,"body_mass_index_bmi" float,"myocardial_infarction" bool,"NOUSE" float) | SELECT * FROM table_train_271 WHERE coronary_artery_disease_cad = 1 OR myocardial_infarction = 1 |
Last semester in CZECH 242 , who were the GSIs ? | CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time,monday varchar,tuesday varchar,wednesday varchar,thursday varchar,friday varchar,saturday varchar,sunday varchar,has_final_project ... | SELECT DISTINCT student.firstname, student.lastname FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN gsi ON gsi.course_offering_id = course_offering.offering_id INNER JOIN student ON student.student_id = gsi.student_id INNER JOIN semester ON semester.semester_id = course... |
what is 2012 when the tournament is cincinnati masters? | CREATE TABLE table_59943 ("Tournament" text,"2006" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text) | SELECT "2012" FROM table_59943 WHERE "Tournament" = 'cincinnati masters' |
What is the Defending forces when the population was 120? | CREATE TABLE table_46548 ("Name" text,"Date" text,"Defending forces" text,"Brigade" text,"Population" text) | SELECT "Defending forces" FROM table_46548 WHERE "Population" = '120' |
Identify every player's height in meters if the player is exactly 6' 07' tall in feet | CREATE TABLE table_26230 ("No" real,"Player" text,"Height (m)" text,"Height (f)" text,"Position" text,"Year born" real,"Current Club" text) | SELECT "Height (m)" FROM table_26230 WHERE "Height (f)" = '6'' 07' |
Which school in Balclutha has a roll smaller than 55? | CREATE TABLE table_70437 ("Name" text,"Years" text,"Gender" text,"Area" text,"Authority" text,"Decile" real,"Roll" real) | SELECT "Name" FROM table_70437 WHERE "Area" = 'balclutha' AND "Roll" < '55' |
which party finished last in the election ? | CREATE TABLE table_202_231 (id number,"party" text,"votes" number,"%" number,"seats" number,"+/-" number) | SELECT "party" FROM table_202_231 ORDER BY "%" LIMIT 1 |
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of founder and the sum of revenue , and group by attribute founder. | 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 Founder, SUM(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder |
What driver has BRM as a constructor and had more than 30 laps? | CREATE TABLE table_53777 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT "Driver" FROM table_53777 WHERE "Constructor" = 'brm' AND "Laps" > '30' |
Can you tell me the Conference Joined that has the Location of terre haute, and the Mascot of golden bears? | CREATE TABLE table_name_67 (conference_joined VARCHAR,location VARCHAR,mascot VARCHAR) | SELECT conference_joined FROM table_name_67 WHERE location = "terre haute" AND mascot = "golden bears" |
list the AS flights arriving in BURBANK | CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_required text,minimum_stay int,maximum_stay int,application text,no_discounts text)CREATE TABLE airport_service (city_code varchar,airport_code varchar,mi... | SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'BURBANK' AND flight.airline_code = 'AS' AND flight.to_airport = airport_service.airport_code |
how many times is the country united states and the score 72-71-73-73=289? | CREATE TABLE table_49970 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" real,"Money ($)" text) | SELECT COUNT("To par") FROM table_49970 WHERE "Country" = 'united states' AND "Score" = '72-71-73-73=289' |
What is the score when november 15 is the date? | CREATE TABLE table_name_86 (score VARCHAR,date VARCHAR) | SELECT score FROM table_name_86 WHERE date = "november 15" |
provide the number of patients whose admission location is clinic referral/premature and age is less than 45? | 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 = "CLINIC REFERRAL/PREMATURE" AND demographic.age < "45" |
What is heaton chapel's capacity? | CREATE TABLE table_76736 ("School" text,"Locality" text,"Ages" text,"Capacity" real,"Ofsted" real) | SELECT MAX("Capacity") FROM table_76736 WHERE "Locality" = 'heaton chapel' |
in this year, patient 49654 has made an admission? | 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 COUNT(*) > 0 FROM admissions WHERE admissions.subject_id = 49654 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') |
what was patient 57023's last blood culture ( myco/f lytic bottle)'s microbiology test time in the last month? | CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE microbiologyevents (row_id number,su... | SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 57023) AND microbiologyevents.spec_type_desc = 'blood culture ( myco/f lytic bottle)' AND DATETIME(microbiologyevents.charttime, 'start of month') = DA... |
Return a bar chart on how many wines are there for each grape? | CREATE TABLE appellations (No INTEGER,Appelation TEXT,County TEXT,State TEXT,Area TEXT,isAVA TEXT)CREATE TABLE grapes (ID INTEGER,Grape TEXT,Color TEXT)CREATE TABLE wine (No INTEGER,Grape TEXT,Winery TEXT,Appelation TEXT,State TEXT,Name TEXT,Year INTEGER,Price INTEGER,Score INTEGER,Cases INTEGER,Drink TEXT) | SELECT Grape, COUNT(*) FROM wine GROUP BY Grape |
Visualize a scatter chart about the correlation between People_ID and Snatch . | CREATE TABLE people (People_ID int,Name text,Height real,Weight real,Birth_Date text,Birth_Place text)CREATE TABLE body_builder (Body_Builder_ID int,People_ID int,Snatch real,Clean_Jerk real,Total real) | SELECT People_ID, Snatch FROM body_builder |
What status has an area km 2 less than 27.82, with 352 as the population? | CREATE TABLE table_name_90 (status VARCHAR,area_km_2 VARCHAR,population VARCHAR) | SELECT status FROM table_name_90 WHERE area_km_2 < 27.82 AND population = 352 |
What country does Mark Hayes play for? | CREATE TABLE table_name_33 (country VARCHAR,player VARCHAR) | SELECT country FROM table_name_33 WHERE player = "mark hayes" |
Users with at least n gold badges. | CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score number,ApprovedByUserId number,ApprovalDate time)CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Cl... | WITH tagbadges_cte AS (SELECT b.UserId AS uid, SUM(CASE WHEN b.Class = 1 THEN 1 ELSE 0 END) AS gold, SUM(CASE WHEN b.Class = 2 THEN 1 ELSE 0 END) AS silver, SUM(CASE WHEN b.Class = 3 THEN 1 ELSE 0 END) AS bronze, COUNT(b.Id) AS total FROM Badges AS b INNER JOIN Tags AS t ON t.TagName = Name GROUP BY UserId) SELECT u.Id... |
how many patients with elective admission type were born before the year 2107? | 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 COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.admityear < "2107" |
Interesting Ubuntu trends (# of Questions per Month). | CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostN... | SELECT DATEADD(mm, (YEAR(Posts.CreationDate) - 1900) * 12 + MONTH(Posts.CreationDate) - 1, 0) AS Month, Tags.TagName, COUNT(*) AS Questions FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Tags.TagName IN ... |
What is the HDTV when documentaries are the content? | CREATE TABLE table_76124 ("Television service" text,"Country" text,"Language" text,"Content" text,"HDTV" text,"Package/Option" text) | SELECT "HDTV" FROM table_76124 WHERE "Content" = 'documentaries' |
What interface is used on the scanner that has a 36 pages per minute? | CREATE TABLE table_16409745_1 (interface VARCHAR,pages_per_minute__color_ VARCHAR) | SELECT interface FROM table_16409745_1 WHERE pages_per_minute__color_ = 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.