instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
count the number of patients whose admission location is transfer from hosp/extram and procedure long title is excision or destruction of other lesion or tissue of heart, endovascular approach?
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 procedures (subject_id text,hadm_id te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.long_title = "Excision or destruction of other lesion or tissue of heart, endovascular approach"
When the laps are 31 and the constructor was honda, what's the sum of all grid values?
CREATE TABLE table_name_58 (grid INTEGER,constructor VARCHAR,laps VARCHAR)
SELECT SUM(grid) FROM table_name_58 WHERE constructor = "honda" AND laps = 31
What was the score for a no. 21 tie?
CREATE TABLE table_name_6 (score VARCHAR,tie_no VARCHAR)
SELECT score FROM table_name_6 WHERE tie_no = "21"
Who was the winner for a Sprint Classification and Young Classification to Mark Cavendish and Garmin-Chipotle-H30 for team?
CREATE TABLE table_41122 ("Stage (Winner)" text,"General Classification" text,"Young Classification" text,"Mountains Classification" text,"Sprint Classification" text,"Team Classification" text)
SELECT "Stage (Winner)" FROM table_41122 WHERE "Sprint Classification" = 'mark cavendish' AND "Team Classification" = 'garmin-chipotle-h30' AND "Young Classification" = 'mark cavendish'
what is the glos & wilts where the bristol & somerset is lansdown?
CREATE TABLE table_12043148_2 (glos_ VARCHAR,_wilts VARCHAR,bristol_ VARCHAR,_somerset VARCHAR)
SELECT glos_ & _wilts FROM table_12043148_2 WHERE bristol_ & _somerset = "Lansdown"
Visualize a pie chart about the proportion of Team_Name and Team_ID.
CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Percent int,All_Home text,All_Road text,All_Neutral text)CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,En...
SELECT Team_Name, Team_ID FROM basketball_match
When nel rapiz is the name what is the status?
CREATE TABLE table_19061741_1 (status VARCHAR,name VARCHAR)
SELECT status FROM table_19061741_1 WHERE name = "Nel Rapiz"
Which owner has the call sign of KDSU?
CREATE TABLE table_54806 ("Frequency" text,"Call sign" text,"Name" text,"Format" text,"Owner" text)
SELECT "Name" FROM table_54806 WHERE "Call sign" = 'kdsu'
Which record has tko (strikes) as the method, and daan kooiman as the opponent?
CREATE TABLE table_69936 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" text,"Time" text,"Location" text)
SELECT "Record" FROM table_69936 WHERE "Method" = 'tko (strikes)' AND "Opponent" = 'daan kooiman'
during the previous year was patient 011-20295 diagnosed with seizures - new onset?
CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,dischargeweight number,hospitaladmittime time,hospitaladmitsource text,unitadmittime time,unitdischargetime tim...
SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-20295')) AND diagnosis.diagnosisname = 'seizures - new onset' AND DATETI...
Who wrote the episode with the code xle05012?
CREATE TABLE table_28348757_6 (written_by VARCHAR,production_code VARCHAR)
SELECT written_by FROM table_28348757_6 WHERE production_code = "XLE05012"
provide the number of patients whose religion is christian scientist and item id is 50811
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "CHRISTIAN SCIENTIST" AND lab.itemid = "50811"
Group and count the durations for each actor with a bar graph, sort from low to high by the bar please.
CREATE TABLE musical (Musical_ID int,Name text,Year int,Award text,Category text,Nominee text,Result text)CREATE TABLE actor (Actor_ID int,Name text,Musical_ID int,Character text,Duration text,age int)
SELECT Duration, COUNT(Duration) FROM actor GROUP BY Duration ORDER BY Duration
How many wins did the player have in the Formula BMW World Final?
CREATE TABLE table_17246160_1 (wins VARCHAR,series VARCHAR)
SELECT wins FROM table_17246160_1 WHERE series = "Formula BMW World Final"
What is the section after 11:00 A.M. that is in ECON 183 ?
CREATE TABLE jobs (job_id int,job_title varchar,description varchar,requirement varchar,city varchar,state varchar,country varchar,zip int)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,...
SELECT DISTINCT course_offering.end_time, course_offering.section_number, course_offering.start_time FROM course, course_offering, semester WHERE course_offering.start_time > '11:00' AND course.course_id = course_offering.course_id AND course.department = 'ECON' AND course.number = 183 AND semester.semester = 'WN' AND ...
when did patient 035-2205 last have a minimum value of sao2 since 03/20/2102?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,lab...
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-2205')) AND NOT vitalperiodic.sao2 IS NULL AND ...
How many results finished in a loss?
CREATE TABLE table_23871 ("Game" real,"Date" text,"Opponent" text,"Result" text,"Tar Heels points" real,"Opponents" real,"Record" text)
SELECT COUNT("Tar Heels points") FROM table_23871 WHERE "Result" = 'Loss'
which name is listed below niki palli ?
CREATE TABLE table_204_173 (id number,"rank" number,"group" text,"name" text,"nationality" text,"2.05" text,"2.15" text,"2.19" text,"2.23" text,"2.26" text,"result" text,"notes" text)
SELECT "name" FROM table_204_173 WHERE id = (SELECT id FROM table_204_173 WHERE "name" = 'niki palli') + 1
what were the five most commonly given diagnoses for patients who had been previously diagnosed with left bb block nec in the same month?
CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREA...
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, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions...
give me the number of patients whose year of birth is less than 2056 and procedure icd9 code is 8321?
CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2056" AND procedures.icd9_code = "8321"
Tell me the date with week of 13
CREATE TABLE table_31983 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" text)
SELECT "Date" FROM table_31983 WHERE "Week" = '13'
What is the Malayalam word that is listed as #10 in the table?
CREATE TABLE table_19120 ("#" real,"Sanskrit \u0938\u0902\u0938\u094d\u0915\u0943\u0924\u092e\u094d" text,"Tamil \u0ba4\u0bae\u0bbf\u0bb4\u0bcd" text,"Telugu \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41" text,"Kannada \u0c95\u0ca8\u0ccd\u0ca8\u0ca1" text,"Malayalam \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02" text,"Mongolian" text)
SELECT "Malayalam \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02" FROM table_19120 WHERE "#" = '10'
What is Score, when To Par is greater than 7, when Place is 'T4', and when Player is 'Bob Rosburg'?
CREATE TABLE table_45576 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" real)
SELECT "Score" FROM table_45576 WHERE "To par" > '7' AND "Place" = 't4' AND "Player" = 'bob rosburg'
What is the region of the Alfa Records release with catalog ALCA-282?
CREATE TABLE table_80342 ("Region" text,"Date" text,"Label" text,"Format" text,"Catalog" text)
SELECT "Region" FROM table_80342 WHERE "Label" = 'alfa records' AND "Catalog" = 'alca-282'
count the number of patients less than 49 years who stayed in the hospital for more than 3 days.
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "49" AND demographic.days_stay > "3"
count the number of emergency hospital admitted patients who were diagnosed with accidental fall on or from other stairs or steps.
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 procedures (subject_id text,hadm_id text,icd9_code text,sho...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.long_title = "Accidental fall on or from other stairs or steps"
What are the names of the different bank branches, and what are their total loan amounts Show bar chart, and I want to sort by the Y-axis from low to high.
CREATE TABLE customer (cust_ID varchar(3),cust_name varchar(20),acc_type char(1),acc_bal int,no_of_loans int,credit_score int,branch_ID int,state varchar(20))CREATE TABLE bank (branch_ID int,bname varchar(20),no_of_customers int,city varchar(10),state varchar(20))CREATE TABLE loan (loan_ID varchar(3),loan_type varchar(...
SELECT bname, SUM(amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_ID = T2.branch_ID GROUP BY T1.bname ORDER BY SUM(amount)
What's Babson College's enrollment?
CREATE TABLE table_23268 ("Institution" text,"Location" text,"Nickname" text,"Founded" real,"Type" text,"Enrollment" real,"Joined" real)
SELECT MAX("Enrollment") FROM table_23268 WHERE "Institution" = 'Babson College'
Which providers don't use exchange server?
CREATE TABLE table_19366 ("Application" text,"Version" text,"Cmdlets" text,"Provider" text,"Management GUI" text)
SELECT "Provider" FROM table_19366 WHERE "Application" = 'Exchange Server'
For all employees who have the letters D or S in their first name, find hire_date and the amount of hire_date bin hire_date by weekday, and visualize them by a bar chart, and could you show in descending by the how many hire date?
CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE regions (RE...
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY COUNT(HIRE_DATE) DESC
how many patients admission location is trsf within this facility and item id is 50801?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND lab.itemid = "50801"
Which Males Rank is the highest one that has Females (%) smaller than 40, and Females Rank smaller than 22?
CREATE TABLE table_36283 ("Males Rank" real,"Females Rank" real,"State" text,"HIV awareness (males%)" real,"Females (%)" real)
SELECT MAX("Males Rank") FROM table_36283 WHERE "Females (%)" < '40' AND "Females Rank" < '22'
In what years was the conference record 18-15?
CREATE TABLE table_33719 ("Coach" text,"Years" text,"Record" text,"Conference Record" text,"Overall Win Percentage" text)
SELECT "Years" FROM table_33719 WHERE "Conference Record" = '18-15'
What is the losses when Sunrayia FL is Red Cliffs, and the against is more than 2294?
CREATE TABLE table_65748 ("Sunrayia FL" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real)
SELECT AVG("Losses") FROM table_65748 WHERE "Sunrayia FL" = 'red cliffs' AND "Against" > '2294'
List the number of invoices and the invoice total from California.
CREATE TABLE artists (id number,name text)CREATE TABLE sqlite_sequence (name text,seq text)CREATE TABLE employees (id number,last_name text,first_name text,title text,reports_to number,birth_date time,hire_date time,address text,city text,state text,country text,postal_code text,phone text,fax text,email text)CREATE TA...
SELECT billing_state, COUNT(*), SUM(total) FROM invoices WHERE billing_state = "CA"
What record company has robert craft conducting?
CREATE TABLE table_32673 ("Orchestra" text,"Conductor" text,"Record Company" text,"Year of Recording" real,"Format" text)
SELECT "Record Company" FROM table_32673 WHERE "Conductor" = 'robert craft'
count how many people were club president and give the total .
CREATE TABLE table_203_639 (id number,"year" text,"number" text,"name" text)
SELECT COUNT("name") FROM table_203_639
what is the margin of error when the undicided is 8% and other is 4%?
CREATE TABLE table_10800 ("Poll source" text,"Date(s) administered" text,"Sample size" text,"Margin of error" text,"Barbara Boxer (D)" text,"Carly Fiorina (R)" text,"Other" text,"Undecided" text)
SELECT "Margin of error" FROM table_10800 WHERE "Undecided" = '8%' AND "Other" = '4%'
What are the names of the county that the delegates on 'Appropriations' committee belong to?
CREATE TABLE county (County_name VARCHAR,County_id VARCHAR)CREATE TABLE election (District VARCHAR,Committee VARCHAR)
SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = "Appropriations"
Name the least evening gown for interview more than 7.97 and swimsui of 7.24
CREATE TABLE table_11512 ("State" text,"Swimsuit" real,"Evening gown" real,"Interview" real,"Average" real)
SELECT MIN("Evening gown") FROM table_11512 WHERE "Swimsuit" = '7.24' AND "Interview" > '7.97'
What is the lowest number of episodes in a series with an airing date of 12 jan- 6 feb?
CREATE TABLE table_65897 ("Airing date" text,"English title (Chinese title)" text,"Number of episodes" real,"Genre" text,"Official website" text)
SELECT MIN("Number of episodes") FROM table_65897 WHERE "Airing date" = '12 jan- 6 feb'
On which Surface will Estrella Cabeza Candela play?
CREATE TABLE table_43851 ("Date" text,"Tournament" text,"Surface" text,"Opponent" text,"Score" text)
SELECT "Surface" FROM table_43851 WHERE "Opponent" = 'estrella cabeza candela'
Who were the candidates in the district of South Carolina 5?
CREATE TABLE table_1346137_4 (candidates VARCHAR,district VARCHAR)
SELECT candidates FROM table_1346137_4 WHERE district = "South Carolina 5"
give me the number of patients whose days of hospital stay is greater than 7 and diagnoses short title is single lb in-hosp w cs?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "7" AND diagnoses.short_title = "Single lb in-hosp w cs"
What date was the set 1 25 23, and a Set 3 of 25 14?
CREATE TABLE table_45190 ("Date" text,"Score" text,"Set 1" text,"Set 2" text,"Set 3" text,"Total" text)
SELECT "Date" FROM table_45190 WHERE "Set 1" = '25–23' AND "Set 3" = '25–14'
ROOMBA > year old questions that have active close votes. http://meta.stackexchange.com/questions/78048/enable-automatic-deletion-of-old-unanswered-zero-score-questions-after-a-year/92006#92006 No need to vote to close these as 1 downvote should delete them anytime within the next 7 days.
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 q.Id AS "post_link", COUNT(pf.FlagTypeId) AS CVs, q.ViewCount FROM Posts AS q INNER JOIN Users AS u ON u.Id = q.OwnerUserId INNER JOIN PostHistory AS ph ON ph.Id = q.Id INNER JOIN PendingFlags AS pf ON pf.PostId = q.Id WHERE q.PostTypeId = 1 AND DATEDIFF(DAY, q.CreationDate, GETDATE()) > 365 AND q.Score = 0 AND ...
Which classes gives me the easiest path to cover the ULCS requirement ?
CREATE TABLE area (course_id int,area varchar)CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE jobs (job_id int,job_title varchar,description varchar,requirement varchar,city varchar,state varchar,country varchar,zip int)CREATE TABLE program (program_id int,name varchar,college varc...
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_co...
when in a year before patient 26995 received for the last time a procedure?
CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)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_i...
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26995) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY procedures_icd.charttime DESC LIMIT ...
Who was the shirt sponsor for the Blackburn Rovers?
CREATE TABLE table_70932 ("Team" text,"Manager 1" text,"Captain" text,"Kit manufacturer" text,"Shirt sponsor" text)
SELECT "Shirt sponsor" FROM table_70932 WHERE "Team" = 'blackburn rovers'
Name the position for indiana state
CREATE TABLE table_name_17 (position VARCHAR,school VARCHAR)
SELECT position FROM table_name_17 WHERE school = "indiana state"
calculate the number of patients with abdominal pain as primary disease and aged below 72
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.diagnosis = "ABDOMINAL PAIN" AND demographic.age < "72"
What did Orebro score when Umea scored 2?
CREATE TABLE table_name_67 (örebro VARCHAR,umeå VARCHAR)
SELECT örebro FROM table_name_67 WHERE umeå = "2"
For which network was Chris Walby the color commentator after 1990?
CREATE TABLE table_62607 ("Year" real,"Network" text,"Play-by-play" text,"Colour commentator(s)" text,"Pregame host" text)
SELECT "Network" FROM table_62607 WHERE "Year" > '1990' AND "Colour commentator(s)" = 'chris walby'
What is Position, when Event is 60 m, and when Venue is Budapest , Hungary?
CREATE TABLE table_name_40 (position VARCHAR,event VARCHAR,venue VARCHAR)
SELECT position FROM table_name_40 WHERE event = "60 m" AND venue = "budapest , hungary"
how much patient 28775 weighs during the last hospital encounter for the last time?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number...
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 = 28775 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND chartevent...
count the number of patients who had a head ct scan procedure in the same hospital visit after being given a endotracheal tube removal procedure during this year.
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,obs...
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'endotracheal tube removal' AND DATETIME(treatment.treatmenttime, 'start o...
what's the date where location is illinois
CREATE TABLE table_11622255_1 (date VARCHAR,location VARCHAR)
SELECT date FROM table_11622255_1 WHERE location = "Illinois"
Who was the driver in round 8?
CREATE TABLE table_3935 ("Round" real,"Race" text,"Pole position" text,"Fastest lap" text,"Most laps led" text,"Driver" text,"Team" text,"Manufacturer" text,"Report" text)
SELECT "Driver" FROM table_3935 WHERE "Round" = '8'
Who had the high assist in the game where the record is 13-11?
CREATE TABLE table_18813011_6 (high_assists VARCHAR,record VARCHAR)
SELECT high_assists FROM table_18813011_6 WHERE record = "13-11"
What is the Alpha 3 code for the area also known as FO?
CREATE TABLE table_222771_1 (alpha_3_code VARCHAR,alpha_2_code VARCHAR)
SELECT alpha_3_code FROM table_222771_1 WHERE alpha_2_code = "FO"
Give the section titles of the document with the name 'David CV'.
CREATE TABLE documents (document_code text,document_structure_code text,document_type_code text,access_count number,document_name text)CREATE TABLE images (image_id number,image_alt_text text,image_name text,image_url text)CREATE TABLE document_functional_areas (document_code text,functional_area_code text)CREATE TABLE...
SELECT t2.section_title FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code WHERE t1.document_name = "David CV"
Name the number of population density 2010 for duque de caxias
CREATE TABLE table_14986292_1 (population_density_2010___km²_ VARCHAR,administrative_division VARCHAR)
SELECT COUNT(population_density_2010___km²_) FROM table_14986292_1 WHERE administrative_division = "Duque de Caxias"
What is Player, when Position is DB, and when College is Saint Mary's?
CREATE TABLE table_46024 ("Pick #" real,"CFL Team" text,"Player" text,"Position" text,"College" text)
SELECT "Player" FROM table_46024 WHERE "Position" = 'db' AND "College" = 'saint mary''s'
is the order # of top 6 greater than that of top 8 ?
CREATE TABLE table_204_51 (id number,"week #" text,"theme" text,"song choice" text,"original artist" text,"order #" number,"result" text)
SELECT (SELECT "order #" FROM table_204_51 WHERE "week #" = 'top 6') > (SELECT "order #" FROM table_204_51 WHERE "week #" = 'top 8')
Which coach works with Robert Harvey?
CREATE TABLE table_47873 ("Season" text,"Coach" text,"Captain" text,"Alternate (1)" text,"Alternate (2)" text)
SELECT "Coach" FROM table_47873 WHERE "Captain" = 'robert harvey'
What year did the team based in the city of Winamac join the conference?
CREATE TABLE table_63694 ("School" text,"City" text,"Team Name" text,"County" text,"Year Joined" text,"Year Left" text)
SELECT "Year Joined" FROM table_63694 WHERE "City" = 'winamac'
Comments to Answers to my Questions by specific user.
CREATE TABLE ReviewTaskResultTypes (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 PostLinks (Id number,Creatio...
WITH YourQuestions AS (SELECT Id FROM Posts WHERE OwnerUserId = '##UserId##' AND PostTypeId = 1), AnswersToYourQuestions AS (SELECT * FROM Posts WHERE ParentId IN (SELECT Id FROM YourQuestions)) SELECT PostId AS "post_link", CreationDate, Id AS "comment_link" FROM Comments WHERE UserId = '##CommenterUserId##' AND PostI...
Hour, Length -> Score, Answers.
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId numbe...
SELECT p.Id AS Id, TIME_TO_STR(p.CreationDate, '%-HOUR') AS Hour, LENGTH(p.Title) AS LengthOfTitle, LENGTH(p.Body) AS LengthOfBody, p.Score AS Score, p.ViewCount AS Views, p.AnswerCount AS Answers FROM Posts AS p WHERE LENGTH(p.Title) > 0 AND p.CreationDate > CAST('2014-10-01 00:00:00.000' AS DATETIME) AND p.CreationDa...
What is the Player from McGill?
CREATE TABLE table_name_30 (player VARCHAR,school_club_team VARCHAR)
SELECT player FROM table_name_30 WHERE school_club_team = "mcgill"
Testing, is this thing on? (100 users...).
CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,Is...
SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY Id) AS row FROM Users) AS a WHERE a.row > 5 AND a.row <= 100
What is the lowest Game, when Date is 'November 1'?
CREATE TABLE table_name_45 (game INTEGER,date VARCHAR)
SELECT MIN(game) FROM table_name_45 WHERE date = "november 1"
What game week did the Buccaneers play against the Minnesota Vikings?
CREATE TABLE table_name_47 (week VARCHAR,opponent VARCHAR)
SELECT week FROM table_name_47 WHERE opponent = "minnesota vikings"
how many patients had been released until 2102 from the hospital?
CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE d_items (row_id number,i...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE NOT admissions.dischtime IS NULL AND STRFTIME('%y', admissions.dischtime) <= '2102'
Find the job ID for those jobs which average salary is above 8000.
CREATE TABLE job_history (employee_id number,start_date time,end_date time,job_id text,department_id number)CREATE TABLE regions (region_id number,region_name text)CREATE TABLE locations (location_id number,street_address text,postal_code text,city text,state_province text,country_id text)CREATE TABLE departments (depa...
SELECT job_id FROM employees GROUP BY job_id HAVING AVG(salary) > 8000
What is the week 4 opponent for the year with a week 10 opponent of Michigan State (8-2)?
CREATE TABLE table_38964 ("Week 2 Sept 7" text,"Week 3 Sept 14" text,"Week 4 Sept 21" text,"Week 5 Sept 28" text,"Week 6 Oct 5" text,"Week 7 Oct 12" text,"Week 10 Nov 2" text,"Week 12 Nov 16" text,"Week 14 Nov 30" text,"Week 15 Dec 7" text,"Week 16 (Final) Jan 9" text)
SELECT "Week 4 Sept 21" FROM table_38964 WHERE "Week 10 Nov 2" = 'michigan state (8-2)'
how many sensors have a crop area of less than 1.0 ?
CREATE TABLE table_203_356 (id number,"type" text,"diagonal (mm)" text,"width (mm)" text,"height (mm)" text,"area (mm2)" text,"stops (area)" number,"crop factor" text)
SELECT COUNT("type") FROM table_203_356 WHERE "crop factor" < 1.0
What Social Democratic has the Democratic and Social Centre of 4.4% 4 seats?
CREATE TABLE table_65849 ("Date Released" text,"Institute" text,"Social Democratic" text,"Socialist" text,"Green-Communist" text,"Democratic Renewal" text,"Democratic and Social Centre" text,"Lead" text)
SELECT "Social Democratic" FROM table_65849 WHERE "Democratic and Social Centre" = '4.4% 4 seats'
Which Gold has a Bronze larger than 6?
CREATE TABLE table_36676 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MIN("Gold") FROM table_36676 WHERE "Bronze" > '6'
How many different professors are there for the different schools Show bar chart, and show in asc by the SCHOOL_CODE.
CREATE TABLE COURSE (CRS_CODE varchar(10),DEPT_CODE varchar(10),CRS_DESCRIPTION varchar(35),CRS_CREDIT float(8))CREATE TABLE CLASS (CLASS_CODE varchar(5),CRS_CODE varchar(10),CLASS_SECTION varchar(2),CLASS_TIME varchar(20),CLASS_ROOM varchar(8),PROF_NUM int)CREATE TABLE ENROLL (CLASS_CODE varchar(5),STU_NUM int,ENROLL_...
SELECT SCHOOL_CODE, COUNT(*) FROM DEPARTMENT AS T1 JOIN PROFESSOR AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.SCHOOL_CODE ORDER BY SCHOOL_CODE
Count of New Questions and Answers Since a Specified Year.
CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE ReviewTasks (Id number,ReviewTaskTy...
SELECT YEAR(CreationDate) AS "year", MONTH(CreationDate) AS "month", SUM(CASE WHEN Posts.PostTypeId = 1 THEN 1 ELSE 0 END) AS QuestionCount, SUM(CASE WHEN Posts.PostTypeId = 2 THEN 1 ELSE 0 END) AS AnswerCount FROM Posts WHERE YEAR(CreationDate) >= 2014 GROUP BY YEAR(CreationDate), MONTH(CreationDate) ORDER BY YEAR(Cre...
How many accounts for each customer? Show a bar chart that groups by customer's last name, I want to rank from high to low by the total number.
CREATE TABLE Invoice_Line_Items (order_item_id INTEGER,invoice_number INTEGER,product_id INTEGER,product_title VARCHAR(80),product_quantity VARCHAR(50),product_price DECIMAL(19,4),derived_product_cost DECIMAL(19,4),derived_vat_payable DECIMAL(19,4),derived_total_cost DECIMAL(19,4))CREATE TABLE Products (product_id INTE...
SELECT customer_last_name, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC
What is the total number for the week with a record of 0-11?
CREATE TABLE table_9433 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Lions' Points" text,"Opponents' Points" text,"Record" text,"Streak" text,"Attendance" text)
SELECT COUNT("Week") FROM table_9433 WHERE "Record" = '0-11'
What is Team (B), when S No is less than 18, when Margin is 8 Wickets, and when Match Date is Oct 30, 1989?
CREATE TABLE table_41139 ("S No" real,"Team (A)" text,"Team (B)" text,"Winner" text,"Margin" text,"Match Date" text)
SELECT "Team (B)" FROM table_41139 WHERE "S No" < '18' AND "Margin" = '8 wickets' AND "Match Date" = 'oct 30, 1989'
What is the number of minutes when there are more than 4 goals and 3 assists?
CREATE TABLE table_40239 ("Player" text,"Position" text,"GP (GS)" text,"Minutes" real,"Goals" real,"Assists" real)
SELECT "Minutes" FROM table_40239 WHERE "Goals" > '4' AND "Assists" = '3'
how many days it's been since patient 012-66291's first bun lab test in the current hospital visit?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicm...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', lab.labresulttime)) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-66291' AND patient.hospi...
what is the i/o bus when the sspec numebr is sr0n5(l1)?
CREATE TABLE table_name_28 (i_o_bus VARCHAR,sspec_number VARCHAR)
SELECT i_o_bus FROM table_name_28 WHERE sspec_number = "sr0n5(l1)"
what is the number of drugs patient 64185 has been prescribed since 6 years ago?
CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod 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_labitems (row_id number,itemid number,label text)CREATE TABLE transfers (row_id number,subject...
SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 64185) AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-6 year')
Average Reputation of SO user in United Kingdom with reputation equal or more than 15.
CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE PostTy...
SELECT AVG(Reputation) AS "average_reputation", COUNT(Id) AS "total_users" FROM Users WHERE LOWER(Location) LIKE '%united kingdom' AND Reputation >= 15
What is the largest drawn that has a played less than 38?
CREATE TABLE table_37473 ("Position" real,"Team" text,"Points" real,"Played" real,"Drawn" real,"Lost" real,"Against" real,"Difference" text)
SELECT MAX("Drawn") FROM table_37473 WHERE "Played" < '38'
how many patients whose admission year is less than 2124 and lab test category is hematology?
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 text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2124" AND lab."CATEGORY" = "Hematology"
What is the Location for the woodburn dragstrip?
CREATE TABLE table_35741 ("Name" text,"Location" text,"State" text,"Opened (closing date if defunct)" text,"Surface" text,"Length" text)
SELECT "Location" FROM table_35741 WHERE "Name" = 'woodburn dragstrip'
How many episodes in the season had the title, 'first blood'?
CREATE TABLE table_31009 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"U.S. viewers (millions)" text)
SELECT COUNT("No. in season") FROM table_31009 WHERE "Title" = 'First Blood'
What place had a To par of 10?
CREATE TABLE table_79113 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Place" FROM table_79113 WHERE "To par" = '–10'
when was patient 75658 discharged from the hospital in the previous year for the first time?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)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 labevents (row_id number,subject_id number,hadm_id numb...
SELECT admissions.dischtime FROM admissions WHERE admissions.subject_id = 75658 AND DATETIME(admissions.dischtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY admissions.dischtime LIMIT 1
What is fitzroy's score as the home team?
CREATE TABLE table_name_49 (home_team VARCHAR)
SELECT home_team AS score FROM table_name_49 WHERE home_team = "fitzroy"
For those employees who was hired before 2002-06-21, find job_id and the sum of manager_id , and group by attribute job_id, and visualize them by a bar chart, and list Y in desc order.
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 employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),CO...
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID) DESC
What is the salary and name of the employee who has the most number of certificates on aircrafts with distance more than 5000?
CREATE TABLE Certificate (eid VARCHAR,aid VARCHAR)CREATE TABLE Employee (name VARCHAR,eid VARCHAR)CREATE TABLE Aircraft (aid VARCHAR,distance INTEGER)
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.distance > 5000 GROUP BY T1.eid ORDER BY COUNT(*) DESC LIMIT 1
Name the total number of races for 15th position
CREATE TABLE table_26861 ("Season" real,"Series" text,"Team" text,"Races" real,"Wins" real,"Poles" real,"FLaps" real,"Podiums" real,"Points" text,"Position" text)
SELECT COUNT("Races") FROM table_26861 WHERE "Position" = '15th'
developers over 500 reps in Ahmedabad.
CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Tags (Id numbe...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE (LOWER(Location) LIKE '%ahmedabad%' OR UPPER(Location) LIKE '%AHMEDABAD%' OR Location LIKE '%Ahmedabad%') AND Reputation >= 500 ORDER BY Reputation DESC
Which All Games have a Nonconference Games % smaller than 0.75, and a Ranked AP Nonconference of 3 7?
CREATE TABLE table_9422 ("Team" text,"All Games" text,"All Games %" real,"Nonconference Games" text,"Nonconference Games %" real,"Ranked AP Nonconference" text)
SELECT "All Games" FROM table_9422 WHERE "Nonconference Games %" < '0.75' AND "Ranked AP Nonconference" = '3–7'