instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
what is the number of patients whose admission type is emergency and procedure icd9 code is 331?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND procedures.icd9_code = "331"
Who built the ship that is 42.8 m long and was delivered in 2007?
CREATE TABLE table_68321 ("Name of Ship" text,"Length" text,"Max speed" text,"Crew/Capacity" text,"Class" text,"Builder" text,"Delivery" real)
SELECT "Builder" FROM table_68321 WHERE "Length" = '42.8 m' AND "Delivery" = '2007'
What is the To par of the Player with a Score of 73-67-68=208?
CREATE TABLE table_name_89 (to_par VARCHAR,score VARCHAR)
SELECT to_par FROM table_name_89 WHERE score = 73 - 67 - 68 = 208
What country has CD format and catalog RCD 10523?
CREATE TABLE table_name_45 (country VARCHAR,format VARCHAR,catalog VARCHAR)
SELECT country FROM table_name_45 WHERE format = "cd" AND catalog = "rcd 10523"
On what date was the 48th Edition raced?
CREATE TABLE table_78777 ("Edition" text,"Date" text,"Winner" text,"Country" text,"Time (h : m : s)" text)
SELECT "Date" FROM table_78777 WHERE "Edition" = '48th'
Compute the number of each type of job ids for employees who make more than the highest-earning employee with title PU_MAN, with a bar chart.
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 countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPART...
SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE SALARY > (SELECT MAX(SALARY) FROM employees WHERE JOB_ID = 'PU_MAN') GROUP BY JOB_ID
Show the number of courses for each course description in a bar chart, and sort bar from low to high order please.
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))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)C...
SELECT CRS_DESCRIPTION, COUNT(CRS_DESCRIPTION) 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 JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY CRS_DESCRIPTION ORDER BY CRS_DESCRIPTION
What is the lowest Loss for the player named total that has a long greater than 55?
CREATE TABLE table_name_95 (loss INTEGER,name VARCHAR,long VARCHAR)
SELECT MIN(loss) FROM table_name_95 WHERE name = "total" AND long > 55
provide the number of patients whose admission type is emergency and diagnosis long title is chronic obstructive asthma, unspecified.
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.admission_type = "EMERGENCY" AND diagnoses.long_title = "Chronic obstructive asthma, unspecified"
Find the number of courses provided in each year with a group line chart that groups by semester.
CREATE TABLE teaches (ID varchar(5),course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0))CREATE TABLE advisor (s_ID varchar(5),i_ID varchar(5))CREATE TABLE prereq (course_id varchar(8),prereq_id varchar(8))CREATE TABLE takes (ID varchar(5),course_id varchar(8),sec_id varchar(8),semester varchar(...
SELECT year, COUNT(*) FROM section GROUP BY semester, year
How many Pick has a Round smaller than 13, and a Position of fullback?
CREATE TABLE table_36510 ("Round" real,"Pick" real,"Player" text,"Position" text,"School/Club Team" text)
SELECT COUNT("Pick") FROM table_36510 WHERE "Round" < '13' AND "Position" = 'fullback'
Which level is quarterfinals domestic cup?
CREATE TABLE table_name_22 (level VARCHAR,domestic_cup VARCHAR)
SELECT level FROM table_name_22 WHERE domestic_cup = "quarterfinals"
WHAT YEAR WAS ROBERT COOMBES CHAMPION ON MAY 7?
CREATE TABLE table_name_97 (year VARCHAR,champion VARCHAR,date VARCHAR)
SELECT COUNT(year) FROM table_name_97 WHERE champion = "robert coombes" AND date = "may 7"
what is minimum age of patients whose discharge location is disch-tran to psych hosp and primary disease is angioedema?
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 MIN(demographic.age) FROM demographic WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND demographic.diagnosis = "ANGIOEDEMA"
When 2 is the ka-band how many properties are there?
CREATE TABLE table_186468_1 (property VARCHAR,ka_band VARCHAR)
SELECT COUNT(property) FROM table_186468_1 WHERE ka_band = "2"
Which Monarch has succession unclear 1100-1103 as his Status?
CREATE TABLE table_name_60 (monarch VARCHAR,status VARCHAR)
SELECT monarch FROM table_name_60 WHERE status = "succession unclear 1100-1103"
what is the highest top-5 when the top-25 is less than 4, cuts made is more than 3 and wins is 0?
CREATE TABLE table_name_29 (top_5 INTEGER,wins VARCHAR,top_25 VARCHAR,cuts_made VARCHAR)
SELECT MAX(top_5) FROM table_name_29 WHERE top_25 < 4 AND cuts_made > 3 AND wins < 0
how many patients with admission type emergency had diagnoses titled gastrointest hemorr 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 procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,sho...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.short_title = "Gastrointest hemorr NOS"
Which event resulted in loss with an Opponent of maurice smith?
CREATE TABLE table_71199 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Time" text,"Location" text)
SELECT "Event" FROM table_71199 WHERE "Res." = 'loss' AND "Opponent" = 'maurice smith'
what is the number of patients whose primary disease is brain mass;intracranial hemorrhage and lab test fluid is blood?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "BRAIN MASS;INTRACRANIAL HEMORRHAGE" AND lab.fluid = "Blood"
give me the number of patients whose admission year is less than 2144 and diagnoses icd9 code is 5720?
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.admityear < "2144" AND diagnoses.icd9_code = "5720"
What is the date for catalog RCD 10160?
CREATE TABLE table_59717 ("Country" text,"Date" text,"Label" text,"Format" text,"Catalog" text)
SELECT "Date" FROM table_59717 WHERE "Catalog" = 'rcd 10160'
how many hours has it been from the first time patient 015-23047 received a rdw lab test in their current hospital visit?
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 intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabe...
SELECT 24 * (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 = '015-23047' AND patient.hosp...
What 50 yard Freestyle has a 100 yard Butterfly of diving?
CREATE TABLE table_59616 ("Combined" text,"50 yard Freestyle" text,"100 yard Freestyle" text,"200 yard Freestyle" text,"500 yard Freestyle" text,"100 yard Backstroke" text,"100 yard Butterfly" text)
SELECT "50 yard Freestyle" FROM table_59616 WHERE "100 yard Butterfly" = 'diving'
Name the timeslot for season 5
CREATE TABLE table_1049 ("Season" real,"Episodes" real,"Premiere Date" text,"End Date" text,"Timeslot" text)
SELECT "Timeslot" FROM table_1049 WHERE "Season" = '5'
what's the jurisdiction where percent yes is 43.4
CREATE TABLE table_414 ("Jurisdiction" text,"Voted Yes" real,"Percent Yes" text,"Voted No" real,"Percent No" text)
SELECT "Jurisdiction" FROM table_414 WHERE "Percent Yes" = '43.4'
What role has the team of Troyes AC Grenoble Foot?
CREATE TABLE table_name_89 (role VARCHAR,teams VARCHAR)
SELECT role FROM table_name_89 WHERE teams = "troyes ac grenoble foot"
Which Vertices have a Dual Archimedean solid of truncated dodecahedron?
CREATE TABLE table_37953 ("picture" text,"Dual Archimedean solid" text,"Faces" real,"Edges" real,"Vertices" real,"Face Polygon" text)
SELECT MAX("Vertices") FROM table_37953 WHERE "Dual Archimedean solid" = 'truncated dodecahedron'
What kind of locomotive is Winston Churchill?
CREATE TABLE table_name_93 (locomotive_type VARCHAR,name VARCHAR)
SELECT locomotive_type FROM table_name_93 WHERE name = "winston churchill"
What was the Average Attendance during the Year in which there were 9 Home Games?
CREATE TABLE table_7175 ("Year" real,"League" text,"Average Attendance" real,"# of Home Games" real,"League Rank" text,"Canada - USA Rank" text)
SELECT MAX("Average Attendance") FROM table_7175 WHERE "# of Home Games" = '9'
What number does the player from Ohio play with?
CREATE TABLE table_254 ("Player" text,"No." text,"Nationality" text,"Position" text,"Years for Jazz" text,"School/Club Team" text)
SELECT "No." FROM table_254 WHERE "School/Club Team" = 'Ohio'
Name the length for stage ss22
CREATE TABLE table_13050822_2 (length VARCHAR,stage VARCHAR)
SELECT length FROM table_13050822_2 WHERE stage = "SS22"
What was the score of the Red Wings game when Vancouver was the home team?
CREATE TABLE table_name_71 (score VARCHAR,home VARCHAR)
SELECT score FROM table_name_71 WHERE home = "vancouver"
What is the decay mode of the 265m hs isotope discovered in 1984?
CREATE TABLE table_name_28 (decay_mode VARCHAR,discovery_year VARCHAR,isotope VARCHAR)
SELECT decay_mode FROM table_name_28 WHERE discovery_year = "1984" AND isotope = "265m hs"
What is the average time in a rank of 61?
CREATE TABLE table_name_29 (time INTEGER,rank VARCHAR)
SELECT AVG(time) FROM table_name_29 WHERE rank = 61
what television service are in the united kingdom and n is greater than 854.0?
CREATE TABLE table_72733 ("N\u00b0" real,"Television service" text,"Country" text,"Language" text,"Content" text,"DAR" text,"HDTV" text,"Package/Option" text)
SELECT "Television service" FROM table_72733 WHERE "Country" = 'United Kingdom' AND "N\u00b0" > '854.0'
Which Decile has an Authority of state, a Roll smaller than 61, and an Area of kotemaori?
CREATE TABLE table_70267 ("Name" text,"Years" text,"Gender" text,"Area" text,"Authority" text,"Decile" real,"Roll" real)
SELECT "Decile" FROM table_70267 WHERE "Authority" = 'state' AND "Roll" < '61' AND "Area" = 'kotemaori'
how many albums had a higher position on either chart than 50 ?
CREATE TABLE table_203_137 (id number,"title" text,"album details" text,"peak chart positions\nus" number,"peak chart positions\nus r&b" number,"certifications" text)
SELECT COUNT("title") FROM table_203_137 WHERE "peak chart positions\nus" <= 50 OR "peak chart positions\nus r&b" <= 50
What was the result of the game on November 7, 1999?
CREATE TABLE table_35176 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" text)
SELECT "Result" FROM table_35176 WHERE "Date" = 'november 7, 1999'
Name the archive where run time 24:04
CREATE TABLE table_1776943_1 (archive VARCHAR,run_time VARCHAR)
SELECT archive FROM table_1776943_1 WHERE run_time = "24:04"
How many students in each department? Give me a bar chart.
CREATE TABLE course (course_id varchar(8),title varchar(50),dept_name varchar(20),credits numeric(2,0))CREATE TABLE student (ID varchar(5),name varchar(20),dept_name varchar(20),tot_cred numeric(3,0))CREATE TABLE instructor (ID varchar(5),name varchar(20),dept_name varchar(20),salary numeric(8,2))CREATE TABLE departmen...
SELECT dept_name, COUNT(dept_name) FROM student GROUP BY dept_name ORDER BY tot_cred
What is the sum of values for INT'S with Mossy Cade for 0 yards and less than 3 sacks?
CREATE TABLE table_37007 ("Player" text,"Sacks" real,"INT'S" real,"Yards" real,"Average" real,"Long" text)
SELECT SUM("INT'S") FROM table_37007 WHERE "Yards" = '0' AND "Sacks" < '3' AND "Player" = 'mossy cade'
what is the number of ties listed ?
CREATE TABLE table_204_475 (id number,"home team" text,"score" text,"away team" text,"date" text,"agg" text)
SELECT COUNT(*) FROM table_204_475 WHERE "score" = "score"
How much To par has a Total larger than 149, and a Country of united states, and a Year(s) won of 1997?
CREATE TABLE table_59809 ("Player" text,"Country" text,"Year(s) won" text,"Total" real,"To par" real)
SELECT SUM("To par") FROM table_59809 WHERE "Total" > '149' AND "Country" = 'united states' AND "Year(s) won" = '1997'
What was the lowest attendance at a Fitzroy match?
CREATE TABLE table_33650 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT MIN("Crowd") FROM table_33650 WHERE "Home team" = 'fitzroy'
What is the most bronze can be when silver is larger than 2, and the nation is germany, and gold is more than 8?
CREATE TABLE table_name_81 (bronze INTEGER,gold VARCHAR,silver VARCHAR,nation VARCHAR)
SELECT MAX(bronze) FROM table_name_81 WHERE silver > 2 AND nation = "germany" AND gold > 8
What is the total rank of the celebrity with a 34.66 average and a season greater than 1?
CREATE TABLE table_name_39 (rank VARCHAR,average VARCHAR,season VARCHAR)
SELECT COUNT(rank) FROM table_name_39 WHERE average = 34.66 AND season > 1
What is the money list rank for player Doug Barron?
CREATE TABLE table_29504351_2 (money_list_rank INTEGER,player VARCHAR)
SELECT MAX(money_list_rank) FROM table_29504351_2 WHERE player = "Doug Barron"
Who had the high rebounds when the high assists were from J. Johnson (7)?
CREATE TABLE table_11961582_10 (high_rebounds VARCHAR,high_assists VARCHAR)
SELECT high_rebounds FROM table_11961582_10 WHERE high_assists = "J. Johnson (7)"
Which type is filed under the Group Animated?
CREATE TABLE table_name_56 (type VARCHAR,group VARCHAR)
SELECT type FROM table_name_56 WHERE group = "animated"
What is the low week from october 15, 1961?
CREATE TABLE table_77762 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real)
SELECT MIN("Week") FROM table_77762 WHERE "Date" = 'october 15, 1961'
What was the 2nd leg for team #1 River Plate?
CREATE TABLE table_26842 ("Team #1" text,"Points" text,"Team #2" text,"1st leg" text,"2nd leg" text)
SELECT "2nd leg" FROM table_26842 WHERE "Team #1" = 'River Plate'
Tell me the versions for czechoslovakia?
CREATE TABLE table_74499 ("Aircraft" text,"Origin" text,"Type" text,"Versions" text,"In service" text)
SELECT "Versions" FROM table_74499 WHERE "Origin" = 'czechoslovakia'
provide the number of patients whose ethnicity is white - russian and drug type is main?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND prescriptions.drug_type = "MAIN"
is the rbc of patient 012-27355's measured at 2100-08-27 07:42:00 greater than measured at 2100-08-21 09:08:00?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid numbe...
SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-27355')) AND lab.labname = 'rbc' AND lab.labresulttime = '2100-08-27 07:42:...
How many battles resulted in Battle of the Yellow Sea?
CREATE TABLE table_3686 ("Date" text,"Battles" text,"Conflict" text,"Combatants A" text,"Combatants B" text,"Result" text)
SELECT COUNT("Result") FROM table_3686 WHERE "Battles" = 'Battle of the Yellow Sea'
Who was the past teacher for CMBIOL 685 ?
CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE student_record (student_id int,course_id int,semester int,grade varchar,how varchar,transfer_source varchar,earn_credit varchar,repeat_term varchar,test_id varchar)CREATE TABLE instructor (instructor_id int,name varchar,uniqna...
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN semester...
Find the last name and gender of the students who are playing both Call of Destiny and Works of Widenius games.
CREATE TABLE plays_games (stuid number,gameid number,hours_played number)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE video_games (gameid number,gname text,gtype text)CREATE TABLE sportsinfo (stuid number,sportname text,hoursperweek...
SELECT lname, sex FROM student WHERE stuid IN (SELECT T1.stuid FROM plays_games AS T1 JOIN video_games AS T2 ON T1.gameid = T2.gameid WHERE T2.gname = "Call of Destiny" INTERSECT SELECT T1.stuid FROM plays_games AS T1 JOIN video_games AS T2 ON T1.gameid = T2.gameid WHERE T2.gname = "Works of Widenius")
My answers to bad questions.
CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDa...
SELECT CASE WHEN q.AcceptedAnswerId = a.Id THEN 1 ELSE 0 END AS "accepted", a.Score AS "score", a.Id AS "post_link", q.ClosedDate AS "date_closed", a.CreationDate AS "date_posted" FROM Posts AS a INNER JOIN Posts AS q ON a.ParentId = q.Id WHERE NOT q.ClosedDate IS NULL AND NOT EXISTS(SELECT 1 FROM PostHistory WHERE Pos...
show me the cheapest one way fares from SAN DIEGO to MIAMI
CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_st...
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN DIEGO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.ci...
Return a bar chart on how many faculty members does each building have? List the result with the name of the building, and rank from low to high by the x-axis.
CREATE TABLE Faculty_Participates_in (FacID INTEGER,actid INTEGER)CREATE TABLE Activity (actid INTEGER,activity_name varchar(25))CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTEGER,city_code VARCHAR(3))CREATE TABLE Faculty (FacID INTEGER,Lname...
SELECT Building, COUNT(*) FROM Faculty GROUP BY Building ORDER BY Building
what is the name of the episode when the production code is 11.01?
CREATE TABLE table_2226817_12 (title VARCHAR,production_code VARCHAR)
SELECT title FROM table_2226817_12 WHERE production_code = "11.01"
How many nicknames were associated with Milton, Massachusetts?
CREATE TABLE table_1973729_1 (nickname VARCHAR,location VARCHAR)
SELECT COUNT(nickname) FROM table_1973729_1 WHERE location = "Milton, Massachusetts"
What is the Location for the newington international airport?
CREATE TABLE table_35744 ("Name" text,"Location" text,"State" text,"Opened (closing date if defunct)" text,"Surface" text,"Length" text)
SELECT "Location" FROM table_35744 WHERE "Name" = 'newington international airport'
how many total wins did they have in july ?
CREATE TABLE table_204_73 (id number,"date" text,"opponent" text,"score" text,"result" text,"record" text)
SELECT COUNT(*) FROM table_204_73 WHERE "result" = 'win' AND "date" = 7
What is the original air date of the episode directed by Jeff Melman?
CREATE TABLE table_13477468_3 (original_air_date VARCHAR,directed_by VARCHAR)
SELECT original_air_date FROM table_13477468_3 WHERE directed_by = "Jeff Melman"
For those employees who did not have any job in the past, show me the trend about salary over hire_date with a line chart, could you sort x-axis from low to high order?
CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),COMMISSION_PCT decima...
SELECT HIRE_DATE, SALARY FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY HIRE_DATE
how many players hit more than 600 runs in their career ?
CREATE TABLE table_203_611 (id number,"player" text,"hr" number,"date reached 500 hr" text,"team" text,"seasons played" text)
SELECT COUNT("player") FROM table_203_611 WHERE "hr" > 600
What did the team score at home in north melbourne?
CREATE TABLE table_name_10 (home_team VARCHAR,away_team VARCHAR)
SELECT home_team AS score FROM table_name_10 WHERE away_team = "north melbourne"
count the number of hispanic or latino patients who were born before 2110.
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 WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND demographic.dob_year < "2110"
What is the total number of bronze medals of the team with more than 8 silvers and a total of 50 medals?
CREATE TABLE table_name_67 (bronze VARCHAR,silver VARCHAR,total VARCHAR)
SELECT COUNT(bronze) FROM table_name_67 WHERE silver > 8 AND total = 50
when was patient 012-25893 last discharged this year from the hospital?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE medication (medicationid number,patientunitstayid num...
SELECT patient.hospitaldischargetime FROM patient WHERE patient.uniquepid = '012-25893' AND DATETIME(patient.hospitaldischargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY patient.hospitaldischargetime DESC LIMIT 1
What was the position that the nominated work La Quinta Esencia, which also won an award for best CD coverbox, won?
CREATE TABLE table_name_18 (position VARCHAR,nominated_work VARCHAR,award VARCHAR)
SELECT position FROM table_name_18 WHERE nominated_work = "la quinta esencia" AND award = "best cd coverbox"
Question bodies containing a <br> tag..
CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE Users (Id number,Re...
SELECT p.Id FROM Posts AS p WHERE p.Body LIKE '%<br>%' AND p.PostTypeId = 1 ORDER BY p.Id DESC LIMIT 128
count the number of patients with diagnoses icd9 code 75261.
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 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.icd9_code = "75261"
what was the name of the output that patient 8016 got first on 11/27/this year?
CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid number,intime time,outtime time)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE microbiologyevents (row...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT outputevents.itemid 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 = 8016)) AND DATETIME(outputevents.charttime...
What is the time/retired with 22 laps and a grid of 29?
CREATE TABLE table_58416 ("Rider" text,"Manufacturer" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Time/Retired" FROM table_58416 WHERE "Laps" = '22' AND "Grid" = '29'
What is the average round for the TKO (punches and elbows) method?
CREATE TABLE table_name_89 (round INTEGER,method VARCHAR)
SELECT AVG(round) FROM table_name_89 WHERE method = "tko (punches and elbows)"
what is days of hospital stay and procedure long title of subject id 29541?
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 demographic.days_stay, procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "29541"
Who was the winner if the final venue is Kowloon Cricket Club?
CREATE TABLE table_25122 ("Details" text,"Host Nation(s)" text,"Final Venue" text,"Winner" text,"Result" text,"Runner-up" text)
SELECT "Winner" FROM table_25122 WHERE "Final Venue" = 'Kowloon Cricket Club'
How many channel tv (dt)s are in austin, texas?
CREATE TABLE table_18792 ("City of license /Market" text,"Station" text,"Channel TV (DT)" text,"Owned since" text,"Primary affiliation" text)
SELECT COUNT("Channel TV ( DT )") FROM table_18792 WHERE "City of license /Market" = 'Austin, Texas'
50 most viewed questions on 2015-03-08 on Ask Ubuntu.
CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteUrl text,Location text,AboutMe text,Views number,UpVotes number,DownVotes number,ProfileImageUrl text,EmailHash text,AccountId number)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE T...
SELECT * FROM Posts, PostTypes WHERE Posts.PostTypeId = PostTypes.Id AND PostTypes.Id = 1 AND Posts.CreationDate BETWEEN '2015-03-08 00:00:00' AND '2015-03-08 23:59:59' ORDER BY Posts.ViewCount DESC LIMIT 50
What is the ICAO in India with IATA TRZ?
CREATE TABLE table_name_90 (icao VARCHAR,country VARCHAR,iata VARCHAR)
SELECT icao FROM table_name_90 WHERE country = "india" AND iata = "trz"
What is the name of the player from Malaysia, Kuala Lumpur in Index f8?
CREATE TABLE table_name_67 (name VARCHAR,country VARCHAR,index VARCHAR)
SELECT name FROM table_name_67 WHERE country = "malaysia, kuala lumpur" AND index = "f8"
What is the average round of a player with an overall of 138?
CREATE TABLE table_56076 ("Round" real,"Overall" text,"Player" text,"Position" text,"Nationality" text,"Club team" text)
SELECT AVG("Round") FROM table_56076 WHERE "Overall" = '138'
What is the relationship between Team_ID and ACC_Percent , and group by attribute Team_Name?
CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,Enrollment real,Nickname text,Primary_conference text)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_Perce...
SELECT Team_ID, ACC_Percent FROM basketball_match GROUP BY Team_Name
What is the record of the team with a St. Louis home?
CREATE TABLE table_33978 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text)
SELECT "Record" FROM table_33978 WHERE "Home" = 'st. louis'
Which team has an unknown coach and location of Athelstone?
CREATE TABLE table_name_98 (team VARCHAR,coach VARCHAR,location VARCHAR)
SELECT team FROM table_name_98 WHERE coach = "unknown" AND location = "athelstone"
Name the enrollment with cougars
CREATE TABLE table_3013 ("Institution" text,"Nickname" text,"Location" text,"Founded" real,"Affiliation" text,"Enrollment" real,"Sport" text)
SELECT "Enrollment" FROM table_3013 WHERE "Nickname" = 'Cougars'
since 2104 what was the four most common specimen test?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_...
SELECT t1.spec_type_desc FROM (SELECT microbiologyevents.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM microbiologyevents WHERE STRFTIME('%y', microbiologyevents.charttime) >= '2104' GROUP BY microbiologyevents.spec_type_desc) AS t1 WHERE t1.c1 <= 4
count the number of times patient 006-80884 has had a output (ml)-chest tube #1 right lateral output since 08/2102.
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayi...
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-80884')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.ce...
I want to see the away team the has a home team of richmond
CREATE TABLE table_58272 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Away team" FROM table_58272 WHERE "Home team" = 'richmond'
What's the record of the game on Nov 13?
CREATE TABLE table_name_80 (record VARCHAR,date VARCHAR)
SELECT record FROM table_name_80 WHERE date = "nov 13"
how many prions were identified in 2012 ?
CREATE TABLE table_203_589 (id number,"protein" text,"natural host" text,"normal function" text,"prion state" text,"prion phenotype" text,"year identified" number)
SELECT COUNT("protein") FROM table_203_589 WHERE "year identified" = 2012
who was the only associate justice appointed in 2010 ?
CREATE TABLE table_203_671 (id number,"name" text,"rank" text,"age" number,"years until mandatory retirement" text,"appointed by" text,"year appointed" number)
SELECT "name" FROM table_203_671 WHERE "rank" = 'associate justice' AND "year appointed" = 2010
what is the number of patients whose marital status is single and diagnoses long title is other chronic pulmonary heart diseases?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (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.marital_status = "SINGLE" AND diagnoses.long_title = "Other chronic pulmonary heart diseases"
what is the difference between the weights last measured on the first hospital visit compared to the first value measured on the first hospital visit of patient 006-35134?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text...
SELECT (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-35134' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1) AND NOT patient.admissionweight IS NULL OR...
what was the name of the girl on sixth sense played by mischa barton ?
CREATE TABLE table_200_1 (id number,"year" number,"title" text,"role" text,"notes" text)
SELECT "role" FROM table_200_1 WHERE "title" = 'the sixth sense'
how many times was metoprolol tartrate (lopressor) inj 5 mg prescribed during their first hospital encounter for patient 030-44598.
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(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-44598' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hosp...
What is the highest number of losses of the central murray of lake boga, which has less than 10 wins?
CREATE TABLE table_12571 ("Central Murray" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real)
SELECT MAX("Losses") FROM table_12571 WHERE "Central Murray" = 'lake boga' AND "Wins" < '10'