instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Find Answers with Really low scores. | 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 PostLinks (Id number,CreationDate time,PostId number,RelatedPos... | SELECT Id AS "post_link" FROM Posts WHERE PostTypeId = 2 AND LENGTH(Body) <= '##length##' AND Score <= '##Score##' ORDER BY Score |
how many dose of tricor has been prescribed to patient 29741 in the first hospital encounter? | CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom 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,langu... | SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 29741 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND prescriptions.drug = 'tricor' |
What was the notes of the 400 m event before 2004 with a position of 12th (h)? | CREATE TABLE table_51832 ("Year" real,"Competition" text,"Venue" text,"Position" text,"Event" text,"Notes" text) | SELECT "Notes" FROM table_51832 WHERE "Event" = '400 m' AND "Year" < '2004' AND "Position" = '12th (h)' |
what is the name of the intake that patient 030-6441 last had on 08/31/last year? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,tempe... | SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-6441')) AND intakeoutput.cellpath LIKE '%intake%' AND DA... |
What was the team #1 for the match that had a result of 0-3? | CREATE TABLE table_name_17 (team__number1 VARCHAR,res VARCHAR) | SELECT team__number1 FROM table_name_17 WHERE res = "0-3" |
On which circuit was the lites 1 race one winning team #66 Gunnar Racing? | CREATE TABLE table_28833 ("Rnd" real,"Circuit" text,"Lites 1 Race One Winning Team" text,"Lites 2 Race One Winning Team" text,"Lites 1 Race Two Winning Team" text,"Lites 2 Race Two Winning Team" text) | SELECT "Circuit" FROM table_28833 WHERE "Lites 1 Race One Winning Team" = '#66 Gunnar Racing' |
What's the place with an area of less than 2,198.72 and a code more than 90909? | CREATE TABLE table_65740 ("Place" text,"Code" real,"Area (km 2)" real,"Population" real,"Most spoken language" text) | SELECT "Place" FROM table_65740 WHERE "Area (km 2 )" < '2,198.72' AND "Code" > '90909' |
For those employees who was hired before 2002-06-21, draw a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id, and could you list the average of salary in desc order 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 jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE employees (EMPLOYEE_ID decimal(6,... | SELECT JOB_ID, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(SALARY) DESC |
Which Driver has a Grid smaller than 17, and Points larger than 0, and a Lapse of 87, and a Time/Retired of 1:48:11.023? | CREATE TABLE table_name_72 (driver VARCHAR,time_retired VARCHAR,laps VARCHAR,grid VARCHAR,points VARCHAR) | SELECT driver FROM table_name_72 WHERE grid < 17 AND points > 0 AND laps = 87 AND time_retired = "1:48:11.023" |
Tell me the sum of closed for city of pittsburgh and capacity larger than 59,000 | CREATE TABLE table_name_73 (closed INTEGER,city VARCHAR,capacity VARCHAR) | SELECT SUM(closed) FROM table_name_73 WHERE city = "pittsburgh" AND capacity > 59 OFFSET 000 |
how many players were born after 1985 ? | CREATE TABLE table_204_847 (id number,"#" number,"name" text,"position" text,"birthday" text,"size" text,"weight" text,"last team" text) | SELECT COUNT("name") FROM table_204_847 WHERE "birthday" > 1985 |
What are the number of the completion dates of all the tests that have result 'Fail'?, display from low to high by the total number. | CREATE TABLE Courses (course_id INTEGER,author_id INTEGER,subject_id INTEGER,course_name VARCHAR(120),course_description VARCHAR(255))CREATE TABLE Course_Authors_and_Tutors (author_id INTEGER,author_tutor_ATB VARCHAR(3),login_name VARCHAR(40),password VARCHAR(40),personal_name VARCHAR(80),middle_name VARCHAR(80),family... | SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" ORDER BY COUNT(date_of_completion) |
What date was the loss of sparks (0 1)? | CREATE TABLE table_name_43 (date VARCHAR,loss VARCHAR) | SELECT date FROM table_name_43 WHERE loss = "sparks (0β1)" |
What School/Club Team has a Player named Juan Dixon and a Position of guard? | CREATE TABLE table_4314 ("Player" text,"Nationality" text,"Position" text,"Years in Toronto" text,"School/Club Team" text) | SELECT "School/Club Team" FROM table_4314 WHERE "Position" = 'guard' AND "Player" = 'juan dixon' |
what is the branding when the owner is jim pattison group and the frequency is fm 94.5? | CREATE TABLE table_name_55 (branding VARCHAR,owner VARCHAR,frequency VARCHAR) | SELECT branding FROM table_name_55 WHERE owner = "jim pattison group" AND frequency = "fm 94.5" |
Who is the spokesperson after 2012? | CREATE TABLE table_12665 ("Year(s)" real,"Final television commentator" text,"Radio commentator" text,"Spokesperson" text,"Semi-final television commentator" text,"Semi-final second television commentator" text) | SELECT "Spokesperson" FROM table_12665 WHERE "Year(s)" > '2012' |
What was the final position of Arena Motorsports International? | CREATE TABLE table_71203 ("Year" real,"Team" text,"Co-Drivers" text,"Class" text,"Pos." text,"Class Pos." text) | SELECT "Pos." FROM table_71203 WHERE "Team" = 'arena motorsports international' |
What are the number of the names of the workshop groups that have bookings with status code 'stop'? | CREATE TABLE Services (Service_ID INTEGER,Service_Type_Code CHAR(15),Workshop_Group_ID INTEGER,Product_Description VARCHAR(255),Product_Name VARCHAR(255),Product_Price DECIMAL(20,4),Other_Product_Service_Details VARCHAR(255))CREATE TABLE Stores (Store_ID VARCHAR(100),Address_ID INTEGER,Marketing_Region_Code CHAR(15),St... | SELECT Store_Name, COUNT(Store_Name) FROM Bookings AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Workshop_Group_ID = T2.Workshop_Group_ID WHERE T1.Status_Code = "stop" GROUP BY Store_Name |
What is the role in an original play, comedy in 1938? | CREATE TABLE table_12145 ("Year" real,"Title" text,"Format/genre" text,"Role" text,"Staged by" text) | SELECT "Role" FROM table_12145 WHERE "Format/genre" = 'original play, comedy' AND "Year" = '1938' |
how much has patient 27703's change of weight last measured on the first hospital visit compared to the first value measured on the first hospital visit? | 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_labitems (row_id number,itemid number,label text)CREATE TABLE microbiologyevents (row_id number,subject_id number,... | 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 = 27703 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND chartev... |
High Standards - Top 100 Users that rarely upvote.. Top 100 Users that rarely upvote in comparison to the
estimated amount of upvotes they received (doesn't account
for e.g. bounties but should give a sufficient estimation).
Useful settings (MinRep, MinUpvotes): (1000, 100), (10000, 0). | CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwne... | SELECT Posts.Id, Body, TagId, TagName FROM Posts INNER JOIN PostTags ON Posts.Id = PostTags.PostId INNER JOIN Tags ON PostTags.TagId = Tags.Id WHERE TagName IN ('javascript', 'jquery', 'java', 'c#') ORDER BY Posts.Id LIMIT 1000 |
When was the game in which Deron Williams (13) did the high assists played? | CREATE TABLE table_23286223_5 (date VARCHAR,high_assists VARCHAR) | SELECT date FROM table_23286223_5 WHERE high_assists = "Deron Williams (13)" |
What was the score of the game against the Royals when the record was 24 52? | CREATE TABLE table_72034 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Record" text) | SELECT "Score" FROM table_72034 WHERE "Opponent" = 'royals' AND "Record" = '24β52' |
What was the lowest rank after 2009 with an accolade of 125 best albums of the past 25 years? | CREATE TABLE table_name_79 (rank INTEGER,year VARCHAR,accolade VARCHAR) | SELECT MIN(rank) FROM table_name_79 WHERE year > 2009 AND accolade = "125 best albums of the past 25 years" |
What is the fewest losses associated with more than 13 points and fewer than 8 games? | CREATE TABLE table_37095 ("Games" real,"Drawn" real,"Lost" real,"Points difference" text,"Points" real) | SELECT MIN("Lost") FROM table_37095 WHERE "Points" > '13' AND "Games" < '8' |
On what date was the opponent Ayr United, the result 1 0, and the attendance more than 668? | CREATE TABLE table_39969 ("Date" text,"Opponent" text,"Venue" text,"Result" text,"Attendance" real) | SELECT "Date" FROM table_39969 WHERE "Result" = '1β0' AND "Attendance" > '668' AND "Opponent" = 'ayr united' |
What is the total number of Wins, when Losses is '6', and when Draws is greater than '0'? | CREATE TABLE table_61146 ("Golden Rivers" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real) | SELECT COUNT("Wins") FROM table_61146 WHERE "Losses" = '6' AND "Draws" > '0' |
how many times were the dallas cowboys listed as an opponent ? | CREATE TABLE table_203_405 (id number,"week" number,"date" text,"opponent" text,"result" text,"attendance" number) | SELECT COUNT(*) FROM table_203_405 WHERE "opponent" = 'dallas cowboys' |
What is the number played for the Barcelona B club, with wins under 11? | CREATE TABLE table_52411 ("Position" real,"Club" text,"Played" real,"Points" text,"Wins" real,"Draws" real,"Losses" real,"Goals for" real,"Goals against" real,"Goal Difference" real) | SELECT SUM("Played") FROM table_52411 WHERE "Club" = 'barcelona b' AND "Wins" < '11' |
How long did the trans 1 take when 2:00:40.20 is the total time? | CREATE TABLE table_name_28 (trans_1 VARCHAR,total_time VARCHAR) | SELECT trans_1 FROM table_name_28 WHERE total_time = "2:00:40.20" |
What is the 2012 club of the cf pos. player? | CREATE TABLE table_44143 ("Name" text,"Pos." text,"Height" text,"Weight" text,"2012 club" text) | SELECT "2012 club" FROM table_44143 WHERE "Pos." = 'cf' |
What is the highest Week, when Date is 'November 8, 1970'? | CREATE TABLE table_name_66 (week INTEGER,date VARCHAR) | SELECT MAX(week) FROM table_name_66 WHERE date = "november 8, 1970" |
What player is ranked 2 and played in the seasons of 1982 83, 1983 84, 1984 85? | CREATE TABLE table_78017 ("Rank" real,"Player" text,"Club" text,"Country" text,"Titles" real,"Seasons" text) | SELECT "Player" FROM table_78017 WHERE "Rank" = '2' AND "Seasons" = '1982β83, 1983β84, 1984β85' |
Which award has the category of the best direction of a musical? | CREATE TABLE table_name_69 (award VARCHAR,category VARCHAR) | SELECT award FROM table_name_69 WHERE category = "best direction of a musical" |
list all the flights that depart from MKE | CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,ground_fare int)CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_sp... | SELECT DISTINCT flight.flight_id FROM airport, flight WHERE airport.airport_code = 'MKE' AND flight.from_airport = airport.airport_code |
How many musicals has each nominee been nominated for Plot them as bar chart, show in asc by the total number. | 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(*) FROM musical GROUP BY Nominee ORDER BY COUNT(*) |
what is admission time of subject id 2560? | 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.admittime FROM demographic WHERE demographic.subject_id = "2560" |
List the name of artworks that are not nominated. | CREATE TABLE nomination (artwork_id number,festival_id number,result text)CREATE TABLE festival_detail (festival_id number,festival_name text,chair_name text,location text,year number,num_of_audience number)CREATE TABLE artwork (artwork_id number,type text,name text) | SELECT name FROM artwork WHERE NOT artwork_id IN (SELECT artwork_id FROM nomination) |
Among patients admitted before the year 2123, how many of them had a blood gas test by lab? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2123" AND lab."CATEGORY" = "Blood Gas" |
What is the 2012 value with a 1r in 2011 in the Australian Open? | CREATE TABLE table_name_6 (tournament VARCHAR) | SELECT 2012 FROM table_name_6 WHERE 2011 = "1r" AND tournament = "australian open" |
Who was the home team with a result of 105-99? | CREATE TABLE table_name_32 (home_team VARCHAR,result VARCHAR) | SELECT home_team FROM table_name_32 WHERE result = "105-99" |
WHat is the number for the player whose height is 2.01? | CREATE TABLE table_597 ("No" real,"Player" text,"Height" text,"Position" text,"Year born" real,"Current Club" text) | SELECT COUNT("Player") FROM table_597 WHERE "Height" = '2.01' |
Of all shows who have a rating larger than 7.8, aired on October 26, 2006, and has a share of over 14, what is the sum of the viewers? | CREATE TABLE table_10803 ("Episode" real,"Title" text,"Airdate" text,"Rating" real,"Share" real,"18-49" real,"Viewers" real,"Rank" text) | SELECT SUM("Viewers") FROM table_10803 WHERE "Rating" > '7.8' AND "Airdate" = 'october 26, 2006' AND "Share" > '14' |
List UI5 related questions for a user. | CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,... | SELECT Title, Posts.CreationDate, AcceptedAnswerId, Tags, Posts.Id AS "post_link" FROM Posts INNER JOIN PostTags ON PostTags.PostId = Posts.Id INNER JOIN Tags ON Tags.Id = PostTags.TagId INNER JOIN Users ON Users.Id = Posts.OwnerUserId WHERE PostTypeId = 1 AND DisplayName = '##Username:string##' AND TagName = '##Tagnam... |
What is the sum of wins after 1999? | CREATE TABLE table_name_47 (wins INTEGER,year INTEGER) | SELECT SUM(wins) FROM table_name_47 WHERE year > 1999 |
how many innings have an average of 19.60? | CREATE TABLE table_30795 ("Player" text,"Matches" real,"Innings" real,"Wickets" real,"Average" text,"BBI" text,"BBM" text,"5wi" real,"10wi" real) | SELECT "Innings" FROM table_30795 WHERE "Average" = '19.60' |
how many patients were given analgesics - continuous parenteral analgesics until 2103? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE patient (uniquepid text,patienthealthsystemstayi... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'analgesics - continuous parenteral analgesics' AND STRFTIME('%y', treatment.treatmenttime) <= '2103') |
How many home teams are there when the away team score was 4.2 (26) and away team was footscray? | CREATE TABLE table_30938 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Ground" text,"Date" text) | SELECT COUNT("Home team score") FROM table_30938 WHERE "Away team score" = '4.2 (26)' AND "Away team" = 'Footscray' |
Which Date has an Attendance larger than 1,858? | CREATE TABLE table_47729 ("Date" text,"Home" text,"Score" text,"Away" text,"Attendance" real) | SELECT "Date" FROM table_47729 WHERE "Attendance" > '1,858' |
david oliver has come in 3rd place in how many competitions ? | CREATE TABLE table_203_192 (id number,"year" number,"competition" text,"venue" text,"position" text,"notes" text) | SELECT COUNT("competition") FROM table_203_192 WHERE "position" = 3 |
With Round 3 and Pick # over 10, what is the higher Overall number? | CREATE TABLE table_71219 ("Round" real,"Pick #" real,"Overall" real,"Name" text,"Position" text,"College" text) | SELECT MAX("Overall") FROM table_71219 WHERE "Round" = '3' AND "Pick #" > '10' |
how many hours has it been since the last hpt c w/o hepat coma nos diagnosis for patient 9964 on the current hospital visit? | CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)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 text,eve... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnoses_icd.charttime)) FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'hpt c w/o hepat coma nos') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM ad... |
What is the name of the team that had 1 win and a rating of +85? | CREATE TABLE table_67561 ("Season" text,"Player" text,"Team" text,"Position" text,"Rating" text,"Win #" text) | SELECT "Team" FROM table_67561 WHERE "Win #" = '1' AND "Rating" = '+85' |
what is the number of patients whose ethnicity is asian and admission year is less than 2107? | 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 demographic (subject_id text,hadm_id text,name text,marita... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "ASIAN" AND demographic.admityear < "2107" |
What is the Studio of the Rank 10 Film? | CREATE TABLE table_48632 ("Rank" real,"Title" text,"Studio" text,"Director" text,"Gross" text) | SELECT "Studio" FROM table_48632 WHERE "Rank" = '10' |
Which Assist/pass has a Goal of 5? | CREATE TABLE table_70076 ("Goal" text,"Location" text,"Lineup" text,"Assist/pass" text,"Score" text,"Result" text,"Competition" text) | SELECT "Assist/pass" FROM table_70076 WHERE "Goal" = '5' |
What date has the format of cd? | CREATE TABLE table_name_40 (date VARCHAR,format VARCHAR) | SELECT date FROM table_name_40 WHERE format = "cd" |
count the number of patients with procedure icd9 code 5732 who were hospitalized for more than 4 days. | 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.days_stay > "4" AND procedures.icd9_code = "5732" |
How many faculty members do we have for each rank? Show bar chart, and could you show x axis in asc order? | CREATE TABLE Faculty_Participates_in (FacID INTEGER,actid INTEGER)CREATE TABLE Participates_in (stuid INTEGER,actid INTEGER)CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTEGER,city_code VARCHAR(3))CREATE TABLE Activity (actid INTEGER,activity_... | SELECT Rank, COUNT(Rank) FROM Faculty GROUP BY Rank ORDER BY Rank |
KML tag with language tags (rough estimate). | CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate ti... | SELECT COUNT(DISTINCT P.Id) FROM Posts AS P INNER JOIN PostTags AS PT ON PT.PostId = P.Id INNER JOIN Tags AS T ON T.Id = PT.TagId INNER JOIN PostTags AS PT2 ON PT2.PostId = P.Id INNER JOIN Tags AS T2 ON T2.Id = PT2.TagId WHERE P.PostTypeId = 1 AND T.TagName = 'xml' AND T2.TagName IN ('javascript', 'android', 'java', 'p... |
What loss was against the angels with a 50-31 record? | CREATE TABLE table_66847 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text) | SELECT "Loss" FROM table_66847 WHERE "Opponent" = 'angels' AND "Record" = '50-31' |
What was the Result on November 9, 1958? | CREATE TABLE table_37510 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real) | SELECT "Result" FROM table_37510 WHERE "Date" = 'november 9, 1958' |
What is Driver, when Race 2 is 14? | CREATE TABLE table_name_48 (driver VARCHAR,race_2 VARCHAR) | SELECT driver FROM table_name_48 WHERE race_2 = "14" |
count the number of patients whose days of hospital stay is greater than 27 and lab test name is albumin, body fluid? | 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 lab (subject_id text,hadm_id text,itemid text,charttime tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "27" AND lab.label = "Albumin, Body Fluid" |
which is the shortest song ? | CREATE TABLE table_204_238 (id number,"#" number,"title" text,"producer(s)" text,"performer (s)" text,"time" text) | SELECT "title" FROM table_204_238 ORDER BY "time" LIMIT 1 |
what is the number of patients whose admission location is emergency room admit with procedure oth cardiac mon output? | 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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND procedures.short_title = "Oth cardiac mon output" |
What was the score of the game against away team crewe alexandra? | CREATE TABLE table_79085 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text) | SELECT "Score" FROM table_79085 WHERE "Away team" = 'crewe alexandra' |
how much changes in the weight of patient 28966 last measured on the last hospital visit compared to the second to last value measured on the last hospital visit? | 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 patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE microbiologyevents (row_id number,subject_id number,... | 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 = 28966 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND ch... |
what is the number of emergency room hospital admitted patients who were diagnosed with other malignant lymphomas, unspecified site, extranodal and solid organ sites? | 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.long_title = "Other malignant lymphomas, unspecified site, extranodal and solid organ sites" |
What type of surface was played on when the score was 2 6, 6 1, [10 5]? | CREATE TABLE table_name_7 (surface VARCHAR,score VARCHAR) | SELECT surface FROM table_name_7 WHERE score = "2β6, 6β1, [10β5]" |
Best average score per post. | CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CR... | SELECT Users.Id AS "user_link", COUNT(Posts.Id) AS "posts", SUM(Posts.Score) AS "score", ROUND(CAST(SUM(Posts.Score) AS FLOAT) / COUNT(Posts.Id), 1) AS "average_score" FROM Users, Posts WHERE Posts.OwnerUserId = Users.Id GROUP BY Users.Id HAVING COUNT(Posts.Id) >= 10 ORDER BY 'average_score' DESC |
Name the engine when points are 0 and chassis is kuzma indy roadster for 1954 | CREATE TABLE table_name_38 (engine VARCHAR,year VARCHAR,points VARCHAR,chassis VARCHAR) | SELECT engine FROM table_name_38 WHERE points = 0 AND chassis = "kuzma indy roadster" AND year = 1954 |
How many TFR were there in 2006 when the GFR was 53.8? | CREATE TABLE table_12251936_1 (tfr_2006 VARCHAR,gfr_2006 VARCHAR) | SELECT tfr_2006 FROM table_12251936_1 WHERE gfr_2006 = "53.8" |
What are total transaction amounts for each transaction type, and show transaction_type in asc order. | CREATE TABLE Orders (order_id INTEGER,customer_id INTEGER,date_order_placed DATETIME,order_details VARCHAR(255))CREATE TABLE Accounts (account_id INTEGER,customer_id INTEGER,date_account_opened DATETIME,account_name VARCHAR(50),other_account_details VARCHAR(255))CREATE TABLE Invoices (invoice_number INTEGER,order_id IN... | SELECT transaction_type, SUM(transaction_amount) FROM Financial_Transactions GROUP BY transaction_type ORDER BY transaction_type |
In the game where richmond was the away team, what venue was it played at? | CREATE TABLE table_name_99 (venue VARCHAR,away_team VARCHAR) | SELECT venue FROM table_name_99 WHERE away_team = "richmond" |
What is the African Spoonbill when the Hadeda Ibis is the Brown Snake Eagle? | CREATE TABLE table_23492 ("Ostrich" text,"Hamerkop" text,"Hadeda Ibis" text,"African Spoonbill" text,"Whitefaced Duck" text,"Knobbilled Duck" text) | SELECT "African Spoonbill" FROM table_23492 WHERE "Hadeda Ibis" = 'Brown Snake Eagle' |
Who did the high points of game 5? | CREATE TABLE table_17292 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Series" text) | SELECT "High points" FROM table_17292 WHERE "Game" = '5' |
What was Ben Hogan's par? | CREATE TABLE table_8995 ("Place" text,"Player" text,"Country" text,"Score" real,"To par" text) | SELECT "To par" FROM table_8995 WHERE "Player" = 'ben hogan' |
what's the minimum attendance with score 10.16 (76) 9.22 (76) | CREATE TABLE table_16164 ("Season" real,"Premier" text,"Runner-up" text,"Score" text,"Margin" real,"Venue" text,"Attendance" real) | SELECT MIN("Attendance") FROM table_16164 WHERE "Score" = '10.16 (76) β 9.22 (76)' |
What is the number of the game when the opponent was the New York Islanders, and a February less than 24? | CREATE TABLE table_46035 ("Game" real,"February" real,"Opponent" text,"Score" text,"Record" text) | SELECT SUM("Game") FROM table_46035 WHERE "Opponent" = 'new york islanders' AND "February" < '24' |
What is the muzzle velocity for the .38 long colt cartridge? | CREATE TABLE table_50170 ("Cartridge" text,"Bullet weight" text,"Muzzle velocity" text,"Muzzle energy" text,"Max pressure" text) | SELECT "Muzzle velocity" FROM table_50170 WHERE "Cartridge" = '.38 long colt' |
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of founder and the sum of manufacturer , 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(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder |
Which opponents are on the date September 5? | CREATE TABLE table_23612439_2 (opponent VARCHAR,date VARCHAR) | SELECT opponent FROM table_23612439_2 WHERE date = "September 5" |
Find the names of Japanese constructors that have once earned more than 5 points, and count them by a pie chart | CREATE TABLE pitStops (raceId INTEGER,driverId INTEGER,stop INTEGER,lap INTEGER,time TEXT,duration TEXT,milliseconds INTEGER)CREATE TABLE drivers (driverId INTEGER,driverRef TEXT,number TEXT,code TEXT,forename TEXT,surname TEXT,dob TEXT,nationality TEXT,url TEXT)CREATE TABLE seasons (year INTEGER,url TEXT)CREATE TABLE ... | SELECT name, COUNT(name) FROM constructors AS T1 JOIN constructorStandings AS T2 ON T1.constructorId = T2.constructorId WHERE T1.nationality = "Japanese" AND T2.points > 5 GROUP BY name |
what is the grid when the time/retired is oil pressure and the laps are more than 50? | CREATE TABLE table_52342 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT AVG("Grid") FROM table_52342 WHERE "Time/Retired" = 'oil pressure' AND "Laps" > '50' |
what are the four most frequent intakes in 2100? | 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 d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title... | SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT inputevents_cv.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM inputevents_cv WHERE STRFTIME('%y', inputevents_cv.charttime) = '2100' GROUP BY inputevents_cv.itemid) AS t1 WHERE t1.c1 <= 4) |
Find Alice's friends of friends. | CREATE TABLE Person (name VARCHAR)CREATE TABLE PersonFriend (name VARCHAR) | SELECT DISTINCT T4.name FROM PersonFriend AS T1 JOIN Person AS T2 ON T1.name = T2.name JOIN PersonFriend AS T3 ON T1.friend = T3.name JOIN PersonFriend AS T4 ON T3.friend = T4.name WHERE T2.name = 'Alice' AND T4.name <> 'Alice' |
How many league of communists have the people's party at 7? | CREATE TABLE table_1218 ("Municipality" text,"League of Communists" real,"Peoples Party" real,"Union of Reform Forces" real,"Democratic Coalition" real,"DSSP" real,"Total seats" real) | SELECT COUNT("League of Communists") FROM table_1218 WHERE "Peoples Party" = '7' |
how many days has passed since the last time patient 027-151154 has had a procedure in the current hospital visit? | 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 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-151154... |
What is the result in oakland? | CREATE TABLE table_name_11 (result VARCHAR,venue VARCHAR) | SELECT result FROM table_name_11 WHERE venue = "oakland" |
what were the top three most frequent medications that followed in the same month for the patients who took the hormonal therapy (for varices) - octreotide in the previous year? | CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE vitalperiodic (vitalperiodicid number,p... | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'hormonal therapy (for varices) - octreotide' AND D... |
List the 1st air date for season 12. | CREATE TABLE table_27437601_2 (original_air_date VARCHAR,no_in_season VARCHAR) | SELECT original_air_date FROM table_27437601_2 WHERE no_in_season = 12 |
What is the time for Russia? | CREATE TABLE table_name_54 (time VARCHAR,nationality VARCHAR) | SELECT time FROM table_name_54 WHERE nationality = "russia" |
When 4 is the week what is the location? | CREATE TABLE table_24136365_2 (location VARCHAR,week VARCHAR) | SELECT location FROM table_24136365_2 WHERE week = 4 |
how much does patient 14982 change in heart rate last measured on the last icu visit compared to the first value measured on the last icu visit? | 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 transfers (row_id number,subject_id number,hadm_id number,icus... | 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 = 14982) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents... |
Name the total number of competition finish with total of 90 and rank by average more than 5 | CREATE TABLE table_14304 ("Rank by average" real,"Competition finish" real,"Couple" text,"Total" real,"Number of dances" real,"Average" real) | SELECT COUNT("Competition finish") FROM table_14304 WHERE "Total" = '90' AND "Rank by average" > '5' |
create while loop with cte. http://stackoverflow.com/questions/12929165/create-while-loop-with-cte | CREATE TABLE PostTypes (Id number,Name text)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 PostTags (PostId nu... | WITH Nums AS (SELECT Digit FROM (VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9)) AS Nums(Digit)) SELECT CAST(id AS TEXT(5)) AS id FROM (SELECT t3.digit * 100 + t2.digit * 10 + t1.digit + 1 AS id FROM Nums AS t1 CROSS JOIN Nums AS t2 CROSS JOIN Nums AS t3) AS t WHERE id <= 884 ORDER BY id |
What is the average length in feet of the bridges? | CREATE TABLE bridge (length_feet INTEGER) | SELECT AVG(length_feet) FROM bridge |
What is the location of thierry boutsen? | CREATE TABLE table_1137707_2 (location VARCHAR,fastest_lap VARCHAR) | SELECT location FROM table_1137707_2 WHERE fastest_lap = "Thierry Boutsen" |
How many accounts are opened in each day for all accounts by the customer with first name 'Meaghan' ? Bin the account open day by weekday in a bar chart, and order y axis in ascending order. | CREATE TABLE Invoice_Line_Items (order_item_id INTEGER,invoice_number INTEGER,product_id INTEGER,product_title VARCHAR(80),product_quantity VARCHAR(50),product_price DECIMAL(19,4),derived_product_cost DECIMAL(19,4),derived_vat_payable DECIMAL(19,4),derived_total_cost DECIMAL(19,4))CREATE TABLE Product_Categories (produ... | SELECT date_account_opened, COUNT(date_account_opened) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan' ORDER BY COUNT(date_account_opened) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.