instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Which home team scored a 15.16 (106)? | CREATE TABLE table_53352 ("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_53352 WHERE "Home team score" = '15.16 (106)' |
A bar chart about what is the total revenue of each manufacturer?, and show by the total number of revenue in asc. | CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL) | SELECT Name, SUM(Revenue) FROM Manufacturers GROUP BY Name ORDER BY SUM(Revenue) |
how many patients whose death status is 0 and drug name is loperamide? | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.expire_flag = "0" AND prescriptions.drug = "Loperamide" |
Which episode was #1 in the order? | CREATE TABLE table_3950 ("Order" real,"Episode" text,"Original airdate" text,"Timeslot" text,"Viewers (millions)" text,"Nightly rank" real,"Weekly rank" text) | SELECT "Episode" FROM table_3950 WHERE "Order" = '1' |
Show all advisors who have at least two students. | CREATE TABLE Student (advisor VARCHAR) | SELECT advisor FROM Student GROUP BY advisor HAVING COUNT(*) >= 2 |
What is the evening gown score for the contestant from Mississippi? | CREATE TABLE table_44874 ("State" text,"Preliminary Average" text,"Interview" text,"Swimsuit" text,"Evening Gown" text,"Semifinal Average" text) | SELECT "Evening Gown" FROM table_44874 WHERE "State" = 'mississippi' |
How many patients have their marital status as widowed and operated for procedure icd9 code 4610? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "WIDOWED" AND procedures.icd9_code = "4610" |
What are the different statement ids on accounts, and the number of accounts for each. Visualize by scatter chart. | CREATE TABLE Ref_Budget_Codes (Budget_Type_Code CHAR(15),Budget_Type_Description VARCHAR(255))CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR(15),Document_Type_Name VARCHAR(255),Document_Type_Description VARCHAR(255))CREATE TABLE Accounts (Account_ID INTEGER,Statement_ID INTEGER,Account_Details VARCHAR(255))CR... | SELECT Statement_ID, COUNT(*) FROM Accounts GROUP BY Statement_ID |
List all dbm's when profiles are 8a. | CREATE TABLE table_26430 ("Profile" text,"Bandwidth (MHz)" text,"Number of carriers" real,"Carrier bandwidth (kHz)" text,"Power (dBm)" text,"Max. downstream throughput (Mbit/s)" real) | SELECT "Power ( dBm )" FROM table_26430 WHERE "Profile" = '8a' |
What season had a date of 30 august 1980 | CREATE TABLE table_6774 ("Season" text,"Round" text,"Date" text,"Home" text,"Away" text,"Result" text) | SELECT "Season" FROM table_6774 WHERE "Date" = '30 august 1980' |
how many patients whose marital status is divorced and diagnoses short title is heart valve transplant? | 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.marital_status = "DIVORCED" AND diagnoses.short_title = "Heart valve transplant" |
What was the record at the game that had a loss of Spillner (1-8)? | CREATE TABLE table_68233 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Record" text) | SELECT "Record" FROM table_68233 WHERE "Loss" = 'spillner (1-8)' |
when did patient 1372 since 102 months ago last get a mrsa screen microbiology test? | CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE diagnoses_icd (row_id number,subject_id number,... | SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1372) AND microbiologyevents.spec_type_desc = 'mrsa screen' AND DATETIME(microbiologyevents.charttime) >= DATETIME(CURRENT_TIME(), '-102 month') ORDER ... |
which NHL team has a College/Junior/Club Team (League) of shattuck-saint mary's school (midget major aaa)? | CREATE TABLE table_name_63 (nhl_team VARCHAR,college_junior_club_team__league_ VARCHAR) | SELECT nhl_team FROM table_name_63 WHERE college_junior_club_team__league_ = "shattuck-saint mary's school (midget major aaa)" |
What is the state and enrollment of the colleges where have any students who got accepted in the tryout decision. Plot them as bar chart. | CREATE TABLE Tryout (pID numeric(5,0),cName varchar(20),pPos varchar(8),decision varchar(3))CREATE TABLE College (cName varchar(20),state varchar(2),enr numeric(5,0))CREATE TABLE Player (pID numeric(5,0),pName varchar(20),yCard varchar(3),HS numeric(5,0)) | SELECT state, enr FROM College AS T1 JOIN Tryout AS T2 ON T1.cName = T2.cName WHERE T2.decision = 'yes' |
what is the minimum kerry # with bush % being 78.40% | CREATE TABLE table_830 ("County" text,"Bush #" real,"Bush %" text,"Kerry #" real,"Kerry %" text,"Others #" real,"Others %" text,"Total" real) | SELECT MIN("Kerry #") FROM table_830 WHERE "Bush %" = '78.40%' |
What model has a total produced more than 5 and a prime move of 12-251c? | CREATE TABLE table_70737 ("Model" text,"Build date" text,"Total produced" real,"Wheel arrangement" text,"Prime mover" text,"Power output" text) | SELECT "Model" FROM table_70737 WHERE "Total produced" > '5' AND "Prime mover" = '12-251c' |
Draw a scatter chart about the correlation between Team_ID and All_Games_Percent , and group by attribute All_Home. | 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 Team_ID, All_Games_Percent FROM basketball_match GROUP BY All_Home |
how many days have elapsed since the first time that patient 004-13127 stayed in ward 236 in this hospital visit? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE allergy (allergyid number,patientunitst... | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '004-13127' AND patient.wardid = 236 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1 |
What is the stuffit that has bzip and LHA/LZH of no? | CREATE TABLE table_35052 ("gzip" text,"bzip2" text,"LHA/LZH" text,"StuffIt" text,"StuffIt X" text,"ISO/CD Image" text) | SELECT "StuffIt" FROM table_35052 WHERE "bzip2" = 'no' AND "LHA/LZH" = 'no' |
How many categories are there when the attribute is 'onreset'? | CREATE TABLE table_1507852_1 (category VARCHAR,attribute VARCHAR) | SELECT COUNT(category) FROM table_1507852_1 WHERE attribute = "onreset" |
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of job_id and department_id in a bar chart, list in ascending by the DEPARTMENT_ID 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 JOB_ID, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY DEPARTMENT_ID |
Name the cancelable for onmouseover | CREATE TABLE table_name_25 (cancelable VARCHAR,attribute VARCHAR) | SELECT cancelable FROM table_name_25 WHERE attribute = "onmouseover" |
What is every category wise when the multi lane is 677? | CREATE TABLE table_30709 ("Sl. No" real,"Category wise" text,"Single lane" real,"Intermediate lane" real,"Double lane" real,"Multi lane" real,"Total" real) | SELECT "Category wise" FROM table_30709 WHERE "Multi lane" = '677' |
Display a bar chart for how many medications are prescribed for each brand?, and I want to display in desc by the x axis. | CREATE TABLE Stay (StayID INTEGER,Patient INTEGER,Room INTEGER,StayStart DATETIME,StayEnd DATETIME)CREATE TABLE Physician (EmployeeID INTEGER,Name VARCHAR(30),Position VARCHAR(30),SSN INTEGER)CREATE TABLE Room (RoomNumber INTEGER,RoomType VARCHAR(30),BlockFloor INTEGER,BlockCode INTEGER,Unavailable BOOLEAN)CREATE TABLE... | SELECT Name, COUNT(*) FROM Medication AS T1 JOIN Prescribes AS T2 ON T1.Code = T2.Medication GROUP BY T1.Brand ORDER BY Name DESC |
what are the genders of patient 7107? | CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)C... | SELECT patients.gender FROM patients WHERE patients.subject_id = 7107 |
Name the pe h- e-j for | CREATE TABLE table_17015_2 (pe̍h_ōe_jī VARCHAR,chinese VARCHAR) | SELECT pe̍h_ōe_jī FROM table_17015_2 WHERE chinese = "前金區" |
how many days elapsed since patient 006-122712 received the last procedure in their current hospital visit? | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,he... | 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 = '006-122712... |
How many goals scored have utenis utena as the club, with wins less than 8? | CREATE TABLE table_name_31 (goals_scored INTEGER,club VARCHAR,wins VARCHAR) | SELECT SUM(goals_scored) FROM table_name_31 WHERE club = "utenis utena" AND wins < 8 |
What was the Week number on November 20, 1977? | CREATE TABLE table_44022 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real) | SELECT SUM("Week") FROM table_44022 WHERE "Date" = 'november 20, 1977' |
What was the score against houston? | CREATE TABLE table_25505 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "Score" FROM table_25505 WHERE "Team" = 'Houston' |
What is the name of the airline with the most routes? | CREATE TABLE routes (rid number,dst_apid number,dst_ap text,src_apid number,src_ap text,alid number,airline text,codeshare text)CREATE TABLE airlines (alid number,name text,iata text,icao text,callsign text,country text,active text)CREATE TABLE airports (apid number,name text,city text,country text,x number,y number,el... | SELECT T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.name ORDER BY COUNT(*) DESC LIMIT 1 |
What is the song for Dixie Chicks? | CREATE TABLE table_23981771_1 (song_title VARCHAR,artist VARCHAR) | SELECT song_title FROM table_23981771_1 WHERE artist = "Dixie Chicks" |
Which League Cup has a Scottish Cup larger than 69? | CREATE TABLE table_47270 ("Name" text,"Years" text,"League" real,"Scottish Cup" real,"League Cup" real,"Europe" real,"Total" real) | SELECT SUM("League Cup") FROM table_47270 WHERE "Scottish Cup" > '69' |
Who has a finish of t66? | CREATE TABLE table_name_89 (player VARCHAR,finish VARCHAR) | SELECT player FROM table_name_89 WHERE finish = "t66" |
Which Status has a Building of the rhombus? | CREATE TABLE table_49601 ("Building" text,"Location" text,"Height" text,"Floors" real,"Status" text) | SELECT "Status" FROM table_49601 WHERE "Building" = 'the rhombus' |
What is the most recent championship for FISA? | CREATE TABLE table_69519 ("Year" real,"Entrant" text,"Chassis" text,"Engine" text,"Points" real) | SELECT MAX("Year") FROM table_69519 WHERE "Entrant" = 'fisa' |
count the number of patients who were admitted before 2166 and who have also undergone arterial catheterization. | 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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2166" AND procedures.long_title = "Arterial catheterization" |
how many patients were prescribed the drug amoxicillin-clavulanic acid in 2104? | CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title 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 inputevents_cv (r... | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'amoxicillin-clavulanic acid' AND STRFTIME('%y', prescriptions.startdate) = '2104') |
What is the lowest grid value with fewer than 17 laps and constructor Sauber - Petronas? | CREATE TABLE table_name_48 (grid INTEGER,laps VARCHAR,constructor VARCHAR) | SELECT MIN(grid) FROM table_name_48 WHERE laps < 17 AND constructor = "sauber - petronas" |
what is age and primary disease of subject name steven sepulveda? | 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 demographic.age, demographic.diagnosis FROM demographic WHERE demographic.name = "Steven Sepulveda" |
What is the total laps when manufacturer of gilera has time of 40:19.910 and grid is larger than 3? | CREATE TABLE table_name_86 (laps INTEGER,grid VARCHAR,manufacturer VARCHAR,time VARCHAR) | SELECT SUM(laps) FROM table_name_86 WHERE manufacturer = "gilera" AND time = "40:19.910" AND grid > 3 |
Who was on the prohibition ticket when the Greenback ticket had Thomas Armstrong? | CREATE TABLE table_42802 ("Office" text,"Democratic ticket" text,"Republican ticket" text,"Prohibition ticket" text,"Greenback ticket" text) | SELECT "Prohibition ticket" FROM table_42802 WHERE "Greenback ticket" = 'thomas armstrong' |
What is the party where the incumbent is overton brooks? | CREATE TABLE table_1342198_18 (party VARCHAR,incumbent VARCHAR) | SELECT party FROM table_1342198_18 WHERE incumbent = "Overton Brooks" |
What is the result/games of Sun 11/28/10 as the date/year? | CREATE TABLE table_24369 ("Type of Record" text,"Attendance" real,"Date/Year" text,"Stadium" text,"Result/Games" text) | SELECT "Result/Games" FROM table_24369 WHERE "Date/Year" = 'Sun 11/28/10' |
Pick # that has a Name of jaimie thomas, and a Round smaller than 7 is how many numbers? | CREATE TABLE table_67565 ("Round" real,"Pick #" real,"Overall" real,"Name" text,"Position" text,"College" text) | SELECT COUNT("Pick #") FROM table_67565 WHERE "Name" = 'jaimie thomas' AND "Round" < '7' |
Number of Posts with Ids in a given interval. | CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)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 PendingFla... | SELECT COUNT(Id) FROM Posts WHERE Id >= '##minId##' AND Id < '##maxId##' |
what is the format for the country united kingdom on 20 october 2008? | CREATE TABLE table_63087 ("Country" text,"Date" text,"Label" text,"Format" text,"Catalogue No." text) | SELECT "Format" FROM table_63087 WHERE "Country" = 'united kingdom' AND "Date" = '20 october 2008' |
On 10 November 2007, what was the venue? | CREATE TABLE table_39968 ("Date" text,"Opponent" text,"Venue" text,"Result" text,"Attendance" real) | SELECT "Venue" FROM table_39968 WHERE "Date" = '10 november 2007' |
What is the highest attendance for the game that was before week 6 on October 22, 1967? | CREATE TABLE table_36043 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real) | SELECT MAX("Attendance") FROM table_36043 WHERE "Date" = 'october 22, 1967' AND "Week" < '6' |
when was the last time that patient 006-80884 had the foley cath output since 876 days ago? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE intakeoutput (intakeoutputid number,pat... | SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-80884')) AND intakeoutput.cellpath LIKE '%output%... |
what is the first performance of the last performance on 03/29/1957 | CREATE TABLE table_22883 ("Performer" text,"Performances" real,"Category" text,"First performance" text,"Last performance" text) | SELECT "First performance" FROM table_22883 WHERE "Last performance" = '03/29/1957' |
What is the highest River Mile that has a pool length of 42.2 miles or a lock/lift drop of 21 feet? | CREATE TABLE table_63447 ("Locks & Dam" text,"Location [L ]" text,"River Mile" real,"Lock Side" text,"Lock Lift/Drop (in feet)" text,"Pool Length (miles)" text) | SELECT MAX("River Mile") FROM table_63447 WHERE "Pool Length (miles)" = '42.2' AND "Lock Lift/Drop (in feet)" = '21' |
List the genre name and genre id using a bar chart. | CREATE TABLE store (store_id TINYINT UNSIGNED,manager_staff_id TINYINT UNSIGNED,address_id SMALLINT UNSIGNED,last_update TIMESTAMP)CREATE TABLE staff (staff_id TINYINT UNSIGNED,first_name VARCHAR(45),last_name VARCHAR(45),address_id SMALLINT UNSIGNED,picture BLOB,email VARCHAR(50),store_id TINYINT UNSIGNED,active BOOLE... | SELECT T2.name, T1.category_id FROM film_category AS T1 JOIN category AS T2 ON T1.category_id = T2.category_id |
bring up flights from MILWAUKEE to ORLANDO on wednesday night or thursday morning | CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,departure_time int,dual_carrier text,flight_days text,flight_id int,flig... | 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, date_day, days, flight WHERE ((((flight.departure_time <= 2359 AND flight.departure_time >= 1800) AND date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year... |
My answers: Votes and question viewcount. | CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number... | SELECT a.Id AS "post_link", a.Score AS AnswerScore, q.ViewCount FROM Posts AS a JOIN Posts AS q ON a.ParentId = q.Id WHERE a.OwnerUserId = @UserId ORDER BY a.Score DESC, q.ViewCount DESC |
What country had a Finish of t8? | CREATE TABLE table_name_59 (country VARCHAR,finish VARCHAR) | SELECT country FROM table_name_59 WHERE finish = "t8" |
what is the number of patients whose days of hospital stay is greater than 20 and diagnoses short title is hx of breast malignancy? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,sho... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "20" AND diagnoses.short_title = "Hx of breast malignancy" |
How many points for the cooper car company after 1959? | CREATE TABLE table_name_90 (points INTEGER,entrant VARCHAR,year VARCHAR) | SELECT SUM(points) FROM table_name_90 WHERE entrant = "cooper car company" AND year > 1959 |
Name the competition for australia 13, new zealand 40, drawn 3 | CREATE TABLE table_20251343_4 (competition VARCHAR,head_to_head VARCHAR) | SELECT competition FROM table_20251343_4 WHERE head_to_head = "Australia 13, New Zealand 40, Drawn 3" |
Who owns the kool-fm branding? | CREATE TABLE table_7982 ("Frequency" text,"Call sign" text,"Branding" text,"Format" text,"Owner" text) | SELECT "Owner" FROM table_7982 WHERE "Branding" = 'kool-fm' |
How many picks did the Chicago Black Hawks get? | CREATE TABLE table_29011 ("Pick #" real,"Player" text,"Position" text,"Nationality" text,"NHL team" text,"College/junior/club team" text) | SELECT COUNT("Pick #") FROM table_29011 WHERE "NHL team" = 'Chicago Black Hawks' |
How many parties does william b. cravens represent? | CREATE TABLE table_18641 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text) | SELECT COUNT("Party") FROM table_18641 WHERE "Incumbent" = 'William B. Cravens' |
How many total positions are there for utah college? | CREATE TABLE table_24283 ("Pick #" real,"CFL Team" text,"Player" text,"Position" text,"College" text) | SELECT COUNT("Position") FROM table_24283 WHERE "College" = 'Utah' |
What 2009 has grand slam tournaments of 2008? | CREATE TABLE table_41500 ("Tournament" text,"2004" text,"2005" text,"2006" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text) | SELECT "2009" FROM table_41500 WHERE "2008" = 'grand slam tournaments' |
For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of hire_date and the average of salary bin hire_date by time, and I want to list by the mean salary in asc. | 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 decimal(2,2),MANAGER_ID decimal(6,0),DEPARTMENT_ID decimal(4,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0)... | SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(SALARY) |
What is 2nd Party, when 1st Member is 'Alan Dower'? | CREATE TABLE table_12820 ("Election" text,"1st Member" text,"1st Party" text,"2nd Member" text,"2nd Party" text) | SELECT "2nd Party" FROM table_12820 WHERE "1st Member" = 'alan dower' |
List three countries which are the origins of the least players. | CREATE TABLE player (birth_country VARCHAR) | SELECT birth_country FROM player GROUP BY birth_country ORDER BY COUNT(*) LIMIT 3 |
How many papers on computer science education in 2016 ? | CREATE TABLE paper (paperid int,title varchar,venueid int,year int,numciting int,numcitedby int,journalid int)CREATE TABLE paperdataset (paperid int,datasetid int)CREATE TABLE cite (citingpaperid int,citedpaperid int)CREATE TABLE writes (paperid int,authorid int)CREATE TABLE dataset (datasetid int,datasetname varchar)C... | SELECT DISTINCT COUNT(paper.paperid) FROM paper, venue WHERE paper.year = 2016 AND venue.venueid = paper.venueid AND venue.venuename = 'computer science education' |
What was the 2009 results that has q1 for 2010, and A as the result for 2011? | CREATE TABLE table_50383 ("Tournament" text,"2003" text,"2004" text,"2005" text,"2006" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text) | SELECT "2009" FROM table_50383 WHERE "2010" = 'q1' AND "2011" = 'a' |
who is the only player to have a negative yard average ? | CREATE TABLE table_203_8 (id number,"player" text,"rec." number,"yards" number,"avg." number,"td's" number,"long" number) | SELECT "player" FROM table_203_8 WHERE "yards" < 0 |
how many patients were admitted to the hospital before the year 2138 with a lab test folate? | 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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2138" AND lab.label = "Folate" |
What is the last 10 meetings that have slu, 9-8 as the overall record? | CREATE TABLE table_name_52 (last_10_meetings VARCHAR,overall_record VARCHAR) | SELECT last_10_meetings FROM table_name_52 WHERE overall_record = "slu, 9-8" |
What shows for 2007 at the Olympic Games as tournament. | CREATE TABLE table_67511 ("Tournament" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text) | SELECT "2007" FROM table_67511 WHERE "Tournament" = 'olympic games' |
Which set 3 has a Time of 10:00, and a Score of 3 2, and a Total of 113 102? | CREATE TABLE table_name_61 (set_3 VARCHAR,total VARCHAR,time VARCHAR,score VARCHAR) | SELECT set_3 FROM table_name_61 WHERE time = "10:00" AND score = "3–2" AND total = "113–102" |
What is the date of the race when Jack Brabham is in the pole position and the circuit is Spa-Francorchamps? | CREATE TABLE table_54769 ("Race" text,"Circuit" text,"Date" text,"Pole position" text,"Fastest lap" text,"Winning driver" text,"Constructor" text,"Tyre" text,"Report" text) | SELECT "Date" FROM table_54769 WHERE "Pole position" = 'jack brabham' AND "Circuit" = 'spa-francorchamps' |
which song did not have more than 15 % of the votes and was not unknown ? | CREATE TABLE table_203_755 (id number,"singing position" number,"song title" text,"informal translation" text,"act" text,"percentage of votes" text,"final position" text) | SELECT "song title" FROM table_203_755 WHERE "percentage of votes" <= 15 |
what are the five most frequently occurring specimen tests in the last year? | CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,syst... | SELECT t1.culturesite FROM (SELECT microlab.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM microlab WHERE DATETIME(microlab.culturetakentime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY microlab.culturesite) AS t1 WHERE t1.c1 <= 5 |
among patients who were diagnosed with congestive heart failure since 3 years ago, what are the top five most commonly prescribed drugs that followed afterwards in the same month to the patients aged 60 or above? | CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,observationtime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid... | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'congestive heart failure' AND DATETIME(diagnosis.d... |
What is the average number of games played associated with a first game in 1997 and over 0 games drawn? | CREATE TABLE table_15289 ("First game" real,"Played" real,"Drawn" real,"Lost" real,"Percentage" text) | SELECT AVG("Played") FROM table_15289 WHERE "First game" = '1997' AND "Drawn" > '0' |
What was the season where the team reached a GP of 244? | CREATE TABLE table_73374 ("Season" text,"League" text,"Division" text,"GP" real,"W" real,"L" real,"T" real,"OTL" real,"SOL" real,"Pts" real,"PCT" text,"GF" real,"GA" real,"PIM" real,"Coach(es)" text,"Result" text) | SELECT "Season" FROM table_73374 WHERE "GF" = '244' |
What is the pick number for School of lsu? | CREATE TABLE table_11070 ("Pick" real,"Round" real,"Player" text,"Position" text,"School" text) | SELECT SUM("Pick") FROM table_11070 WHERE "School" = 'lsu' |
calculate the average of female patients who have medicaid health insurance. | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marita... | SELECT AVG(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.insurance = "Medicaid" |
What is the Partner with Opponents in the final with roy emerson rod laver, with Date smaller than 1975? | CREATE TABLE table_53734 ("Outcome" text,"Date" real,"Tournament" text,"Partner" text,"Opponents in the final" text,"Score in the final" text) | SELECT "Partner" FROM table_53734 WHERE "Opponents in the final" = 'roy emerson rod laver' AND "Date" < '1975' |
count the number of patients whose gender is m and diagnoses long title is injury to femoral nerve? | 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 lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.long_title = "Injury to femoral nerve" |
Name the least yes votes for yes passed | CREATE TABLE table_3351 ("meas. num" real,"passed" text,"YES votes" real,"NO votes" real,"% YES" text,"Const. Amd.?" text,"type" text,"description" text) | SELECT MIN("YES votes") FROM table_3351 WHERE "passed" = 'YES' |
count the number of patients whose death status is 1 and diagnoses long title is other persistent mental disorders due to conditions classified elsewhere? | 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "1" AND diagnoses.long_title = "Other persistent mental disorders due to conditions classified elsewhere" |
What is the transfer window for Hleb? | CREATE TABLE table_12746 ("Nat." text,"Name" text,"Moving from" text,"Type" text,"Transfer window" text,"Ends" real,"Transfer fee" text) | SELECT "Transfer window" FROM table_12746 WHERE "Name" = 'hleb' |
Which previous conference is associated with Penn school? | CREATE TABLE table_71236 ("School" text,"Location" text,"Mascot" text,"County" text,"Enrollment IHSAA Class" text,"Joined" real,"Previous Conference" text) | SELECT "Previous Conference" FROM table_71236 WHERE "School" = 'penn' |
how many camps did vavuniya represent ? | CREATE TABLE table_204_217 (id number,"camp" text,"div sec\ndivision" text,"admin\ndistrict" text,"9 feb" number,"11 feb" number,"16 feb" number,"25 feb" number,"27 feb" number,"2 mar" number,"4 mar" number,"6 mar" number,"11 mar" number,"13 mar" number,"24 mar" number,"30 mar" number,"31 mar" number) | SELECT COUNT("camp") FROM table_204_217 WHERE "div sec\ndivision" = 'vavuniya' |
Draw a bar chart for how many different locations does each school have? | CREATE TABLE ENROLL (CLASS_CODE varchar(5),STU_NUM int,ENROLL_GRADE varchar(50))CREATE TABLE CLASS (CLASS_CODE varchar(5),CRS_CODE varchar(10),CLASS_SECTION varchar(2),CLASS_TIME varchar(20),CLASS_ROOM varchar(8),PROF_NUM int)CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCHOOL_CODE varchar(8),EM... | SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_ADDRESS) FROM DEPARTMENT |
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of email and department_id , sort in desc by the X. | CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))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... | SELECT EMAIL, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMAIL DESC |
What date did the home team score 12.12 (84)? | CREATE TABLE table_54833 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Date" FROM table_54833 WHERE "Home team score" = '12.12 (84)' |
What year was Waynesburg University founded in Pennsylvania? | CREATE TABLE table_name_82 (year_founded VARCHAR,state__province VARCHAR,institution_name VARCHAR) | SELECT year_founded FROM table_name_82 WHERE state__province = "pennsylvania" AND institution_name = "waynesburg university" |
What was the attendance on september 8? | CREATE TABLE table_name_71 (attendance INTEGER,date VARCHAR) | SELECT AVG(attendance) FROM table_name_71 WHERE date = "september 8" |
what is the last flight from DALLAS to BOSTON in the evening | CREATE TABLE flight_fare (flight_id int,fare_id 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 compartment_class (compartment varchar,class_type varchar)CREATE TABLE fli... | 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 = 'DALLAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTO... |
please show me the flights from WASHINGTON to SAN FRANCISCO | CREATE TABLE fare_basis (fare_basis_code text,booking_class text,class_type text,premium text,economy text,discounted text,night text,season text,basis_days text)CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,sat... | 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 = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN... |
what is the lowest rank when the peak position is 2, certification is platinum and the album is my december? | CREATE TABLE table_14043 ("Rank" real,"Artist" text,"Album" text,"Peak position" text,"Sales" real,"Certification" text) | SELECT MIN("Rank") FROM table_14043 WHERE "Peak position" = '2' AND "Certification" = 'platinum' AND "Album" = 'my december' |
Bin the hire date into Month interval, and then compute the average salary of employees in each month for a bar chart, note that just select those employees without the letter M in their first name, display by the the average of salary 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 countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE... | SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT FIRST_NAME LIKE '%M%' ORDER BY AVG(SALARY) DESC |
What is the Position of Pick #321? | CREATE TABLE table_name_97 (position VARCHAR,pick__number VARCHAR) | SELECT position FROM table_name_97 WHERE pick__number = 321 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.