instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
what is the average engine type listed ? | CREATE TABLE table_204_939 (id number,"year" number,"chassis" text,"engine" text,"start" text,"finish" text) | SELECT "engine" FROM table_204_939 GROUP BY "engine" ORDER BY COUNT(*) DESC LIMIT 1 |
Which Outcome has a Score of 6 2, 6 2? | CREATE TABLE table_name_20 (outcome VARCHAR,score VARCHAR) | SELECT outcome FROM table_name_20 WHERE score = "6–2, 6–2" |
Which Goals against has Wins of 13, and Goals for larger than 42, and more than 9 Losses? | CREATE TABLE table_12373 ("Position" real,"Club" text,"Played" real,"Points" real,"Wins" real,"Draws" real,"Losses" real,"Goals for" real,"Goals against" real,"Goal Difference" real) | SELECT AVG("Goals against") FROM table_12373 WHERE "Wins" = '13' AND "Goals for" > '42' AND "Losses" > '9' |
What shows for Try bonus when the points against are 451? | CREATE TABLE table_name_37 (try_bonus VARCHAR,points_against VARCHAR) | SELECT try_bonus FROM table_name_37 WHERE points_against = "451" |
known allergy or hypersensitivity to milk or soy products | CREATE TABLE table_train_119 ("id" int,"systolic_blood_pressure_sbp" int,"hemoglobin_a1c_hba1c" float,"diastolic_blood_pressure_dbp" int,"hypotension" bool,"allergy_to_milk" bool,"allergy_to_soy" bool,"body_mass_index_bmi" float,"plasma_creatinine" float,"NOUSE" float) | SELECT * FROM table_train_119 WHERE allergy_to_milk = 1 OR allergy_to_soy = 1 |
what year was the last time tigerair offered flights to xiamen ? | CREATE TABLE table_204_49 (id number,"city" text,"country" text,"iata" text,"icao" text,"airport" text,"commenced" number,"ended" text) | SELECT "ended" FROM table_204_49 WHERE "city" = 'xiamen' |
body mass index 25 _ 39.9 kg / m2 | CREATE TABLE table_train_244 ("id" int,"fasting_venous_plasma_glucose" int,"hemoglobin_a1c_hba1c" float,"diabetic" string,"capillary_glycated_hemoglobin" float,"fasting_capillary_glucose" int,"borderline_fasting_capillary_glucose_level" int,"body_mass_index_bmi" float,"fasting_glucose" int,"NOUSE" float) | SELECT * FROM table_train_244 WHERE body_mass_index_bmi >= 25 AND body_mass_index_bmi <= 39.9 |
Group and count the move in date in a bar chart, and bin the X-axis into week day interval. | CREATE TABLE Customer_Event_Notes (Customer_Event_Note_ID INTEGER,Customer_Event_ID INTEGER,service_type_code CHAR(15),resident_id INTEGER,property_id INTEGER,date_moved_in DATETIME)CREATE TABLE Timed_Status_of_Things (thing_id INTEGER,Date_and_Date DATETIME,Status_of_Thing_Code CHAR(15))CREATE TABLE Residents_Services... | SELECT date_moved_in, COUNT(date_moved_in) FROM Customer_Events |
find out the number of urgent hospital admission patients who had neutrophil lab test done. | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.label = "Neutrophils" |
Find the number of stores in each city Plot them as bar chart, show by the x-axis in ascending. | CREATE TABLE district (District_ID int,District_name text,Headquartered_City text,City_Population real,City_Area real)CREATE TABLE store_product (Store_ID int,Product_ID int)CREATE TABLE product (product_id int,product text,dimensions text,dpi real,pages_per_minute_color real,max_page_size text,interface text)CREATE TA... | SELECT Headquartered_City, COUNT(*) FROM store AS t1 JOIN store_district AS t2 ON t1.Store_ID = t2.Store_ID JOIN district AS t3 ON t2.District_ID = t3.District_ID GROUP BY t3.Headquartered_City ORDER BY Headquartered_City |
What is the highest games from a game with points less than 4, drawn of 1 and a lost less than 6? | CREATE TABLE table_name_58 (games INTEGER,lost VARCHAR,points VARCHAR,drawn VARCHAR) | SELECT MAX(games) FROM table_name_58 WHERE points < 4 AND drawn = 1 AND lost < 6 |
Which year did Aya Ohori play in the Women's Singles? | CREATE TABLE table_71908 ("Year" real,"Men's singles" text,"Women's singles" text,"Men's doubles" text,"Women's doubles" text,"Mixed doubles" text) | SELECT "Year" FROM table_71908 WHERE "Women's singles" = 'aya ohori' |
What TV season was the 1st season? | CREATE TABLE table_31389 ("Season" text,"Season premiere" text,"Season finale" text,"TV season" text,"Ranking" text,"Viewers (in millions)" text) | SELECT "TV season" FROM table_31389 WHERE "Season" = '1st' |
Give me the comparison about the sum of ID over the Nationality , and group by attribute Nationality by a bar chart, could you order by the y axis in asc? | CREATE TABLE event (ID int,Name text,Stadium_ID int,Year 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,Event_ID int)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 te... | SELECT Nationality, SUM(ID) FROM swimmer GROUP BY Nationality ORDER BY SUM(ID) |
What event did Patti Lank have the winning skip? | CREATE TABLE table_name_11 (event VARCHAR,winning_skip VARCHAR) | SELECT event FROM table_name_11 WHERE winning_skip = "patti lank" |
What is the Place of the couple with a Rank smaller than 7 and 514.55 Points? | CREATE TABLE table_name_22 (placings INTEGER,rank VARCHAR,points VARCHAR) | SELECT SUM(placings) FROM table_name_22 WHERE rank < 7 AND points = 514.55 |
What are the different product names for products that have the 'warm' characteristic:? | CREATE TABLE products (product_id number,color_code text,product_category_code text,product_name text,typical_buying_price text,typical_selling_price text,product_description text,other_product_details text)CREATE TABLE ref_characteristic_types (characteristic_type_code text,characteristic_type_description text)CREATE ... | SELECT DISTINCT t1.product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN characteristics AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t3.characteristic_name = "warm" |
what is UA | CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE code_description (... | SELECT DISTINCT airline_code FROM airline WHERE airline_code = 'UA' |
how many days has passed since patient 30826 was admitted into the hospital? | CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)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_i... | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', admissions.admittime)) FROM admissions WHERE admissions.subject_id = 30826 AND admissions.dischtime IS NULL |
What was the average money for United States when Lanny Wadkins played? | CREATE TABLE table_59688 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text,"Money ($)" real) | SELECT AVG("Money ( $ )") FROM table_59688 WHERE "Country" = 'united states' AND "Player" = 'lanny wadkins' |
What are the names of the activities Mark Giuliano is involved in | CREATE TABLE faculty (facid number,lname text,fname text,rank text,sex text,phone number,room text,building text)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE participates_in (stuid number,actid number)CREATE TABLE faculty_participat... | SELECT T3.activity_name FROM faculty AS T1 JOIN faculty_participates_in AS T2 ON T1.facid = T2.facid JOIN activity AS T3 ON T3.actid = T2.actid WHERE T1.fname = "Mark" AND T1.lname = "Giuliano" |
Name the delegate first elected in 2003? | CREATE TABLE table_19069 ("District" text,"Counties Represented" text,"Delegate" text,"Party" text,"First Elected" real,"Committee" text) | SELECT "Delegate" FROM table_19069 WHERE "First Elected" = '2003' |
What is the Series of the Filmography with a Release date of 1946-03-16? | CREATE TABLE table_65109 ("Title" text,"Series" text,"Director" text,"Production Number" text,"Release date" text) | SELECT "Series" FROM table_65109 WHERE "Release date" = '1946-03-16' |
What nation has 187.84 points? | CREATE TABLE table_52851 ("Rank" real,"Name" text,"Nation" text,"Points" real,"Places" text) | SELECT "Nation" FROM table_52851 WHERE "Points" = '187.84' |
What was total size of the crowd at a home game for north melbourne? | CREATE TABLE table_name_93 (crowd INTEGER,home_team VARCHAR) | SELECT SUM(crowd) FROM table_name_93 WHERE home_team = "north melbourne" |
Who was the opponents head coach with the result L, 56-6? | CREATE TABLE table_28464 ("Year" real,"FBS Opponent" text,"Result" text,"Opponents Conference" text,"Opponents Head Coach" text,"Charleston Southerns Head Coach" text) | SELECT "Opponents Head Coach" FROM table_28464 WHERE "Result" = 'L, 56-6' |
What episode number in the season was written by Greg nelson and directed by Keith samples? | CREATE TABLE table_27547668_3 (no VARCHAR,written_by VARCHAR,directed_by VARCHAR) | SELECT no FROM table_27547668_3 WHERE written_by = "Greg Nelson" AND directed_by = "Keith Samples" |
What are the ids, scores, and dates of the games which caused at least two injury accidents? | CREATE TABLE injury_accident (game_id number,id number,player text,injury text,number_of_matches text,source text)CREATE TABLE game (stadium_id number,id number,season number,date text,home_team text,away_team text,score text,competition text)CREATE TABLE stadium (id number,name text,home_games number,average_attendanc... | SELECT T1.id, T1.score, T1.date FROM game AS T1 JOIN injury_accident AS T2 ON T2.game_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 2 |
Top 1000 StackOverflow users from South Africa. | CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number,ApprovalDate time,ApprovalModeratorId number,DeactivationDat... | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, WebsiteUrl AS Website, Location FROM Users WHERE Location LIKE '%South Africa%' ORDER BY Reputation DESC LIMIT 1000 |
What was the 1st leg when team 2 was nov milenium? | CREATE TABLE table_name_7 (team_2 VARCHAR) | SELECT 1 AS st_leg FROM table_name_7 WHERE team_2 = "nov milenium" |
What is the number of booking start dates of the apartments with more than 2 bedrooms for each weekday? Show me a bar chart. | CREATE TABLE Apartments (apt_id INTEGER,building_id INTEGER,apt_type_code CHAR(15),apt_number CHAR(10),bathroom_count INTEGER,bedroom_count INTEGER,room_count CHAR(5))CREATE TABLE Apartment_Facilities (apt_id INTEGER,facility_code CHAR(15))CREATE TABLE Apartment_Buildings (building_id INTEGER,building_short_name CHAR(1... | SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2 |
Answers by the given user with the given phrase in the title (case, accent insensitive). | CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRenam... | SELECT a.Id AS "post_link", a.Score, q.Tags FROM Posts AS a INNER JOIN Posts AS q ON a.ParentId = q.Id WHERE (a.OwnerUserId = '##userid?25510##') AND (q.Title LIKE '%##word?urgent##%' COLLATE Latin1_General_CI_AI) ORDER BY a.Id |
How many overs occurred at Waca Ground against Queensland? | CREATE TABLE table_68115 ("Player" text,"Overs" real,"Figures" text,"Opponent" text,"Ground" text) | SELECT "Overs" FROM table_68115 WHERE "Ground" = 'waca ground' AND "Opponent" = 'queensland' |
Which Pick has a College of ohio state? | CREATE TABLE table_name_22 (pick INTEGER,college VARCHAR) | SELECT MIN(pick) FROM table_name_22 WHERE college = "ohio state" |
When gary player is the winner what is the lowest winners share in dollars? | CREATE TABLE table_73627 ("Year" real,"Tournament" text,"Winner" text,"Margin of victory" text,"Winners share ($)" real,"Par" real,"Course length" text) | SELECT MIN("Winners share ( $ )") FROM table_73627 WHERE "Winner" = 'Gary Player' |
Who is the candidate for the district Arkansas 2? | CREATE TABLE table_18556 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text) | SELECT "Candidates" FROM table_18556 WHERE "District" = 'Arkansas 2' |
Which Against has Losses larger than 2, and Wins of 8, and Byes smaller than 0? | CREATE TABLE table_name_65 (against INTEGER,byes VARCHAR,losses VARCHAR,wins VARCHAR) | SELECT SUM(against) FROM table_name_65 WHERE losses > 2 AND wins = 8 AND byes < 0 |
how many entries are of each type? | CREATE TABLE torrents (groupname text,totalsnatched number,artist text,groupyear number,releasetype text,groupid number,id number)CREATE TABLE tags (index number,id number,tag text) | SELECT COUNT(*), releasetype FROM torrents GROUP BY releasetype |
give the number of patients whose admission location is phys referral/normal deli and admission year is before 2178. | 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 WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.admityear < "2178" |
What was the first day cover cancellation for the University of Saskatchewan themed stamp? | CREATE TABLE table_17242 ("Date of Issue" text,"Theme" text,"Denomination" text,"Design" text,"Illustration" text,"Printing Process" text,"Paper Type" text,"First Day Cover Cancellation" text) | SELECT "First Day Cover Cancellation" FROM table_17242 WHERE "Theme" = 'University of Saskatchewan' |
What Player is a Wide Receiver? | CREATE TABLE table_name_40 (player VARCHAR,position VARCHAR) | SELECT player FROM table_name_40 WHERE position = "wide receiver" |
how many patients whose drug code is lans30st and lab test category is blood gas? | 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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "LANS30ST" AND lab."CATEGORY" = "Blood Gas" |
Where did Test Mission: War Heads and Missile Payload launch when there was a partial failure? | CREATE TABLE table_358 ("Launch Vehicle" text,"Launch date" text,"Mission" text,"Institutional authority" text,"Launch site" text,"Results" text) | SELECT "Launch site" FROM table_358 WHERE "Mission" = 'Test Mission: war heads and Missile payload' AND "Results" = 'Partial Failure' |
Who was seat no 6 when seat no 1 and seat no 5 were jacques lachapelle and donald s. dutton | CREATE TABLE table_2231241_1 (seat_no_6 VARCHAR,seat_no_1 VARCHAR,seat_no_5 VARCHAR) | SELECT seat_no_6 FROM table_2231241_1 WHERE seat_no_1 = "Jacques Lachapelle" AND seat_no_5 = "Donald S. Dutton" |
in riyadh, saudi arabia, what is the score? | CREATE TABLE table_name_12 (score VARCHAR,venue VARCHAR) | SELECT score FROM table_name_12 WHERE venue = "riyadh, saudi arabia" |
What was actor Teresa Graves's series before the year 1993? | CREATE TABLE table_name_82 (series VARCHAR,year VARCHAR,actor VARCHAR) | SELECT series FROM table_name_82 WHERE year < 1993 AND actor = "teresa graves" |
What is 1st Season, when 4 Season is '3 273 440 (17 March 2009)'? | CREATE TABLE table_60805 ("Episode" text,"1 season" text,"2 season" text,"3 season" text,"4 season" text,"5 season" text,"6 season" text) | SELECT "1 season" FROM table_60805 WHERE "4 season" = '3 273 440 (17 march 2009)' |
All answers by user, and the corresponding questions. | CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number,ApprovalDate time,ApprovalModeratorId number,DeactivationDat... | SELECT a.Id, b.Title, a.Body FROM Posts AS a INNER JOIN Posts AS b ON a.ParentId = b.Id WHERE a.OwnerUserId = '##UserId##' ORDER BY a.Id DESC |
Which Points is the average one that has Drawn of 3, and a Played smaller than 22? | CREATE TABLE table_40251 ("Position" real,"Team" text,"Points" real,"Played" real,"Drawn" real,"Lost" real,"Against" real,"Difference" text) | SELECT AVG("Points") FROM table_40251 WHERE "Drawn" = '3' AND "Played" < '22' |
How much is the density with a hardness of ~ 8.3? | CREATE TABLE table_7699 ("Material" text,"Formula" text,"Refractive index(es) 589.3nm" text,"Hardness (Mohs' scale)" text,"Density (g/cm 3)" text,"State of the art" text) | SELECT "Density (g/cm 3 )" FROM table_7699 WHERE "Hardness ( Mohs' scale )" = '~ 8.3' |
what were the top five most frequently prescribed drugs for patients for whom heparin (porcine) 5,000 unit/ml injection : 1 ml vial was prescribed at the same time? | 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 diagnosis (diagnosisid number,patientunitstayi... | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'heparin (porcine) 5,000 unit/ml injection : 1 ml vi... |
Find the phone number of all the customers and staff. | CREATE TABLE customers (customer_id number,customer_type_code text,address_line_1 text,address_line_2 text,town_city text,state text,email_address text,phone_number text)CREATE TABLE staff (staff_id number,gender text,first_name text,last_name text,email_address text,phone_number text)CREATE TABLE products (product_id ... | SELECT phone_number FROM customers UNION SELECT phone_number FROM staff |
What was the publication year ranking l.a. is 1st? | CREATE TABLE table_19948664_2 (year_of_publication VARCHAR,ranking_la__2_ VARCHAR) | SELECT year_of_publication FROM table_19948664_2 WHERE ranking_la__2_ = "1st" |
which opponent has the same score as san marino ? | CREATE TABLE table_204_282 (id number,"date" text,"venue" text,"opponent" text,"score" text,"result" text,"competition" text,"#" number) | SELECT "opponent" FROM table_204_282 WHERE "opponent" <> 'san marino' AND "score" = (SELECT "score" FROM table_204_282 WHERE "opponent" = 'san marino') |
Number/score from answers and from questions for top users (only non-CW). | CREATE TABLE PostHistoryTypes (Id number,Name 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 VoteTypes (Id number,Name text)CREATE TABLE Comments (Id number,Po... | SELECT p.OwnerUserId AS "user_link", p.OwnerDisplayName, SUM(p.Score) AS "total_score", COUNT(p.Id) AS "total_posts", SUM(CASE WHEN p.PostTypeId = 1 THEN 1 ELSE 0 END) AS "total_questions", SUM(CASE WHEN p.PostTypeId = 2 THEN 1 ELSE 0 END) AS "total_answers", SUM(CASE WHEN p.PostTypeId = 1 THEN p.Score ELSE 0 END) AS "... |
what is minimum age of patients whose marital status is single and admission year is greater than or equal to 2158? | 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 MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.admityear >= "2158" |
count the number of patients whose age is less than 67 and days of hospital stay is greater than 34? | 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 WHERE demographic.age < "67" AND demographic.days_stay > "34" |
what is the torque when the notes are laredo, limited, overland and the engine is 5.7l hemi v8? | CREATE TABLE table_57232 ("Years" text,"Engine" text,"Power" text,"Torque" text,"Notes" text) | SELECT "Torque" FROM table_57232 WHERE "Notes" = 'laredo, limited, overland' AND "Engine" = '5.7l hemi v8' |
Who is the athlete from greece? | CREATE TABLE table_name_13 (athlete VARCHAR,country VARCHAR) | SELECT athlete FROM table_name_13 WHERE country = "greece" |
What's the 2011 result when 2010 is 2r and 2013 is w? | CREATE TABLE table_name_25 (Id VARCHAR) | SELECT 2011 FROM table_name_25 WHERE 2010 = "2r" AND 2013 = "w" |
when was the last time that patient 47460 was prescribed medication during the last hospital encounter via iv route? | CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE icustays (row_id number,... | SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 47460 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND prescriptions.route = 'iv' ORDER BY prescriptions.startdate DESC LIMIT 1 |
i'm traveling to DALLAS from PHILADELPHIA | CREATE TABLE equipment_sequence (aircraft_code_sequence varchar,aircraft_code varchar)CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE city (city_code varchar,city_name varchar,state_code varchar,country_name varchar,time_zone_code varchar)CREATE TABLE compartment_class (c... | 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 = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'D... |
What was the religious affiliation for the athletics nicknamed lords/ladies? | CREATE TABLE table_name_34 (religious_affiliation VARCHAR,athletics_nickname VARCHAR) | SELECT religious_affiliation FROM table_name_34 WHERE athletics_nickname = "lords/ladies" |
In what week was the record 5-9? | CREATE TABLE table_18031 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Game site" text,"Record" text,"Attendance" real) | SELECT MAX("Week") FROM table_18031 WHERE "Record" = '5-9' |
What are the maximum duration and resolution of songs grouped and ordered by languages? | CREATE TABLE files (duration INTEGER,f_id VARCHAR)CREATE TABLE song (languages VARCHAR,resolution INTEGER,f_id VARCHAR) | SELECT MAX(T1.duration), MAX(T2.resolution), T2.languages FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.languages ORDER BY T2.languages |
how many patients whose procedure short title is radical cystectomy? | 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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.short_title = "Radical cystectomy" |
For those records from the products and each product's manufacturer, a bar chart shows the distribution of name and code , and group by attribute headquarter, and order in ascending by the Y. | 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 T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Code |
What is 2007, when 2000 is '0 / 4'? | CREATE TABLE table_48506 ("Tournament" text,"1993" text,"1994" text,"1995" text,"1996" text,"1997" text,"1998" text,"1999" text,"2000" text,"2001" text,"2002" text,"2003" text,"2004" text,"2005" text,"2006" text,"2007" text,"Career WR" text,"Career Win-Loss" text) | SELECT "2007" FROM table_48506 WHERE "2000" = '0 / 4' |
What is the smallest 07-08 oi best value? | CREATE TABLE table_26415 ("Rank" real,"WS Points" real,"Name" text,"Country" text,"08-09 I/O best" real,"08-09 GP/JGP best" real,"08-09 GP/JGP 2nd" real,"08-09 OI best" real,"08-09 OI 2nd" real,"07-08 I/O best" real,"07-08 GP/JGP best" real,"07-08 GP/JGP 2nd" real,"07-08 OI best" real,"07-08 OI 2nd" real) | SELECT MIN("07-08 OI best") FROM table_26415 |
What is the top attendance for weeks past 2 on october 29, 1961? | CREATE TABLE table_77761 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real) | SELECT MAX("Attendance") FROM table_77761 WHERE "Week" > '2' AND "Date" = 'october 29, 1961' |
give me some restaurants good for arabic food in mountain view ? | CREATE TABLE restaurant (id int,name varchar,food_type varchar,city_name varchar,rating "decimal)CREATE TABLE location (restaurant_id int,house_number int,street_name varchar,city_name varchar)CREATE TABLE geographic (city_name varchar,county varchar,region varchar) | SELECT location.house_number, restaurant.name FROM location, restaurant WHERE location.city_name = 'mountain view' AND restaurant.food_type = 'arabic' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5 |
What was the name of the Team 1, where the Team 2 was Stade De Reims (d2)? | CREATE TABLE table_name_93 (team_1 VARCHAR,team_2 VARCHAR) | SELECT team_1 FROM table_name_93 WHERE team_2 = "stade de reims (d2)" |
which kingdom has the most villages ? | CREATE TABLE table_203_713 (id number,"s.no." number,"name of kingdom" text,"name of king" text,"no. of villages" number,"capital" text,"names of districts" text) | SELECT "name of kingdom" FROM table_203_713 ORDER BY "no. of villages" DESC LIMIT 1 |
how many patients whose gender is f and age is less than 41? | 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 WHERE demographic.gender = "F" AND demographic.age < "41" |
How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed? | CREATE TABLE Customers (customer_id VARCHAR,first_name VARCHAR,last_name VARCHAR)CREATE TABLE Lessons (customer_id VARCHAR,lesson_status_code VARCHAR) | SELECT COUNT(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" AND T1.lesson_status_code = "Completed" |
Comments posted after your comment. | 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 c.UserId AS "user_link", c.Id AS "comment_link", p.Id AS "post_link" FROM Posts AS p, Comments AS c INNER JOIN Comments AS b ON c.PostId = b.PostId WHERE b.UserId = '##UserId##' AND c.UserId != '##UserId##' AND c.CreationDate > b.CreationDate AND p.Id = c.PostId ORDER BY c.CreationDate DESC |
How many pac-12 sports are shown for california polytechnic state university? | CREATE TABLE table_27816698_2 (pac_12_sports VARCHAR,institution VARCHAR) | SELECT COUNT(pac_12_sports) FROM table_27816698_2 WHERE institution = "California Polytechnic State University" |
Which Lost has a Position of 4, and a Drawn smaller than 3? | CREATE TABLE table_name_4 (lost INTEGER,position VARCHAR,drawn VARCHAR) | SELECT AVG(lost) FROM table_name_4 WHERE position = 4 AND drawn < 3 |
Which away team has a tie number of 3? | CREATE TABLE table_79326 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text) | SELECT "Away team" FROM table_79326 WHERE "Tie no" = '3' |
Was the result of the supercheap auto bathurst 1000 reported? | CREATE TABLE table_20884160_1 (report VARCHAR,race_title VARCHAR) | SELECT report FROM table_20884160_1 WHERE race_title = "Supercheap Auto Bathurst 1000" |
How many Losses have Draws larger than 0? | CREATE TABLE table_name_58 (losses INTEGER,draws INTEGER) | SELECT MAX(losses) FROM table_name_58 WHERE draws > 0 |
List name and damage for all storms in a descending order of max speed. | CREATE TABLE storm (name VARCHAR,damage_millions_USD VARCHAR,max_speed VARCHAR) | SELECT name, damage_millions_USD FROM storm ORDER BY max_speed DESC |
Which rank has a smaller area (sq mi) than 48, and an area (km2) greater than 104, and an island of sula, sogn og fjordane? | CREATE TABLE table_15320 ("Rank" real,"Island" text,"Area (km\u00b2)" real,"Area (sq mi)" real,"Country/Countries/Region" text) | SELECT "Rank" FROM table_15320 WHERE "Area (sq mi)" < '48' AND "Area (km\u00b2)" > '104' AND "Island" = 'sula, sogn og fjordane' |
What is the smallest draws for a player larger than 2 with a 100% wins? | CREATE TABLE table_4694 ("Played" real,"Lost" real,"Drawn" real,"Tries" real,"Points" real,"% Won" real) | SELECT MIN("Drawn") FROM table_4694 WHERE "Played" > '2' AND "% Won" > '100' |
What are the dates of the assessment notes, and count them by a line chart, and display in descending by the X-axis please. | CREATE TABLE Detention (detention_id INTEGER,detention_type_code VARCHAR(10),teacher_id INTEGER,datetime_detention_start DATETIME,datetime_detention_end DATETIME,detention_summary VARCHAR(255),other_details VARCHAR(255))CREATE TABLE Students (student_id INTEGER,address_id INTEGER,first_name VARCHAR(80),middle_name VARC... | SELECT date_of_notes, COUNT(date_of_notes) FROM Assessment_Notes ORDER BY date_of_notes DESC |
Draw a bar chart for what are the different ship flags, and how many ships have each?, and list the total number in asc order please. | CREATE TABLE Ship (Ship_ID int,Name text,Type text,Built_Year real,Class text,Flag text)CREATE TABLE captain (Captain_ID int,Name text,Ship_ID int,age text,Class text,Rank text) | SELECT Flag, COUNT(*) FROM Ship GROUP BY Flag ORDER BY COUNT(*) |
Who was the opponent at the game at Madison Square Garden? | CREATE TABLE table_63166 ("Game" text,"Date" text,"Opponent" text,"Score" text,"Location/Attendance" text,"Record" text) | SELECT "Opponent" FROM table_63166 WHERE "Location/Attendance" = 'madison square garden' |
how many patients were diagnosed with esophageal reflux in the same hospital encounter in the last year after having been previously diagnosed with pneumo oth grm-neg bact? | 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 prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,ro... | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title =... |
What is the model number with a release price of $496? | CREATE TABLE table_20779 ("Model number" text,"sSpec number" text,"Frequency" text,"L2 cache" text,"FSB" text,"Mult." text,"Voltage" text,"TDP" text,"Socket" text,"Release date" text,"Part number(s)" text,"Release price (USD)" text) | SELECT "Model number" FROM table_20779 WHERE "Release price ( USD )" = '$496' |
Show all destinations and the number of flights to each destination Plot them as bar chart, I want to list bar in desc order please. | CREATE TABLE aircraft (aid number(9,0),name varchar2(30),distance number(6,0))CREATE TABLE certificate (eid number(9,0),aid number(9,0))CREATE TABLE employee (eid number(9,0),name varchar2(30),salary number(10,2))CREATE TABLE flight (flno number(4,0),origin varchar2(20),destination varchar2(20),distance number(6,0),dep... | SELECT destination, COUNT(*) FROM flight GROUP BY destination ORDER BY destination DESC |
What was the score for the game where the home team was Wycombe Wanderers? | CREATE TABLE table_name_73 (score VARCHAR,home_team VARCHAR) | SELECT score FROM table_name_73 WHERE home_team = "wycombe wanderers" |
How many games did the team who scored 60 goals win? | CREATE TABLE table_72897 ("Position" real,"Team" text,"Played" real,"Won" real,"Drawn" real,"Lost" real,"Goals For" real,"Goals Against" real,"Goal Average 1" text,"Points 2" real) | SELECT MIN("Won") FROM table_72897 WHERE "Goals For" = '60' |
What ranking is the structure with 01.0 87 floors? | CREATE TABLE table_name_51 (rank VARCHAR,floors VARCHAR) | SELECT rank FROM table_name_51 WHERE floors = "01.0 87" |
What is the time of the swimmer in rank 40? | CREATE TABLE table_name_47 (time VARCHAR,rank VARCHAR) | SELECT time FROM table_name_47 WHERE rank = 40 |
Which Byes has a Losses smaller than 1? | CREATE TABLE table_41869 ("Peel" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real) | SELECT MAX("Byes") FROM table_41869 WHERE "Losses" < '1' |
Tell me the average silver for total more than 1 with bronze of 2 for france and gold more than 0 | CREATE TABLE table_name_62 (silver INTEGER,gold VARCHAR,nation VARCHAR,total VARCHAR,bronze VARCHAR) | SELECT AVG(silver) FROM table_name_62 WHERE total > 1 AND bronze = 2 AND nation = "france" AND gold > 0 |
Which Name has a Years Played of 2004 2008, and a Date and Opponent of 2/17/07 vs. purdue? | CREATE TABLE table_48077 ("Total Points" real,"Name" text,"Career Games" text,"Position" text,"Years Played" text,"Scored 1,500 Points" text,"Date and Opponent" text) | SELECT "Name" FROM table_48077 WHERE "Years Played" = '2004–2008' AND "Date and Opponent" = '2/17/07 vs. purdue' |
What date did the team play home in Toronto? | CREATE TABLE table_name_64 (date VARCHAR,home VARCHAR) | SELECT date FROM table_name_64 WHERE home = "toronto" |
What is the number of carriers of phones? Give me a bar chart, and show Y-axis from low to high order. | CREATE TABLE market (Market_ID int,District text,Num_of_employees int,Num_of_shops real,Ranking int)CREATE TABLE phone_market (Market_ID int,Phone_ID text,Num_of_stock int)CREATE TABLE phone (Name text,Phone_ID int,Memory_in_G int,Carrier text,Price real) | SELECT Carrier, COUNT(Carrier) FROM phone GROUP BY Carrier ORDER BY COUNT(Carrier) |
what is the venue when the runner-up is 20,000, the champion (average in final) is phil taylor (109.35)? | CREATE TABLE table_13405 ("Year" real,"Champion (average in final)" text,"Legs" text,"Runner-up (average in final)" text,"Sponsor" text,"Prize Fund" text,"Champion" text,"Runner-up" text,"Venue" text) | SELECT "Venue" FROM table_13405 WHERE "Runner-up" = '£20,000' AND "Champion (average in final)" = 'phil taylor (109.35)' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.