instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
For the game ending with a record of 31-43-2, what was the decision?
CREATE TABLE table_name_10 (decision VARCHAR,record VARCHAR)
SELECT decision FROM table_name_10 WHERE record = "31-43-2"
how many patients were prescribed with rocuronium bromide within 2 months after having undergone pulmonary medicine consultation.
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)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 COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'pulmonary medicine consultation') AS t1 JOIN (SELECT patient.uniquepid, medication.drugstarttime FROM medica...
What is the Type for l. publilius philo vulscus?
CREATE TABLE table_name_31 (type VARCHAR,name VARCHAR)
SELECT type FROM table_name_31 WHERE name = "l. publilius philo vulscus"
What's the largest amount of assists juan ignacio s nchez ever had?
CREATE TABLE table_name_30 (assists INTEGER,name VARCHAR)
SELECT MAX(assists) FROM table_name_30 WHERE name = "juan ignacio sánchez"
Find unanswered questions for specific tag. This query returns a list of all questions that have zero answers. The questions returned are not closed.
CREATE TABLE PostsWithDeleted (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,Ta...
SELECT t.TagName, p.Id AS "post_link", p.Score, p.ViewCount FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE p.PostTypeId = 1 AND p.ClosedDate IS NULL AND p.AnswerCount = 0 AND t.TagName LIKE '##TagName:string##'
What Date is Northern Spur Breeders' Cup Stakes Race?
CREATE TABLE table_name_31 (date VARCHAR,race VARCHAR)
SELECT date FROM table_name_31 WHERE race = "northern spur breeders' cup stakes"
who was the last senior advisor to be named in 2013 ?
CREATE TABLE table_204_598 (id number,"name" text,"state of residence" text,"took office" text,"left office" text,"president served under" text)
SELECT "name" FROM table_204_598 WHERE "took office" = 2013 ORDER BY "took office" DESC LIMIT 1
what is the number of patients whose admission year is less than 2179 and diagnoses icd9 code is 99591?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2179" AND diagnoses.icd9_code = "99591"
When frederick remann (r) is the vacator what is the reason for vacancy?
CREATE TABLE table_26654 ("District" text,"Vacator" text,"Reason for Vacancy" text,"Successor" text,"Date of successors taking office" text)
SELECT "Reason for Vacancy" FROM table_26654 WHERE "Vacator" = 'Frederick Remann (R)'
What was the order of succession for the department of education?
CREATE TABLE table_name_87 (order_of_succession VARCHAR,department VARCHAR)
SELECT order_of_succession FROM table_name_87 WHERE department = "education"
What is the length of the gun that has a shoulder measurement of 12.18 (.480)?
CREATE TABLE table_name_35 (length VARCHAR,shoulder VARCHAR)
SELECT length FROM table_name_35 WHERE shoulder = "12.18 (.480)"
left main coronary artery disease with 50 % stenosis
CREATE TABLE table_test_26 ("id" int,"bleeding" int,"left_ventricular_ejection_fraction_lvef" int,"left_main_coronary_artery_disease" bool,"uncontrolled_diabetes" bool,"hiv_infection" bool,"hemoglobin_a1c_hba1c" float,"hepatitis_b_infection" bool,"renal_disease" bool,"unprotected_left_main_disease" bool,"creatinine_cle...
SELECT * FROM table_test_26 WHERE left_main_coronary_artery_disease = 1 AND stenosis = 50
What is the elevation msnm for a population censo 2007(hab) of 77.392*?
CREATE TABLE table_name_59 (elevation_msnm VARCHAR,population_censo_2007_hab_ VARCHAR)
SELECT elevation_msnm FROM table_name_59 WHERE population_censo_2007_hab_ = "77.392*"
Which site has a Cost free and a Editor of jsvi?
CREATE TABLE table_36712 ("Editor" text,"Site" text,"Style,clone of" text,"Cost (US$)" text,"Open source" text,"Activity" text)
SELECT "Site" FROM table_36712 WHERE "Cost ( US$ )" = 'free' AND "Editor" = 'jsvi'
On what date was the opponent the Green Bay Packers?
CREATE TABLE table_47524 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" text)
SELECT "Date" FROM table_47524 WHERE "Opponent" = 'green bay packers'
How many NHL teams does Terry French play for?
CREATE TABLE table_1213511_2 (nhl_team VARCHAR,player VARCHAR)
SELECT COUNT(nhl_team) FROM table_1213511_2 WHERE player = "Terry French"
What is the average amount of assists with a rank higher than 6 and goals 10 and the scorer is Robert Ukrop
CREATE TABLE table_4407 ("Rank" real,"Scorer" text,"Club" text,"Goals" real,"Assists" real,"Points" real)
SELECT AVG("Assists") FROM table_4407 WHERE "Rank" > '6' AND "Goals" = '10' AND "Scorer" = 'robert ukrop'
how many documents are with document type code BK for each product id?
CREATE TABLE Documents (Document_ID INTEGER,Document_Type_Code CHAR(15),Project_ID INTEGER,Document_Date DATETIME,Document_Name VARCHAR(255),Document_Description VARCHAR(255),Other_Details VARCHAR(255))CREATE TABLE Ref_Budget_Codes (Budget_Type_Code CHAR(15),Budget_Type_Description VARCHAR(255))CREATE TABLE Documents_w...
SELECT COUNT(*), Project_ID FROM Documents WHERE Document_Type_Code = "BK" GROUP BY Project_ID
Which Rec has Jerel Myers as the Player?
CREATE TABLE table_11249 ("Player" text,"Rec." real,"Yards" text,"Avg." text,"TD's" real,"Long" text)
SELECT "Rec." FROM table_11249 WHERE "Player" = 'jerel myers'
What is the to par when the total is larger than 288?
CREATE TABLE table_12953 ("Player" text,"Country" text,"Year(s) won" text,"Total" real,"To par" text,"Finish" text)
SELECT "To par" FROM table_12953 WHERE "Total" > '288'
Votes on post by users.
CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)...
SELECT PostId AS "post_link", t.Name, UserId AS "user_link", CreationDate FROM Votes LEFT JOIN VoteTypes AS t ON Votes.VoteTypeId = t.Id WHERE PostId = @PostId
What is the Result when the order is # 4, and the week # is top 12?
CREATE TABLE table_name_58 (result VARCHAR,order__number VARCHAR,week__number VARCHAR)
SELECT result FROM table_name_58 WHERE order__number = "4" AND week__number = "top 12"
During the Spring and Summer term , what is the number of 100 -level classes offered ?
CREATE TABLE course_tags_count (course_id int,clear_grading int,pop_quiz int,group_projects int,inspirational int,long_lectures int,extra_credit int,few_tests int,good_feedback int,tough_tests int,heavy_papers int,cares_for_students int,heavy_assignments int,respected int,participation int,heavy_reading int,tough_grade...
SELECT COUNT(DISTINCT course.course_id, semester.semester) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'department0' AND course.number BETWEEN 100 AND 100 + 100 AND semester.semester IN ('SP', 'SS', 'SU') AND semester.semester_id = course_offering.se...
What is the location for the club trophy?
CREATE TABLE table_59328 ("Years" text,"Type" text,"Original code" text,"Current code" text,"Location" text)
SELECT "Location" FROM table_59328 WHERE "Type" = 'club trophy'
Display a bar chart for how many students are from each city, and which cities have more than one cities?, and sort X-axis from high to low order.
CREATE TABLE Dorm (dormid INTEGER,dorm_name VARCHAR(20),student_capacity INTEGER,gender VARCHAR(1))CREATE TABLE Has_amenity (dormid INTEGER,amenid INTEGER)CREATE TABLE Dorm_amenity (amenid INTEGER,amenity_name VARCHAR(25))CREATE TABLE Lives_in (stuid INTEGER,dormid INTEGER,room_number INTEGER)CREATE TABLE Student (StuI...
SELECT city_code, COUNT(*) FROM Student GROUP BY city_code ORDER BY city_code DESC
What is the average high position for the album unwritten?
CREATE TABLE table_54995 ("Position" real,"Album Title" text,"Artist" text,"Highest Position" real,"Sales" real)
SELECT AVG("Highest Position") FROM table_54995 WHERE "Album Title" = 'unwritten'
what is the number of patients whose diagnoses short title is rec depr psych-psychotic and drug type is base?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Rec depr psych-psychotic" AND prescriptions.drug_type = "BASE"
give me the number of patients whose primary disease is liver transplant and procedure short title is skin & subq dx proc nec.
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "LIVER TRANSPLANT" AND procedures.short_title = "Skin & subq dx proc NEC"
Which Cover model has a Centerfold model of scarlett keegan?
CREATE TABLE table_name_22 (cover_model VARCHAR,centerfold_model VARCHAR)
SELECT cover_model FROM table_name_22 WHERE centerfold_model = "scarlett keegan"
What is the highest number of ends won of 47 Ends Lost and a Shot % less than 73?
CREATE TABLE table_44132 ("Country" text,"Skip" text,"Ends Won" real,"Ends Lost" real,"Blank Ends" real,"Stolen Ends" real,"Shot %" real)
SELECT MAX("Ends Won") FROM table_44132 WHERE "Ends Lost" = '47' AND "Shot %" < '73'
Top Android users in South Africa.
CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE ReviewTaskType...
WITH USER_BY_TAG AS (SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS Rank, u.Id AS "user_link", COUNT(*) AS UpVotes FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.ParentId = pt.PostId INNER JOIN Votes AS v ON v.PostId = p.Id AND VoteTypeId = 2 INNER JOIN Users AS u ON u.Id =...
How many users does this database contain.
CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score n...
SELECT COUNT(*) FROM Posts WHERE PostTypeId = (SELECT Id FROM PostTypes WHERE Name LIKE 'Question') AND OwnerUserId = (SELECT Id FROM Users WHERE DisplayName LIKE 'Mat Mannion')
what was the drug that was prescribed to patient 012-35670 for the last time until 34 months ago via the intravenou route?
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllab...
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-35670')) AND medication.routeadmin = 'intravenou' AND DATETIME(...
What is the born-died that has office of 13 September 1229 as the entered?
CREATE TABLE table_name_8 (born_died VARCHAR,entered_office VARCHAR)
SELECT born_died FROM table_name_8 WHERE entered_office = "13 september 1229"
How much Overall has a Pick # smaller than 20, and a Round smaller than 6?
CREATE TABLE table_34387 ("Round" real,"Pick #" real,"Overall" real,"Name" text,"Position" text,"College" text)
SELECT SUM("Overall") FROM table_34387 WHERE "Pick #" < '20' AND "Round" < '6'
what was the number of patients that were given a tobramycin - peak test since 3 years ago?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE lab (labid number,patientunitstayid num...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT lab.patientunitstayid FROM lab WHERE lab.labname = 'tobramycin - peak' AND DATETIME(lab.labresulttime) >= DATETIME(CURRENT_TIME(), '-3 year'))
What is the team of winner Dick Johnson?
CREATE TABLE table_68362 ("Race Title" text,"Circuit" text,"Location / State" text,"Date" text,"Winner" text,"Team" text)
SELECT "Team" FROM table_68362 WHERE "Winner" = 'dick johnson'
What is the least amount of severe tropical cyclones for the 1992 93 season and the tropical Lows smaller than 6?
CREATE TABLE table_name_61 (Severe INTEGER,season VARCHAR,tropical_lows VARCHAR)
SELECT MIN(Severe) AS tropical_cyclones FROM table_name_61 WHERE season = "1992–93" AND tropical_lows < 6
diagnosis, suspected or confirmed, of severe sepsis or septic shock
CREATE TABLE table_train_44 ("id" int,"pregnancy_or_lactation" bool,"severe_sepsis" bool,"corticosteroid_therapy" bool,"immune_suppression" bool,"hepatic_disease" bool,"septic_shock" bool,"age" float,"NOUSE" float)
SELECT * FROM table_train_44 WHERE severe_sepsis = 1 OR septic_shock = 1
List ' James Bond ' directors
CREATE TABLE writer (wid int,gender text,name text,nationality text,birth_city text,birth_year int)CREATE TABLE written_by (id int,msid int,wid int)CREATE TABLE company (id int,name text,country_code varchar)CREATE TABLE genre (gid int,genre text)CREATE TABLE director (did int,gender text,name text,nationality text,bir...
SELECT director.name FROM directed_by, director, movie WHERE director.did = directed_by.did AND movie.mid = directed_by.msid AND movie.title = 'James Bond'
what is the number of patients whose admission location is emergency room admit and diagnoses icd9 code is 311?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND diagnoses.icd9_code = "311"
what are the four most frequently given diagnoses for patients who have had exploratory laparotomy previously within 2 months until 2103?
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 cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE d_icd_diagnoses (row_id ...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissi...
When was the game at the home of the Los Angeles Kings?
CREATE TABLE table_name_72 (date VARCHAR,home VARCHAR)
SELECT date FROM table_name_72 WHERE home = "los angeles kings"
Get number of users by location.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE FlagTypes (Id number,Name text,Description text)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,Las...
SELECT COUNT(1) FROM Users WHERE LOWER(Location) LIKE '%##LocationInLowercase##%'
How many courses are there in total?
CREATE TABLE subjects (subject_id number,subject_name text)CREATE TABLE course_authors_and_tutors (author_id number,author_tutor_atb text,login_name text,password text,personal_name text,middle_name text,family_name text,gender_mf text,address_line_1 text)CREATE TABLE student_course_enrolment (registration_id number,st...
SELECT COUNT(*) FROM courses
Who was the winner in stage 7 with a general classification of Pavel Tonkov?
CREATE TABLE table_66912 ("Stage" text,"Winner" text,"General classification" text,"Points classification" text,"Mountains classification" text,"Intergiro classification" text,"Trofeo Fast Team" text)
SELECT "Winner" FROM table_66912 WHERE "General classification" = 'pavel tonkov' AND "Stage" = '7'
show me the flights from ATLANTA to DENVER on friday
CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE flight_fare (flight_id int,fare_id 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,flight_...
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 (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND date_day.day_number = 25 AND date_day.month_number = 6 AND da...
What's the name of train number 15647/48?
CREATE TABLE table_17417 ("Train No." text,"Train Name" text,"Origin" text,"Destination" text,"Frequency" text)
SELECT "Train Name" FROM table_17417 WHERE "Train No." = '15647/48'
What is the Player that has a To standard of 4?
CREATE TABLE table_44461 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Player" FROM table_44461 WHERE "To par" = '–4'
What ground has etobicoke kangaroos as the home?
CREATE TABLE table_name_88 (ground VARCHAR,home VARCHAR)
SELECT ground FROM table_name_88 WHERE home = "etobicoke kangaroos"
show me the flights from WESTCHESTER COUNTY to CINCINNATI
CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE flight_stop (flight_id int,stop_number int,...
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 = 'WESTCHESTER COUNTY' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_nam...
Which TV Time has a Result of w 24 17?
CREATE TABLE table_14109 ("Week" real,"Date" text,"Opponent" text,"Result" text,"TV Time" text,"Attendance" text)
SELECT "TV Time" FROM table_14109 WHERE "Result" = 'w 24–17'
What was the title for the game with an attendance of n/a with the runner-up being Waseda, and a season of 1995-6 details?
CREATE TABLE table_name_91 (title VARCHAR,season VARCHAR,attendance VARCHAR,runner_up VARCHAR)
SELECT title FROM table_name_91 WHERE attendance = "n/a" AND runner_up = "waseda" AND season = "1995-6 details"
Bar chart x axis color y axis the number of color
CREATE TABLE mountain (id int,name text,Height real,Prominence real,Range text,Country text)CREATE TABLE photos (id int,camera_lens_id int,mountain_id int,color text,name text)CREATE TABLE camera_lens (id int,brand text,name text,focal_length_mm real,max_aperture real)
SELECT color, COUNT(color) FROM photos GROUP BY color
What was the opposing team's score at the match that was played at Victoria Park?
CREATE TABLE table_4804 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Away team score" FROM table_4804 WHERE "Venue" = 'victoria park'
What is the Result that has the New York Rangers as the Offer Team and Adam Graves as the Player?
CREATE TABLE table_70645 ("Player" text,"Date" text,"Original Team" text,"Offer Team" text,"Result" text)
SELECT "Result" FROM table_70645 WHERE "Offer Team" = 'new york rangers' AND "Player" = 'adam graves'
Who is the candidate in the 2012 election?
CREATE TABLE table_47457 ("Election" text,"Candidate" text,"Number of votes" text,"Share of votes" text,"Outcome of election" text)
SELECT "Candidate" FROM table_47457 WHERE "Election" = '2012'
Which place has United States as the country and Craig Wood as the player?
CREATE TABLE table_68290 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Place" FROM table_68290 WHERE "Country" = 'united states' AND "Player" = 'craig wood'
what were the four drugs prescribed most frequently to the patients aged 40s within 2 months after they had been diagnosed with single lb in-hosp w/o cs since 2105?
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 d_icd_diagnoses (row_id ...
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 ...
What years for the rockets did the player ford, phil phil ford play?
CREATE TABLE table_17171 ("Player" text,"No.(s)" text,"Height in Ft." text,"Position" text,"Years for Rockets" text,"School/Club Team/Country" text)
SELECT "Years for Rockets" FROM table_17171 WHERE "Player" = 'Ford, Phil Phil Ford'
How many questions have been asked on July 18, 2013?.
CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate ti...
SELECT COUNT(Id) AS "questions_posted" FROM Posts WHERE CreationDate > '2013-12-18 00:00' AND CreationDate < '2013-12-18 23:59:59' AND PostTypeId = 1
Which operator runs the Mamariga shuttle line?
CREATE TABLE table_1603807_2 (operator VARCHAR,line VARCHAR)
SELECT operator FROM table_1603807_2 WHERE line = "Mamariga Shuttle"
Which is least lap is mika salo in?
CREATE TABLE table_11931 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT MIN("Laps") FROM table_11931 WHERE "Driver" = 'mika salo'
Points of 26, and a Rank smaller than 27 had what sum of wins?
CREATE TABLE table_6024 ("Rank" real,"Rider" text,"Manufacturer" text,"Points" real,"Wins" real)
SELECT SUM("Wins") FROM table_6024 WHERE "Points" = '26' AND "Rank" < '27'
provide the number of patients with diagnoses icd9 code 5781 who have been admitted for more than 16 days in hospital.
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.days_stay > "16" AND diagnoses.icd9_code = "5781"
Which round has more than 79 overall and a position of QB?
CREATE TABLE table_name_60 (round VARCHAR,position VARCHAR,overall VARCHAR)
SELECT round FROM table_name_60 WHERE position = "qb" AND overall > 79
Which engine is in all rounds with Tsugio Matsuda driving?
CREATE TABLE table_48913 ("Team" text,"Driver" text,"Chassis" text,"Engine" text,"Rounds" text)
SELECT "Engine" FROM table_48913 WHERE "Rounds" = 'all' AND "Driver" = 'tsugio matsuda'
What is the outcome on June 9, 1997?
CREATE TABLE table_name_57 (outcome VARCHAR,date VARCHAR)
SELECT outcome FROM table_name_57 WHERE date = "june 9, 1997"
give me a flight from BALTIMORE to NEWARK that arrives as early as possible
CREATE TABLE code_description (code varchar,description text)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,flight_number int,from_airport varchar,meal_code text,stops int,time...
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 = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NEW...
When ime exchange (including spot, credit and forward transactions) is oil products - value (billion rials) what is the 2008/09 number?
CREATE TABLE table_30616 ("IME Exchange (Including spot,credit and forward transactions)" text,"2007/08" text,"2008/09" text,"2009/10" text,"2010/11" text)
SELECT COUNT("2008/09") FROM table_30616 WHERE "IME Exchange (Including spot, credit and forward transactions)" = 'Oil Products - Value (billion rials)'
what's the won with tries for being 84
CREATE TABLE table_14058433_5 (won VARCHAR,tries_for VARCHAR)
SELECT won FROM table_14058433_5 WHERE tries_for = "84"
How many winners did Minas, which has 0 third places, have?
CREATE TABLE table_name_47 (winners VARCHAR,third_place VARCHAR,team VARCHAR)
SELECT winners FROM table_name_47 WHERE third_place = "0" AND team = "minas"
Can you tell me the Wins that has the Starts larger than 1, and the Top 5 of 3?
CREATE TABLE table_50186 ("Year" real,"Starts" real,"Wins" real,"Top 5" real,"Top 10" real,"Poles" real,"Avg. Start" real,"Avg. Finish" text,"Winnings" text,"Position" text,"Team(s)" text)
SELECT "Wins" FROM table_50186 WHERE "Starts" > '1' AND "Top 5" = '3'
What was the highest average when Fuml was 0?
CREATE TABLE table_name_57 (avg INTEGER,fuml INTEGER)
SELECT MAX(avg) FROM table_name_57 WHERE fuml < 0
Who was Switzerland's alternate?
CREATE TABLE table_name_86 (alternate VARCHAR,nation VARCHAR)
SELECT alternate FROM table_name_86 WHERE nation = "switzerland"
What is the earliest day in November with a record of 15-7-1?
CREATE TABLE table_name_67 (november INTEGER,record VARCHAR)
SELECT MIN(november) FROM table_name_67 WHERE record = "15-7-1"
what is the latest flight leaving WASHINGTON for DENVER
CREATE TABLE city (city_code varchar,city_name varchar,state_code varchar,country_name varchar,time_zone_code varchar)CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_required text,minimum_s...
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 = 'DE...
Most viewed questions with no votes.
CREATE TABLE PostsWithDeleted (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,Ta...
SELECT * FROM Posts WHERE ViewCount >= 100 AND Score = 0 ORDER BY ViewCount DESC
What is the smallest grid value that had 16 points and a team of Mi-Jack Conquest Racing?
CREATE TABLE table_47878 ("Driver" text,"Team" text,"Laps" real,"Time/Retired" text,"Grid" real,"Points" text)
SELECT MIN("Grid") FROM table_47878 WHERE "Team" = 'mi-jack conquest racing' AND "Points" = '16'
What city held that game with a 5:2 result?
CREATE TABLE table_name_5 (city VARCHAR,results¹ VARCHAR)
SELECT city FROM table_name_5 WHERE results¹ = "5:2"
What's the departed date that the HMS Leith of the Royal Navy?
CREATE TABLE table_name_51 (date_departed VARCHAR,navy VARCHAR,name VARCHAR)
SELECT date_departed FROM table_name_51 WHERE navy = "royal navy" AND name = "hms leith"
What is the M60A3 that has 40 rounds as Leclerc?
CREATE TABLE table_name_28 (m60a3_patton VARCHAR,leclerc VARCHAR)
SELECT m60a3_patton FROM table_name_28 WHERE leclerc = "40 rounds"
Name the simplified characters for wade giles is ch'ing-y an i-ma
CREATE TABLE table_16162581_1 (simplified_characters VARCHAR,wade_giles VARCHAR)
SELECT simplified_characters FROM table_16162581_1 WHERE wade_giles = "ch'ing-yüan … i-ma"
Which Outcome has a Score of 3 6 2 6?
CREATE TABLE table_36036 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Opponent in the final" text,"Score" text)
SELECT "Outcome" FROM table_36036 WHERE "Score" = '3–6 2–6'
What is the average crowd size for the home team essendon?
CREATE TABLE table_52585 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT AVG("Crowd") FROM table_52585 WHERE "Home team" = 'essendon'
What Grid has Driver Cristiano da Matta?
CREATE TABLE table_name_10 (grid VARCHAR,driver VARCHAR)
SELECT grid FROM table_name_10 WHERE driver = "cristiano da matta"
Find the name and checking balance of the account with the lowest saving balance.
CREATE TABLE savings (custid number,balance number)CREATE TABLE accounts (custid number,name text)CREATE TABLE checking (custid number,balance number)
SELECT T2.balance, T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T3.balance LIMIT 1
what was the name of the first intake of patient 28443 that they had during yesterday?
CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE prescriptions (row_id numbe...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT inputevents_cv.itemid FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28443)) AND DATETIME(inputevents_cv....
the biggest worldwide opening since 2002 is held by what movie ?
CREATE TABLE table_203_174 (id number,"rank" number,"film" text,"year" number,"opening weekend\n(three day)" text,"inflation-adjusted\n(2014 usd)" text)
SELECT "film" FROM table_203_174 ORDER BY "opening weekend\n(three day)" DESC LIMIT 1
Who are the different players and how many years has each played?
CREATE TABLE player (player_id number,player text,years_played text,total_wl text,singles_wl text,doubles_wl text,team number)CREATE TABLE country (country_id number,country_name text,capital text,official_native_language text)CREATE TABLE team (team_id number,name text)CREATE TABLE match_season (season number,player t...
SELECT player, years_played FROM player
What is the total number of weeks that were on September 25, 1955 with more than 16,901 people in attendance?
CREATE TABLE table_37773 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real)
SELECT COUNT("Week") FROM table_37773 WHERE "Attendance" > '16,901' AND "Date" = 'september 25, 1955'
What was the earliest year with a note of 18.04 m wl?
CREATE TABLE table_name_48 (year INTEGER,notes VARCHAR)
SELECT MIN(year) FROM table_name_48 WHERE notes = "18.04 m wl"
what flights are there from NEW YORK to LAS VEGAS
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 = 'NEW YORK' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'LAS V...
How popular are Python, R and SAS.
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 YEAR(q.CreationDate) AS Year, MONTH(q.CreationDate) AS Month, t.TagName, COUNT(DISTINCT q.Id) AS countOfPosts, COUNT(*) AS c, SUM(q.ViewCount) AS countOfViews FROM PostTags AS pt JOIN Posts AS q ON q.Id = pt.PostId JOIN Tags AS t ON t.Id = pt.TagId WHERE t.TagName IN ('sas', 'python', 'r') GROUP BY YEAR(q.Creati...
What is the name of every city that has at least 15 stations and how many stations does it have Visualize by bar chart, rank in desc by the Y.
CREATE TABLE trip (id INTEGER,duration INTEGER,start_date TEXT,start_station_name TEXT,start_station_id INTEGER,end_date TEXT,end_station_name TEXT,end_station_id INTEGER,bike_id INTEGER,subscription_type TEXT,zip_code INTEGER)CREATE TABLE status (station_id INTEGER,bikes_available INTEGER,docks_available INTEGER,time ...
SELECT city, COUNT(*) FROM station GROUP BY city ORDER BY COUNT(*) DESC
give me the age and procedure short title of the patient with patient id 2560.
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 demographic.age, procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "2560"
Which year did the school with the mascot of the Vikings join?
CREATE TABLE table_66013 ("School" text,"Location" text,"Mascot" text,"County" text,"Year Joined" text,"Year Left" text)
SELECT "Year Joined" FROM table_66013 WHERE "Mascot" = 'vikings'
Find the average age of students living in each dorm and the name of dorm.
CREATE TABLE dorm (dormid number,dorm_name text,student_capacity number,gender text)CREATE TABLE has_amenity (dormid number,amenid number)CREATE TABLE lives_in (stuid number,dormid number,room_number number)CREATE TABLE dorm_amenity (amenid number,amenity_name text)CREATE TABLE student (stuid number,lname text,fname te...
SELECT AVG(T1.age), T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name
What is the sum of Grid, when Time is '+16.687'?
CREATE TABLE table_name_60 (grid INTEGER,time VARCHAR)
SELECT SUM(grid) FROM table_name_60 WHERE time = "+16.687"
provide the number of patients whose year of birth is less than 2197 and diagnoses short title is neutropenia nos?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "2197" AND diagnoses.short_title = "Neutropenia NOS"