instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
exactly how much does patient 19412's arterial bp mean differ last measured on the last icu visit compared to the first value measured on the last icu visit?
CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance text,language text,marital_status text,ethnicity text,age number)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,...
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19412) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents...
i would like to fly UA from WASHINGTON to DENVER colorado
CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)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...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHIN...
Group by DateTime cut-off point.
CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE ReviewTas...
WITH Orders AS (SELECT * FROM (VALUES (CAST('2012-01-01 06:10:01' AS DATETIME), 2), ('2012-01-01 08:10:01', 2), ('2012-01-01 10:10:01', 4), ('2012-01-02 08:00:07', 4), ('2012-01-02 10:00:07', 4)) AS Orders(DateReceived, Total)) SELECT CAST(TIME_TO_STR(DATE('datereceived', '-12 hour'), '%Y/%m/%d') AS TEXT(30)) AS "dt_da...
What is the time value for the rider Brian Finch and a rank greater than 3?
CREATE TABLE table_name_42 (time VARCHAR,rank VARCHAR,rider VARCHAR)
SELECT time FROM table_name_42 WHERE rank > 3 AND rider = "brian finch"
What was the home team's score at kardinia park?
CREATE TABLE table_name_7 (home_team VARCHAR,venue VARCHAR)
SELECT home_team AS score FROM table_name_7 WHERE venue = "kardinia park"
What was the result of week 16?
CREATE TABLE table_58087 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real)
SELECT "Result" FROM table_58087 WHERE "Week" = '16'
How many captains with younger than 50 are in each rank.
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 Rank, COUNT(*) FROM captain WHERE age < 50 GROUP BY Rank
How many times is brannon condren with and overall more than 131 drafted?
CREATE TABLE table_67195 ("Round" real,"Pick #" real,"Overall" real,"Name" text,"Position" text,"College" text)
SELECT COUNT("Round") FROM table_67195 WHERE "Name" = 'brannon condren' AND "Overall" > '131'
Who was the Manufacturer for the Rider Colin Edwards?
CREATE TABLE table_name_1 (manufacturer VARCHAR,rider VARCHAR)
SELECT manufacturer FROM table_name_1 WHERE rider = "colin edwards"
What is the lowest block for director Graeme Harper?
CREATE TABLE table_name_79 (block INTEGER,director VARCHAR)
SELECT MIN(block) FROM table_name_79 WHERE director = "graeme harper"
What is the color of the grape whose wine products has the highest average price?
CREATE TABLE grapes (id number,grape text,color text)CREATE TABLE wine (no number,grape text,winery text,appelation text,state text,name text,year number,price number,score number,cases number,drink text)CREATE TABLE appellations (no number,appelation text,county text,state text,area text,isava text)
SELECT T1.color FROM grapes AS T1 JOIN wine AS T2 ON T1.grape = T2.grape GROUP BY T2.grape ORDER BY AVG(price) DESC LIMIT 1
what is the capital with the Voivodeship Separate city of bia ostockie?
CREATE TABLE table_name_1 (capital VARCHAR,voivodeship_separate_city VARCHAR)
SELECT capital FROM table_name_1 WHERE voivodeship_separate_city = "białostockie"
Draw a bar chart about the distribution of Time and ID , rank by the bars from low to high.
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 swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time ...
SELECT Time, ID FROM swimmer ORDER BY Time
Which Round has a Position of qb, and an Overall larger than 6?
CREATE TABLE table_name_17 (round INTEGER,position VARCHAR,overall VARCHAR)
SELECT MAX(round) FROM table_name_17 WHERE position = "qb" AND overall > 6
What is the fielding team with 155 runs?
CREATE TABLE table_11303072_5 (fielding_team VARCHAR,runs VARCHAR)
SELECT fielding_team FROM table_11303072_5 WHERE runs = "155"
Which Loss has a Name of bullock, chris, and a Long smaller than 36?
CREATE TABLE table_name_72 (loss INTEGER,name VARCHAR,long VARCHAR)
SELECT SUM(loss) FROM table_name_72 WHERE name = "bullock, chris" AND long < 36
What is the Current singles ranking for the player named Mantas Bugaili kis?
CREATE TABLE table_16036 ("Player" text,"Current singles ranking" text,"Current doubles ranking" text,"First year played" real,"Ties played" real,"Total W\u2013L" text,"Singles W\u2013L" text,"Doubles W\u2013L" text)
SELECT "Current singles ranking" FROM table_16036 WHERE "Player" = 'Mantas Bugailiškis'
What time/retired for grid 18?
CREATE TABLE table_77766 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Time/Retired" FROM table_77766 WHERE "Grid" = '18'
Show the ids of the faculty who don't participate in any activity.
CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE faculty_participates_in (facid number,actid number)CREATE TABLE activity (actid number,activity_name text)CREATE TABLE faculty (facid number,lname text,fname text,rank text,sex text,phone...
SELECT facid FROM faculty EXCEPT SELECT facid FROM faculty_participates_in
Which entrant had a chassis of March CG891?
CREATE TABLE table_name_20 (entrant VARCHAR,chassis VARCHAR)
SELECT entrant FROM table_name_20 WHERE chassis = "march cg891"
What is the team's record on februrary 23?
CREATE TABLE table_34601 ("Game" real,"February" real,"Opponent" text,"Score" text,"Record" text)
SELECT "Record" FROM table_34601 WHERE "February" = '23'
how many patients whose discharge location is rehab/distinct part hosp and primary disease is syncope;telemetry?
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 WHERE demographic.discharge_location = "REHAB/DISTINCT PART HOSP" AND demographic.diagnosis = "SYNCOPE;TELEMETRY"
What is the Location of the byron nelson golf classic?
CREATE TABLE table_name_94 (location VARCHAR,tournament VARCHAR)
SELECT location FROM table_name_94 WHERE tournament = "byron nelson golf classic"
What was the original air date of the episode directed by gloria muzio?
CREATE TABLE table_25923164_1 (original_air_date VARCHAR,directed_by VARCHAR)
SELECT original_air_date FROM table_25923164_1 WHERE directed_by = "Gloria Muzio"
What was the score in the August 20, 2007 match?
CREATE TABLE table_60740 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Opponent" text,"Score" text)
SELECT "Score" FROM table_60740 WHERE "Date" = 'august 20, 2007'
Which year has a total of 0 points and a chassis of Toleman tg181?
CREATE TABLE table_57290 ("Year" real,"Entrant" text,"Chassis" text,"Engine" text,"Points" real)
SELECT AVG("Year") FROM table_57290 WHERE "Points" = '0' AND "Chassis" = 'toleman tg181'
Which Crude death rate (per 1000) has Deaths of 768, and a Crude birth rate (per 1000) smaller than 29.7?
CREATE TABLE table_name_51 (crude_death_rate__per_1000_ INTEGER,deaths VARCHAR,crude_birth_rate__per_1000_ VARCHAR)
SELECT MIN(crude_death_rate__per_1000_) FROM table_name_51 WHERE deaths = "768" AND crude_birth_rate__per_1000_ < 29.7
Name the broadcast for 7:00pm and mississippi state
CREATE TABLE table_26842217_18 (broadcast VARCHAR,time VARCHAR,home_team VARCHAR)
SELECT broadcast FROM table_26842217_18 WHERE time = "7:00pm" AND home_team = "Mississippi State"
What is the highest amount of bronze medals when the rank was larger than 9?
CREATE TABLE table_38202 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MAX("Bronze") FROM table_38202 WHERE "Rank" > '9'
give me the number of patients whose ethnicity is white and drug route is ivpca?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE" AND prescriptions.route = "IVPCA"
In the game where the home team scored 12.14 (86), what was the total crowd number?
CREATE TABLE table_55102 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT COUNT("Crowd") FROM table_55102 WHERE "Home team score" = '12.14 (86)'
What is the geo id for Logan county?
CREATE TABLE table_22462 ("Township" text,"County" text,"Pop. (2010)" real,"Land (sqmi)" text,"Water (sqmi)" text,"Latitude" text,"Longitude" text,"GEO ID" real,"ANSI code" real)
SELECT MAX("GEO ID") FROM table_22462 WHERE "County" = 'Logan'
Who is the opponent with a time higher than 1040, a Spad xiii aircraft in Dun-Sur-Meuse with a lower number than 22?
CREATE TABLE table_61370 ("Number" real,"Time" real,"Aircraft" text,"Opponent" text,"Location" text)
SELECT "Opponent" FROM table_61370 WHERE "Time" > '1040' AND "Aircraft" = 'spad xiii' AND "Number" < '22' AND "Location" = 'dun-sur-meuse'
Name the date for chris evert opponent and carpet surface
CREATE TABLE table_69647 ("Tournament" text,"Date" text,"Surface" text,"Round" text,"Opponent" text)
SELECT "Date" FROM table_69647 WHERE "Opponent" = 'chris evert' AND "Surface" = 'carpet'
Find all the product whose name contains the word 'Scanner'.
CREATE TABLE product (product VARCHAR)
SELECT product FROM product WHERE product LIKE "%Scanner%"
What is the average total of Italy and has a bronze larger than 1?
CREATE TABLE table_name_56 (total INTEGER,nation VARCHAR,bronze VARCHAR)
SELECT AVG(total) FROM table_name_56 WHERE nation = "italy" AND bronze > 1
give me the number of patients whose marital status is single and procedure icd9 code is 8968?
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "SINGLE" AND procedures.icd9_code = "8968"
how many unmarried patients take medication via left eye?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.marital_status = "SINGLE" AND prescriptions.route = "LEFT EYE"
What Date has a Score in the final of 3 6, 2 6, 4 6?
CREATE TABLE table_58981 ("Outcome" text,"Date" text,"Championship" text,"Surface" text,"Opponent in the final" text,"Score in the final" text)
SELECT "Date" FROM table_58981 WHERE "Score in the final" = '3–6, 2–6, 4–6'
What is the average base price of rooms, for each bed type. Show a pie chart.
CREATE TABLE Rooms (RoomId TEXT,roomName TEXT,beds INTEGER,bedType TEXT,maxOccupancy INTEGER,basePrice INTEGER,decor TEXT)CREATE TABLE Reservations (Code INTEGER,Room TEXT,CheckIn TEXT,CheckOut TEXT,Rate REAL,LastName TEXT,FirstName TEXT,Adults INTEGER,Kids INTEGER)
SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType
Show how many competitions are held in each year with a line chart, I want to list X in desc order.
CREATE TABLE farm_competition (Competition_ID int,Year int,Theme text,Host_city_ID int,Hosts text)CREATE TABLE competition_record (Competition_ID int,Farm_ID int,Rank int)CREATE TABLE city (City_ID int,Official_Name text,Status text,Area_km_2 real,Population real,Census_Ranking text)CREATE TABLE farm (Farm_ID int,Year ...
SELECT Year, COUNT(Year) FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID ORDER BY Year DESC
What Nickname(s) has a Location of elkville, illinois?
CREATE TABLE table_61830 ("School" text,"Location" text,"Nickname(s)" text,"Colors" text,"Years Member" text)
SELECT "Nickname(s)" FROM table_61830 WHERE "Location" = 'elkville, illinois'
calculate the number of patients who had received a bilirubin, total, ascites test since 6 years ago.
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 inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE d_labitems (row_id n...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'bilirubin, total, ascites') AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), '-6 ye...
Show questions with a body containing capitals only.
CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTask...
SELECT Id AS "post_link", CreationDate, Tags FROM Posts WHERE PostTypeId = 1 AND UPPER(Body) = Body ORDER BY CreationDate
How many laps were driven in 2:54:23.8?
CREATE TABLE table_name_45 (laps INTEGER,time_retired VARCHAR)
SELECT SUM(laps) FROM table_name_45 WHERE time_retired = "2:54:23.8"
Who had the most high assists from Milwaukee?
CREATE TABLE table_name_73 (high_assists VARCHAR,team VARCHAR)
SELECT high_assists FROM table_name_73 WHERE team = "milwaukee"
creatinine greater than 2 mg / dl
CREATE TABLE table_train_201 ("id" int,"blood_pressure_bilaterally" bool,"creatinine_clearance_cl" float,"total_cholesterol" int,"smoking" bool,"triglyceride_tg" float,"NOUSE" float)
SELECT * FROM table_train_201 WHERE creatinine_clearance_cl >= 2
What Class has a Frequency of 90.1 FM?
CREATE TABLE table_66622 ("City of license" text,"Identifier" text,"Frequency" text,"Power" text,"Class" text,"RECNet" text)
SELECT "Class" FROM table_66622 WHERE "Frequency" = '90.1 fm'
who was position 3 in 2007-2008?
CREATE TABLE table_22591910_4 (position VARCHAR)
SELECT 2007 AS _2008 FROM table_22591910_4 WHERE position = 3
Which week has a Result of w 23 6?
CREATE TABLE table_35418 ("Week" real,"Date" text,"Opponent" text,"Time (ET)" text,"Result" text)
SELECT "Week" FROM table_35418 WHERE "Result" = 'w 23–6'
What was the lowest 2011 Census population of an area with a land area larger than 908,607.67 km ?
CREATE TABLE table_name_38 (population___2011_census__ INTEGER,land_area__km²_ INTEGER)
SELECT MIN(population___2011_census__) FROM table_name_38 WHERE land_area__km²_ > 908 OFFSET 607.67
What player is from Spring, Tx?
CREATE TABLE table_11677100_4 (player VARCHAR,hometown VARCHAR)
SELECT player FROM table_11677100_4 WHERE hometown = "Spring, TX"
Usu rios vs. Votantes no SOpt.
CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREA...
SELECT (SELECT COUNT(*) FROM Users) AS TotalUsuarios, (SELECT COUNT(*) FROM Users WHERE Reputation >= 15) AS PodemVotar, (SELECT COUNT(*) FROM Users WHERE UpVotes + DownVotes > 0) AS Votaram, (SELECT COUNT(*) FROM Users WHERE UpVotes + DownVotes > 9) AS VotaramDezVezes, (SELECT COUNT(*) FROM Users WHERE Reputation >= 2...
What is the lowest Top-25 with Wins less than 0?
CREATE TABLE table_76034 ("Tournament" text,"Wins" real,"Top-25" real,"Events" real,"Cuts made" real)
SELECT MIN("Top-25") FROM table_76034 WHERE "Wins" < '0'
What is listed in Network station when the country is Brunei?
CREATE TABLE table_2879165_1 (network_station VARCHAR,country VARCHAR)
SELECT COUNT(network_station) FROM table_2879165_1 WHERE country = "Brunei"
Bar graph to show the total number from different role code
CREATE TABLE Images (image_id INTEGER,image_alt_text VARCHAR(80),image_name VARCHAR(40),image_url VARCHAR(255))CREATE TABLE Roles (role_code VARCHAR(15),role_description VARCHAR(80))CREATE TABLE Documents (document_code VARCHAR(15),document_structure_code VARCHAR(15),document_type_code VARCHAR(15),access_count INTEGER,...
SELECT role_code, COUNT(*) FROM Users GROUP BY role_code
Who was the Interview Subject when the Centerfold Model was Melissa Deanne Holliday?
CREATE TABLE table_41519 ("Date" text,"Cover model" text,"Centerfold model" text,"Interview subject" text,"20 Questions" text)
SELECT "Interview subject" FROM table_41519 WHERE "Centerfold model" = 'melissa deanne holliday'
Name the total number of years for usisl pro league
CREATE TABLE table_2511876_1 (year VARCHAR,league VARCHAR)
SELECT COUNT(year) FROM table_2511876_1 WHERE league = "USISL Pro league"
for patients who took anticonvulsants , what are the top five most frequent procedures that followed in the same hospital visit?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 num...
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'antic...
WHat is the number of Population has a Density of 50.09 and a Rank larger than 30?
CREATE TABLE table_name_70 (population INTEGER,density VARCHAR,rank VARCHAR)
SELECT SUM(population) FROM table_name_70 WHERE density = 50.09 AND rank > 30
Which Champions have a Runner-up of tobol, and a Coeff of 1.125?
CREATE TABLE table_name_95 (champions VARCHAR,runner_up VARCHAR,coeff VARCHAR)
SELECT champions FROM table_name_95 WHERE runner_up = "tobol" AND coeff = "1.125"
count the number of patients whose age is less than 85 and drug route is neb?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "85" AND prescriptions.route = "NEB"
Championship larger than 3, and a FA Cup smaller than 3, and a Total smaller than 6 involves what highest league cup?
CREATE TABLE table_name_27 (league_cup INTEGER,total VARCHAR,championship VARCHAR,fa_cup VARCHAR)
SELECT MAX(league_cup) FROM table_name_27 WHERE championship > 3 AND fa_cup < 3 AND total < 6
Which ICAO has a Fleet size of 2?
CREATE TABLE table_name_96 (icao VARCHAR,fleet_size VARCHAR)
SELECT icao FROM table_name_96 WHERE fleet_size = 2
What was the score of the game that had a record of 26 13 4 2 and a decision of Joseph?
CREATE TABLE table_name_24 (score VARCHAR,decision VARCHAR,record VARCHAR)
SELECT score FROM table_name_24 WHERE decision = "joseph" AND record = "26–13–4–2"
how many times on 02/10/2105 has patient 56201 produced chest tubes right pleural 1 output.
CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_labitems (row_id number,itemid number,lab...
SELECT COUNT(*) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 56201)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'chest tubes right ...
Show the number of courses each instructor taught in a stacked bar chart The x-axis is the instructor's first name and group by course description, could you order total number from low to high order please?
CREATE TABLE EMPLOYEE (EMP_NUM int,EMP_LNAME varchar(15),EMP_FNAME varchar(12),EMP_INITIAL varchar(1),EMP_JOBCODE varchar(5),EMP_HIREDATE datetime,EMP_DOB datetime)CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCHOOL_CODE varchar(8),EMP_NUM int,DEPT_ADDRESS varchar(20),DEPT_EXTENSION varchar(4))C...
SELECT EMP_FNAME, COUNT(EMP_FNAME) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE GROUP BY CRS_DESCRIPTION, EMP_FNAME ORDER BY COUNT(EMP_FNAME)
which team was faster : germany or russia ?
CREATE TABLE table_204_439 (id number,"rank" number,"bib" number,"country" text,"athletes" text,"run 1" text,"run 2" text,"run 3" text,"run 4" text,"total" text,"behind" number)
SELECT "country" FROM table_204_439 WHERE "country" IN ('germany', 'russia') ORDER BY "total" LIMIT 1
What's the Bronze that's also got a Godl of Kim Woo-Jin?
CREATE TABLE table_37011 ("Year" real,"Location" text,"Gold" text,"Silver" text,"Bronze" text)
SELECT "Bronze" FROM table_37011 WHERE "Gold" = 'kim woo-jin'
Which Metal has an Element of heavenly stems?
CREATE TABLE table_name_84 (metal VARCHAR,element VARCHAR)
SELECT metal FROM table_name_84 WHERE element = "heavenly stems"
what was the last systemicsystolic value patient 007-849 had since 12/27/2105?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,tempe...
SELECT vitalperiodic.systemicsystolic FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-849')) AND NOT vitalperiodic.systemicsystolic ...
karl behting and giovanni cenni each had final scores of what ?
CREATE TABLE table_203_507 (id number,"#" text,"player" text,"\u03c3 points" number,"qual." number,"final" number)
SELECT "final" FROM table_203_507 WHERE "player" = 'karl behting'
please give me the flight times the morning on UA for 9 20 from PHILADELPHIA to SAN FRANCISCO
CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE flight_stop (flight_id int,stop_number int,stop_days text,stop_airport text,arrival_time int,arrival_airline text,arrival_flight_number int,departure_time int,departure_airline text,departure_flight_number int,stop_time int)CREATE TABLE fa...
SELECT DISTINCT flight.departure_time 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 = 'SAN FRANCISCO' AND date_day.day_number = 20 AND date_day.month_num...
What is the Mon 30 May time for the rider whose Fri 3 June time was 17' 13.46 131.431mph?
CREATE TABLE table_29218221_1 (mon_30_may VARCHAR,fri_3_june VARCHAR)
SELECT mon_30_may FROM table_29218221_1 WHERE fri_3_june = "17' 13.46 131.431mph"
How many grids have a time of +1:21.239 and more than 25 laps?
CREATE TABLE table_name_39 (grid VARCHAR,time_retired VARCHAR,laps VARCHAR)
SELECT COUNT(grid) FROM table_name_39 WHERE time_retired = "+1:21.239" AND laps > 25
Is the site ready for the Generalist Badge?. Lists the top 40 tags, how many times they're used each, and how many questions are needed with that tag so that the Site is eligible for the Generalist badge
CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE ...
SELECT TagName, COUNT(p.TagId) AS "Uses", 200 - COUNT(p.TagId) AS "Questions Needed WITH this Tag Left" FROM Tags AS t INNER JOIN PostTags AS p ON p.TagId = t.Id GROUP BY t.TagName ORDER BY Uses DESC LIMIT 40
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and the sum of code , and group by attribute name, and sort Y-axis in descending order.
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 T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Code DESC
When is the last week that has a result of a w 34-21?
CREATE TABLE table_78396 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real)
SELECT MAX("Week") FROM table_78396 WHERE "Result" = 'w 34-21'
how much is the cost of a dvt - related to vascular catheter diagnosis?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosis...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'diagnosis' AND cost.eventid IN (SELECT diagnosis.diagnosisid FROM diagnosis WHERE diagnosis.diagnosisname = 'dvt - related to vascular catheter')
Who should I expect to be the UP 263 instructor ?
CREATE TABLE semester (semester_id int,semester varchar,year int)CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time,monday varchar,tuesday varchar,wednesday varchar,thursday varchar,friday varchar,saturday varchar,sunday varchar,has_final_project va...
SELECT COUNT(instructor.name), instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'UP' AND course.number = 263 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = cour...
serum creatinine >= 1.6 mg / dl
CREATE TABLE table_train_102 ("id" int,"autoimmune_disease" bool,"stroke" bool,"renal_disease" bool,"hepatic_disease" bool,"liver_disease" bool,"serum_creatinine" float,"seizure_disorder" bool,"NOUSE" float)
SELECT * FROM table_train_102 WHERE serum_creatinine >= 1.6
What was the polling percentage in Nov 2008 when it was 1.7% in Aug 2008?
CREATE TABLE table_26261 ("Party" text,"Result,Parliam. election 2005" text,"Result,County elections 2007" text,"Aug 2008" text,"Sep 2008" text,"Oct 2008" text,"Nov 2008" text,"Dec 2008" text,"Jan 2009" text,"Feb 2009" text,"Mar 2009" text,"Apr 2009" text,"May 2009" text,"Jun 2009" text,"Jul 2009" text,"Aug 2009" text)
SELECT "Nov 2008" FROM table_26261 WHERE "Aug 2008" = '1.7%'
what was the attendance when the away team was boreham wood?
CREATE TABLE table_54294 ("Tie no" real,"Home team" text,"Score" text,"Away team" text,"Attendance" real)
SELECT "Attendance" FROM table_54294 WHERE "Away team" = 'boreham wood'
Scatter chart. how many residents does each property have? List property id and resident count.
CREATE TABLE Properties (property_id INTEGER,property_type_code CHAR(15),property_address VARCHAR(255),other_details VARCHAR(255))CREATE TABLE Things (thing_id INTEGER,organization_id INTEGER,Type_of_Thing_Code CHAR(15),service_type_code CHAR(10),service_details VARCHAR(255))CREATE TABLE Customer_Events (Customer_Event...
SELECT T1.property_id, COUNT(*) FROM Properties AS T1 JOIN Residents AS T2 ON T1.property_id = T2.property_id GROUP BY T1.property_id
Name the lowest Wins which has Points of 28, and a Year smaller than 1972?
CREATE TABLE table_49660 ("Year" real,"Class" text,"Team" text,"Points" real,"Wins" real)
SELECT MIN("Wins") FROM table_49660 WHERE "Points" = '28' AND "Year" < '1972'
provide the number of patients who have procedure icd9 code 3799 and are on additive type of drug prescription.
CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "3799" AND prescriptions.drug_type = "ADDITIVE"
Top 150 users from nepal.
CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Tags text,Ans...
SELECT Id, DisplayName, Reputation, WebsiteUrl, Location FROM Users WHERE Location LIKE '%Nepal%' ORDER BY Reputation DESC LIMIT 150
list the top three most frequent drugs that patients were prescribed with during the same hospital encounter after having been prescribed with levothyroxine sodium 100 mcg po tabs.
CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,dischargeweight number,hospitaladmittime time,hospitaladmitsource text,unitadmittime time,unitdischargetime tim...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime, patient.patienthealthsystemstayid FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'levothyroxine so...
Give me a histogram for what are the statuses and average populations of each city?, list by the names in desc please.
CREATE TABLE city (City_ID int,Official_Name text,Status text,Area_km_2 real,Population real,Census_Ranking text)CREATE TABLE farm (Farm_ID int,Year int,Total_Horses real,Working_Horses real,Total_Cattle real,Oxen real,Bulls real,Cows real,Pigs real,Sheep_and_Goats real)CREATE TABLE farm_competition (Competition_ID int...
SELECT Status, AVG(Population) FROM city GROUP BY Status ORDER BY Status DESC
provide the number of patients whose diagnoses long title is drug induced neutropenia and drug route is left eye?
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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Drug induced neutropenia" AND prescriptions.route = "LEFT EYE"
What is the poor law union of the Lackenagobidane townland?
CREATE TABLE table_74469 ("Townland" text,"Area(acres)" real,"Barony" text,"Civil parish" text,"Poor law union" text)
SELECT "Poor law union" FROM table_74469 WHERE "Townland" = 'Lackenagobidane'
when had patient 031-3355 first received a microbiology test during this hospital encounter?
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 cost (costid number,uniquepid text,patienthealthsystemstayid number,eventt...
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355' AND patient.hospitaldischargetime IS NULL)) ORDER BY mi...
What is the week where the game site is Shea Stadium?
CREATE TABLE table_17861179_1 (week INTEGER,game_site VARCHAR)
SELECT MIN(week) FROM table_17861179_1 WHERE game_site = "Shea Stadium"
how many patients whose primary disease is transient ischemic attack and procedure short title is cardiopulm resuscita nos?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marita...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "TRANSIENT ISCHEMIC ATTACK" AND procedures.short_title = "Cardiopulm resuscita NOS"
For those employees who was hired before 2002-06-21, show me the trend about commission_pct over hire_date with a line chart, and order from high to low by the x axis.
CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varc...
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE DESC
When the team is Toronto how many times did they place third?
CREATE TABLE table_1314 ("Team" text,"Titles" real,"Runner-up" real,"Third place" real,"Fourth place" real,"Years participated" real)
SELECT COUNT("Third place") FROM table_1314 WHERE "Team" = 'Toronto'
How many different users wrote some reviews?
CREATE TABLE useracct (u_id number,name text)CREATE TABLE review (a_id number,u_id number,i_id number,rating number,rank number)CREATE TABLE trust (source_u_id number,target_u_id number,trust number)CREATE TABLE item (i_id number,title text)
SELECT COUNT(DISTINCT u_id) FROM review
What was the record at the game with a score of 21-16?
CREATE TABLE table_66581 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Score" text,"Record" text)
SELECT "Record" FROM table_66581 WHERE "Score" = '21-16'
Which Round has a College of appalachian state, and an Overall smaller than 156?
CREATE TABLE table_50406 ("Round" real,"Pick" real,"Overall" real,"Name" text,"Position" text,"College" text)
SELECT COUNT("Round") FROM table_50406 WHERE "College" = 'appalachian state' AND "Overall" < '156'
what difference is there in patient 009-424's weight last measured on the last hospital visit compared to the first value measured on the last hospital visit?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE patient (uniquepid text,patienthealths...
SELECT (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-424' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1) AND NOT patient.admissionweight IS NULL...