instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
For those employees who did not have any job in the past, return a bar chart about the distribution of job_id and the sum of salary , and group by attribute job_id, and sort by the Y from high to low. | CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))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 ... | SELECT JOB_ID, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY SUM(SALARY) DESC |
Which IHSAA Class has a Location of linton? | CREATE TABLE table_name_83 (ihsaa_class VARCHAR,location VARCHAR) | SELECT ihsaa_class FROM table_name_83 WHERE location = "linton" |
how many films did ms. starfelt produce after 2010 ? | CREATE TABLE table_204_323 (id number,"year" number,"film" text,"function" text,"notes" text) | SELECT COUNT("film") FROM table_204_323 WHERE "year" > 2010 |
How much Distance has Notes of north end terminus of ar 155? | CREATE TABLE table_64575 ("County" text,"Location" text,"Distance" real,"Total" real,"Notes" text) | SELECT SUM("Distance") FROM table_64575 WHERE "Notes" = 'north end terminus of ar 155' |
What celebrity is famous for being an actor? | CREATE TABLE table_75448 ("Celebrity" text,"Famous for" text,"Entered" text,"Exited" text,"Finished" text) | SELECT "Celebrity" FROM table_75448 WHERE "Famous for" = 'actor' |
provide the number of patients whose drug type is additive and lab test name is calculated thyroxine (t4) index? | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.drug_type = "ADDITIVE" AND lab.label = "Calculated Thyroxine (T4) Index" |
What is the Att-Cmp-Int for the player with a efficiency of 117.4? | CREATE TABLE table_39313 ("Name" text,"GP-GS" text,"Effic" real,"Att-Cmp-Int" text,"Avg/G" real) | SELECT "Att-Cmp-Int" FROM table_39313 WHERE "Effic" = '117.4' |
provide the admission time and procedure icd9 code for chandra schulman. | 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 demographic.admittime, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Chandra Schulman" |
give the number of patients whose admission type is urgent and procedure icd9 code is 8968? | 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 text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.icd9_code = "8968" |
For all employees who have the letters D or S in their first name, draw a bar chart about the distribution of hire_date and the average of salary bin hire_date by time, and show by the y-axis in desc. | CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varc... | SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(SALARY) DESC |
What was the music video that was from the album High Society, with a length of 3:50? | CREATE TABLE table_name_91 (music_video VARCHAR,album VARCHAR,length VARCHAR) | SELECT music_video FROM table_name_91 WHERE album = "high society" AND length = "3:50" |
what's first systemicsystolic value of patient 004-4326 since 2080 days ago? | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,... | SELECT vitalperiodic.systemicsystolic FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-4326')) AND NOT vitalperiodic.systemicsystolic... |
What are the total enrollments of universities of each affiliation type Plot them as bar chart, and I want to show by the sum enrollment in desc. | 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 Affiliation, SUM(Enrollment) FROM university GROUP BY Affiliation ORDER BY SUM(Enrollment) DESC |
how many widowed patients had the procedure extracorporeal circulation auxiliary to open heart surgery? | 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "WIDOWED" AND procedures.long_title = "Extracorporeal circulation auxiliary to open heart surgery" |
count the number of patients who have been diagnosed since 2104 with acute lung injury - pulmonary etiology. | CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,disch... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'acute lung injury - pulmonary etiology' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2104') |
What is the Date when the match Resulted in a draw? | CREATE TABLE table_41643 ("Date" text,"Home captain" text,"Away captain" text,"Venue" text,"Result" text) | SELECT "Date" FROM table_41643 WHERE "Result" = 'draw' |
what is the work when the result is won and the year is after 2002? | CREATE TABLE table_name_91 (work VARCHAR,result VARCHAR,year VARCHAR) | SELECT work FROM table_name_91 WHERE result = "won" AND year > 2002 |
What was the record on March 22? | CREATE TABLE table_34599 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text) | SELECT "Record" FROM table_34599 WHERE "Date" = 'march 22' |
how many prescriptions was prescribed since 2 years ago for aspirin 81 mg chewable tablet? | 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 COUNT(*) FROM medication WHERE medication.drugname = 'aspirin 81 mg chewable tablet' AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-2 year') |
What is the 2011 number (,000) when the status is separated? | CREATE TABLE table_273617_6 (status VARCHAR) | SELECT 2011 AS _number__, 000 AS _ FROM table_273617_6 WHERE status = "Separated" |
i want a flight on TW from BOSTON to DENVER | CREATE TABLE code_description (code varchar,description text)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,length int,we... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON... |
give me the number of patients whose year of death is less than or equal to 2111 and lab test fluid is pleural? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2111.0" AND lab.fluid = "Pleural" |
Who had the placekicker position with a round above 10? | CREATE TABLE table_69836 ("Round" real,"Pick #" real,"Overall" real,"Name" text,"Position" text,"College" text) | SELECT "Name" FROM table_69836 WHERE "Round" > '10' AND "Position" = 'placekicker' |
Would-be Diversity Badge Winners (alternate). | CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance t... | SELECT ROUND(t.Reputation / 5, -3) * 5, COUNT(t.Id) FROM (SELECT u.Id, u.Reputation FROM (SELECT a.OwnerUserId, pt.TagId FROM PostTags AS pt JOIN Posts AS q ON pt.PostId = q.Id JOIN Posts AS a ON a.ParentId = q.Id JOIN (SELECT * FROM Tags ORDER BY Count DESC LIMIT 40) AS t ON pt.TagId = t.Id GROUP BY a.OwnerUserId, pt.... |
How many league cups for m patrick maria with 0 total? | CREATE TABLE table_37341 ("Player" text,"League" real,"Malaysia Cup" real,"FA Cup" real,"Total" real) | SELECT SUM("League") FROM table_37341 WHERE "Player" = 'm patrick maria' AND "Total" < '0' |
what was the name of that output that patient 015-8398 last had on the last intensive care unit visit? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text... | 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 = '015-8398') AND NOT patient.unitdischargetime IS NULL ORDER B... |
Give the ids of the three products purchased in the largest amounts. | CREATE TABLE supplier_addresses (supplier_id number,address_id number,date_from time,date_to time)CREATE TABLE addresses (address_id number,address_details text)CREATE TABLE department_stores (dept_store_id number,dept_store_chain_id number,store_name text,store_address text,store_phone text,store_email text)CREATE TAB... | SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3 |
Get all down votes on my posts. | CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId numbe... | SELECT v.CreationDate, pt.Name, CASE p.PostTypeId WHEN 1 THEN CONCAT('http://stackoverflow.com/q/', p.Id) ELSE CONCAT('http://stackoverflow.com/a/', p.Id) END AS Link, p.Title, p.Body FROM Votes AS v LEFT JOIN VoteTypes AS vt ON vt.Id = v.VoteTypeId LEFT JOIN Posts AS p ON v.PostId = p.Id LEFT JOIN PostTypes AS pt ON p... |
# of posts on Stack Overflow. | CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,OwnerUserId number,Comment text,Text text,Title text,Tags text,RevisionGUID other)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE Rev... | SELECT COUNT(*) FROM Posts |
where is hte second place winner from united kingdom? | CREATE TABLE table_819 ("Year" real,"Winner" text,"Language" text,"Artist" text,"Song" text,"Points" real,"Margin" real,"Second place" text,"Date" text,"Venue" text,"Location" text,"Participants" real) | SELECT "Winner" FROM table_819 WHERE "Second place" = 'United Kingdom' |
Show me about the distribution of meter_400 and ID in a bar chart. | CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time text)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Openin... | SELECT meter_400, ID FROM swimmer |
Which venue is the friendly match in? | CREATE TABLE table_name_7 (venue VARCHAR,competition VARCHAR) | SELECT venue FROM table_name_7 WHERE competition = "friendly match" |
neutropenia as < 500 neutrophils / ul | CREATE TABLE table_train_67 ("id" int,"corticosteroid_therapy" bool,"viral_infection" bool,"active_infection" bool,"hiv_infection" bool,"neutropenia" int,"receiving_prednisolone" int,"age" float,"NOUSE" float) | SELECT * FROM table_train_67 WHERE neutropenia < 500 |
Which ship was raided on 26 September 1940? | CREATE TABLE table_name_52 (name_of_ship VARCHAR,date VARCHAR) | SELECT name_of_ship FROM table_name_52 WHERE date = "26 september 1940" |
A bar chart shows the distribution of meter_500 and meter_100 , and list by the Y-axis in asc. | CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time text)CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Ev... | SELECT meter_500, meter_100 FROM swimmer ORDER BY meter_100 |
What is 2011, when 2010 is 'WTA Premier 5 Tournaments'? | CREATE TABLE table_78687 ("Tournament" text,"2004" text,"2005" text,"2006" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text) | SELECT "2011" FROM table_78687 WHERE "2010" = 'wta premier 5 tournaments' |
what is maximum age of patients whose insurance is private and days of hospital stay is 8? | 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 MAX(demographic.age) FROM demographic WHERE demographic.insurance = "Private" AND demographic.days_stay = "8" |
What is the average opened year of the line with 59 stations served and more than 145,000,000 journeys made per annum? | CREATE TABLE table_10001 ("Line name" text,"Opened" real,"Last extension" real,"Stations served" real,"Length" text,"Average Interstation" text,"Journeys made (per annum)" real) | SELECT AVG("Opened") FROM table_10001 WHERE "Stations served" = '59' AND "Journeys made (per annum)" > '145,000,000' |
What is the name of the home team that played against Hawthorn? | CREATE TABLE table_53059 ("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_53059 WHERE "Away team" = 'hawthorn' |
Which operating system has a storage (flash) of 128MB? | CREATE TABLE table_46730 ("Model" text,"Memory (RAM)" text,"Storage (flash)" text,"Operating system version" text,"Memory card" text,"Weight,dimensions" text,"Retail availability" text) | SELECT "Operating system version" FROM table_46730 WHERE "Storage ( flash )" = '128mb' |
what is the age and diagnosis icd9 code of subject id 2560? | 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 demographic.age, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "2560" |
Which Crowd has an Away team of st kilda? | CREATE TABLE table_name_28 (crowd VARCHAR,away_team VARCHAR) | SELECT crowd FROM table_name_28 WHERE away_team = "st kilda" |
what are the four most commonly prescribed drugs that patients of the 60 or above were prescribed within 2 months after having been diagnosed with dmi ophth nt st uncntrld in a year before? | CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_icd_diagno... | 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 ... |
select Body, Id,PostId,Text from Posts, Comments where Id=PostID. | CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE ... | SELECT Body, Posts.Id, Comments.PostId, Comments.Text FROM Posts, Comments WHERE Posts.Id = Comments.PostId ORDER BY Comments.Score LIMIT 5 |
what is average age of patients whose admission location is phys referral/normal deli and primary disease is celo-vessicle fistula? | 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 AVG(demographic.age) FROM demographic WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.diagnosis = "CELO-VESSICLE FISTULA" |
Who is everyone on the men's doubles when men's singles is Ma Wenge? | CREATE TABLE table_28211988_1 (mens_doubles VARCHAR,mens_singles VARCHAR) | SELECT mens_doubles FROM table_28211988_1 WHERE mens_singles = "Ma Wenge" |
How many Attendances have a Score of 4 5? Question 4 | CREATE TABLE table_name_88 (attendance INTEGER,score VARCHAR) | SELECT MAX(attendance) FROM table_name_88 WHERE score = "4 – 5" |
Search posts by user and partial title. | CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE PostFeedback (Id number,PostId num... | SELECT p.Id AS "post_link", p.CreationDate, p.Score FROM Posts AS p LEFT OUTER JOIN Posts AS q ON p.ParentId = q.Id WHERE p.OwnerUserId = '##UserId:int##' AND COALESCE(p.Title, q.Title) LIKE '%##Query##%' ORDER BY p.CreationDate DESC |
What is the average height for hewitt class, with prom less than 86, and a Peak of gragareth? | CREATE TABLE table_name_45 (height__m_ INTEGER,peak VARCHAR,class VARCHAR,prom__m_ VARCHAR) | SELECT AVG(height__m_) FROM table_name_45 WHERE class = "hewitt" AND prom__m_ < 86 AND peak = "gragareth" |
What is the name of the coaster that opened in 2011 and is a euro-fighter model? | CREATE TABLE table_55049 ("Name" text,"Model" text,"Park" text,"Opened" text,"Status" text) | SELECT "Name" FROM table_55049 WHERE "Model" = 'euro-fighter' AND "Opened" = '2011' |
What is the division for the division semifinals playoffs? | CREATE TABLE table_16351 ("Year" text,"Division" text,"League" text,"Reg. Season" text,"Playoffs" text,"Avg. Attendance" real) | SELECT "Division" FROM table_16351 WHERE "Playoffs" = 'Division Semifinals' |
Bring the list of patients with hyperglycemia (hyponatremia) as their primary disease who are discharged to snf. | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SNF" AND demographic.diagnosis = "HYPERGLYCEMIA;HYPONATREMIA" |
Name the least bronze for silver being less than 0 | CREATE TABLE table_name_45 (bronze INTEGER,silver INTEGER) | SELECT MIN(bronze) FROM table_name_45 WHERE silver < 0 |
What nationality has a position of left wing, and a round greater than 4, with mattia baldi as the player? | CREATE TABLE table_name_75 (nationality VARCHAR,player VARCHAR,position VARCHAR,round VARCHAR) | SELECT nationality FROM table_name_75 WHERE position = "left wing" AND round > 4 AND player = "mattia baldi" |
how many games were produced from 1988 to 1993 ? | CREATE TABLE table_203_489 (id number,"year" number,"title" text,"system" text,"developer" text,"publisher" text) | SELECT COUNT("title") FROM table_203_489 WHERE "year" >= 1988 AND "year" <= 1993 |
who is the character when the artist is take and the year is before 2006? | CREATE TABLE table_name_75 (character VARCHAR,artist VARCHAR,year VARCHAR) | SELECT character FROM table_name_75 WHERE artist = "take" AND year < 2006 |
In the Phoenix Open, what was the winning score? | CREATE TABLE table_name_28 (winning_score VARCHAR,tournament VARCHAR) | SELECT winning_score FROM table_name_28 WHERE tournament = "phoenix open" |
What is the type of electronic with the Gamecube Platform? | CREATE TABLE table_name_10 (type VARCHAR,platform VARCHAR) | SELECT type FROM table_name_10 WHERE platform = "gamecube" |
Bar chart x axis building y axis maximal capacity, show by the X-axis from high to low. | CREATE TABLE prereq (course_id varchar(8),prereq_id varchar(8))CREATE TABLE advisor (s_ID varchar(5),i_ID varchar(5))CREATE TABLE course (course_id varchar(8),title varchar(50),dept_name varchar(20),credits numeric(2,0))CREATE TABLE takes (ID varchar(5),course_id varchar(8),sec_id varchar(8),semester varchar(6),year nu... | SELECT building, MAX(capacity) FROM classroom GROUP BY building ORDER BY building DESC |
Python posts containing the mojibake ' '. | CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDa... | SELECT Id AS "post_link", Title, CreationDate, Tags FROM Posts WHERE Tags LIKE '%python%' AND Body LIKE '% %' ORDER BY CreationDate DESC LIMIT 25 |
What date was there a crowd larger than 30,343? | CREATE TABLE table_32164 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Date" FROM table_32164 WHERE "Crowd" > '30,343' |
count the number of patients that are prescribed metoprolol tartrate in the same hospital encounter after having been diagnosed with abn react-cardiac cath until 3 years ago. | CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)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 time,cost number)CREATE TABLE ch... | 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 was the time of the race for Driver Jarno Trulli on a grid smaller than 13? | CREATE TABLE table_name_59 (time_retired VARCHAR,grid VARCHAR,driver VARCHAR) | SELECT time_retired FROM table_name_59 WHERE grid < 13 AND driver = "jarno trulli" |
What are the names and dates of races, and the names of the tracks where they are held? | CREATE TABLE race (race_id number,name text,class text,date text,track_id text)CREATE TABLE track (track_id number,name text,location text,seating number,year_opened number) | SELECT T1.name, T1.date, T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id |
For the category of most popular star with a result of won for 2007, what was the award? | CREATE TABLE table_name_27 (award VARCHAR,year VARCHAR,result VARCHAR,category VARCHAR) | SELECT award FROM table_name_27 WHERE result = "won" AND category = "most popular star" AND year = 2007 |
What score in the final had a tournament of $25,000 Glasgow, Great Britain? | CREATE TABLE table_56673 ("Outcome" text,"Tournament" text,"Surface" text,"Partnering" text,"Score in the final" text) | SELECT "Score in the final" FROM table_56673 WHERE "Tournament" = '$25,000 glasgow, great britain' |
What is the method of the match with a win res., 1 round, and a 3-2 record? | CREATE TABLE table_name_44 (method VARCHAR,record VARCHAR,res VARCHAR,round VARCHAR) | SELECT method FROM table_name_44 WHERE res = "win" AND round = 1 AND record = "3-2" |
Number of users by reputation range (15K-75K). High rep users based on the amount of reputation they have earned per day | 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 PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId ... | SELECT Id AS "user_link", DisplayName, Reputation, Location FROM Users WHERE (Reputation >= 15000) AND (Reputation <= 75000) ORDER BY Reputation DESC |
Tell me the lowest Grid for engine and driver of emerson fittipaldi with more laps than 70 | CREATE TABLE table_name_83 (grid INTEGER,laps VARCHAR,time_retired VARCHAR,driver VARCHAR) | SELECT MIN(grid) FROM table_name_83 WHERE time_retired = "engine" AND driver = "emerson fittipaldi" AND laps > 70 |
how many days have passed since the first heparin lock iv fluids of patient 004-86136 on this hospital encounter? | CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE lab (labid number,patientunitstayid number,lab... | 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 = '004-86136'... |
what are the four most frequently ordered procedures for patients who have previously received antiviral therapy - acyclovir within 2 months, since 2105? | CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 num... | SELECT t3.treatmentname FROM (SELECT t2.treatmentname, 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 = 'antiviral therapy - acyclovir' AND STRFT... |
What is the Outcome of the Match played after 2003 with a Score of 6 0, 6 3? | CREATE TABLE table_name_88 (outcome VARCHAR,year VARCHAR,score VARCHAR) | SELECT outcome FROM table_name_88 WHERE year > 2003 AND score = "6–0, 6–3" |
provide the number of patients whose days of hospital stay is greater than 14 and lab test name is bilirubin, direct? | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "14" AND lab.label = "Bilirubin, Direct" |
What was the course type on 22 May? | CREATE TABLE table_11707 ("Date" text,"Course" text,"Distance" text,"Type" text,"Winner" text) | SELECT "Type" FROM table_11707 WHERE "Date" = '22 may' |
What is the lowest pick from Elitserien (Sweden)? | CREATE TABLE table_57108 ("Pick #" real,"Player" text,"Nationality" text,"Position" text,"Team from" text,"League from" text) | SELECT MIN("Pick #") FROM table_57108 WHERE "League from" = 'elitserien (sweden)' |
what is the tallest peak in the sierra nevadas ? | CREATE TABLE table_204_25 (id number,"rank" number,"mountain peak" text,"mountain range" text,"elevation" text,"prominence" text,"isolation" text,"location" text) | SELECT "mountain peak" FROM table_204_25 WHERE "mountain range" = 'sierra nevada' ORDER BY "elevation" DESC LIMIT 1 |
How many years was there a peter jackson classic? | CREATE TABLE table_name_64 (year VARCHAR,championship VARCHAR) | SELECT COUNT(year) FROM table_name_64 WHERE championship = "peter jackson classic" |
A stacked bar chart about the total number in each competition type, and then split by country, and rank by the y axis in desc please. | CREATE TABLE competition (Competition_ID int,Year real,Competition_type text,Country text)CREATE TABLE competition_result (Competition_ID int,Club_ID_1 int,Club_ID_2 int,Score text)CREATE TABLE club (Club_ID int,name text,Region text,Start_year text)CREATE TABLE player (Player_ID int,name text,Position text,Club_ID int... | SELECT Country, COUNT(Country) FROM competition GROUP BY Competition_type, Country ORDER BY COUNT(Country) DESC |
What is the Film title used in nomination of the Film with a Serbian title of ? | CREATE TABLE table_43408 ("Year (Ceremony)" text,"Film title used in nomination" text,"Serbian title" text,"Director" text,"Result" text) | SELECT "Film title used in nomination" FROM table_43408 WHERE "Serbian title" = 'бело одело' |
What batting team played in Chittagong in 2003? | CREATE TABLE table_8802 ("Runs" text,"Wicket" text,"Batting partners" text,"Batting team" text,"Fielding team" text,"Venue" text,"Season" text) | SELECT "Batting team" FROM table_8802 WHERE "Venue" = 'chittagong' AND "Season" = '2003' |
show me the flights from MIAMI to DENVER | CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE fare (fare_id int,from_airport varchar,to_airport varchar,fare_basis_code text,fare_airline text,restriction_code text,one_direction_cost int,round_trip_cost int,round_trip_required varchar)CREATE TABLE dual_carrier (main_airl... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'MIAMI' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' ... |
What is the total grid number where the time/retired is +58.182 and the lap number is less than 67? | CREATE TABLE table_57630 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT SUM("Grid") FROM table_57630 WHERE "Time/Retired" = '+58.182' AND "Laps" < '67' |
What was the highest average attendance in the 2009 season? | CREATE TABLE table_name_94 (average_attendance INTEGER,season VARCHAR) | SELECT MAX(average_attendance) FROM table_name_94 WHERE season = "2009" |
Top users by bounties on Writing.SE. | CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,OwnerUserId number,Comment text,Text text,Title text,Tags text,RevisionGUID other)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal... | SELECT UserId AS "user_link", SUM(BountyAmount) FROM Votes WHERE NOT BountyAmount IS NULL AND VoteTypeId = 8 GROUP BY UserId ORDER BY SUM(BountyAmount) DESC |
Which date had the Hornets as the home team? | CREATE TABLE table_40651 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Leading scorer" text,"Record" text) | SELECT "Date" FROM table_40651 WHERE "Home" = 'hornets' |
Top answers by score or the year. | 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 Id AS "post_link", Score FROM Posts AS p WHERE YEAR(CreationDate) = '##year?2016##' AND p.PostTypeId = 2 ORDER BY Score DESC LIMIT 10 |
what is the fare from BOSTON to OAKLAND on UA | CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time in... | SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city... |
For employees with first names that end with the letter m, groups and count the first name to visualize a bar graph, and could you display in desc by the x-axis? | 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,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),COMMISSION_PCT decima... | SELECT FIRST_NAME, COUNT(FIRST_NAME) FROM employees WHERE FIRST_NAME LIKE '%m' GROUP BY FIRST_NAME ORDER BY FIRST_NAME DESC |
Who was the actor/actress with a first appearance is 3 june 2007? | CREATE TABLE table_3441 ("Actor/Actress" text,"Character" text,"First Appearance" text,"Last Appearance" text,"Duration" text,"Total" real) | SELECT "Actor/Actress" FROM table_3441 WHERE "First Appearance" = '3 June 2007' |
What is the highest pick from Washington? | CREATE TABLE table_78295 ("Pick" real,"Round" text,"Player" text,"Position" text,"School" text) | SELECT MAX("Pick") FROM table_78295 WHERE "School" = 'washington' |
What are the earnings for jim colbert with under 4 wins? | CREATE TABLE table_54471 ("Rank" real,"Player" text,"Country" text,"Earnings ($)" real,"Events" real,"Wins" real) | SELECT COUNT("Earnings ( $ )") FROM table_54471 WHERE "Player" = 'jim colbert' AND "Wins" < '4' |
What is the highest production code of the episodes having a US viewership of exactly 2.3? | CREATE TABLE table_30759 ("No in. series" real,"No in. season" real,"Title" text,"Original air date" text,"Production Code" real,"U.S. viewers (millions)" text) | SELECT MAX("Production Code") FROM table_30759 WHERE "U.S. viewers (millions)" = '2.3' |
Who is in February where has September is kristine hanson? | CREATE TABLE table_name_13 (february VARCHAR,september VARCHAR) | SELECT february FROM table_name_13 WHERE september = "kristine hanson" |
what is the highest runners when the jockey is frankie dettori and the placing is higher than 1? | CREATE TABLE table_name_68 (runners INTEGER,jockey VARCHAR,placing VARCHAR) | SELECT MAX(runners) FROM table_name_68 WHERE jockey = "frankie dettori" AND placing > 1 |
i would like to find a flight that goes from BOSTON to ORLANDO i would like it to have a stop in NEW YORK and i would like a flight that serves BREAKFAST | CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,length int,weight int,capacity int,pay_load int,cruising_speed int,range_miles int,pressurized varchar)CREATE TABLE flight_stop (flight_id int,... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop, food_service WHERE ((CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'NEW YOR... |
Return the names and ids of customers who have TN in their address by a bar chart, and sort in ascending by the y axis please. | CREATE TABLE Product_Suppliers (product_id INTEGER,supplier_id INTEGER,date_supplied_from DATETIME,date_supplied_to DATETIME,total_amount_purchased VARCHAR(80),total_value_purchased DECIMAL(19,4))CREATE TABLE Department_Stores (dept_store_id INTEGER,dept_store_chain_id INTEGER,store_name VARCHAR(80),store_address VARCH... | SELECT customer_name, customer_id FROM Customers WHERE customer_address LIKE "%TN%" ORDER BY customer_id |
when did patient 45316 recieve tissue microbiology test for the last time since 58 months ago? | 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_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE admissions (row_id numbe... | SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 45316) AND microbiologyevents.spec_type_desc = 'tissue' AND DATETIME(microbiologyevents.charttime) >= DATETIME(CURRENT_TIME(), '-58 month') ORDER BY mi... |
what is the score when the game is higher than 66 on march 28? | CREATE TABLE table_9335 ("Game" real,"March" real,"Opponent" text,"Score" text,"Record" text) | SELECT "Score" FROM table_9335 WHERE "Game" > '66' AND "March" = '28' |
What position did Rich Manning play? | CREATE TABLE table_44001 ("Player" text,"Nationality" text,"Position" text,"Years for Grizzlies" text,"School/Club Team" text) | SELECT "Position" FROM table_44001 WHERE "Player" = 'rich manning' |
give me the number of office admitted patients who had endoscopic retrograde cholangiopancreatography procedure. | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND procedures.short_title = "Endosc retro cholangiopa" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.