instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
tell me the route of administration of drug with drug code mago140.
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 prescriptions.route FROM prescriptions WHERE prescriptions.formulary_drug_cd = "MAGO140"
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a scatter chart about the correlation between employee_id and department_id .
CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID ...
SELECT EMPLOYEE_ID, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
How many different final scores were there in 1963?
CREATE TABLE table_24719 ("Outcome" text,"Year" real,"Championship" text,"Surface" text,"Partner" text,"Opponents in the final" text,"Score in the final" text)
SELECT COUNT("Score in the final") FROM table_24719 WHERE "Year" = '1963'
how much magnesium sulfate was prescribed for the first time on their last hospital visit to patient 44451?
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 procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_items (row_id number,itemid number,label text,lin...
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 44451 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND prescriptions.drug = 'magnesium sulfate' ORDER BY prescriptions.startdate...
flights between BALTIMORE and WASHINGTON
CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE equipment_sequence (aircraft_code_s...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASH...
What is Place, when Score is '70-70-68-70=278'?
CREATE TABLE table_62606 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text,"Money ($)" real)
SELECT "Place" FROM table_62606 WHERE "Score" = '70-70-68-70=278'
Visualize a pie chart about the proportion of All_Road and School_ID.
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 All_Road, School_ID FROM basketball_match
How many tries did the player have which ended with 20 Points?
CREATE TABLE table_60106 ("Player" text,"Tries" real,"Goals" text,"Field Goals" real,"Points" real)
SELECT "Tries" FROM table_60106 WHERE "Points" = '20'
In stage 13, what is the intergiro classification and is on the team of Asics-c.g.a.?
CREATE TABLE table_name_10 (intergiro_classification VARCHAR,trofeo_fast_team VARCHAR,stage VARCHAR)
SELECT intergiro_classification FROM table_name_10 WHERE trofeo_fast_team = "asics-c.g.a." AND stage = "13"
Shawn Michaels entered the elimination chamber in what position?
CREATE TABLE table_name_86 (entered INTEGER,wrestler VARCHAR)
SELECT SUM(entered) FROM table_name_86 WHERE wrestler = "shawn michaels"
what is the four most frequently ordered lab tests since 1 year ago in patients of age 40s?
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 t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 40 AND 49) AND DATETIME(lab.labresulttime) >= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY lab.labname) AS t1 WHER...
who was the last flag bearer ?
CREATE TABLE table_204_266 (id number,"#" number,"event year" number,"season" text,"flag bearer" text)
SELECT "flag bearer" FROM table_204_266 ORDER BY "#" DESC LIMIT 1
What is the Chassis of the Honda Engine with a Motorola sponsor?
CREATE TABLE table_name_47 (chassis VARCHAR,engine VARCHAR,sponsor VARCHAR)
SELECT chassis FROM table_name_47 WHERE engine = "honda" AND sponsor = "motorola"
What penalties has P.I.M. of 34.5?
CREATE TABLE table_name_88 (penalties VARCHAR,pim VARCHAR)
SELECT penalties FROM table_name_88 WHERE pim = "34.5"
What is the country with a 70-74-69=213 score?
CREATE TABLE table_name_65 (country VARCHAR,score VARCHAR)
SELECT country FROM table_name_65 WHERE score = 70 - 74 - 69 = 213
What is Name, when Team is New York Knicks, and when WSU Year(s) is 1965-68?
CREATE TABLE table_44758 ("Name" text,"WSU Year(s)" text,"Position" text,"Team" text,"Pro Year(s)" text)
SELECT "Name" FROM table_44758 WHERE "Team" = 'new york knicks' AND "WSU Year(s)" = '1965-68'
What was the score for the match on November 13, 2005?
CREATE TABLE table_name_20 (score VARCHAR,date VARCHAR)
SELECT score FROM table_name_20 WHERE date = "november 13, 2005"
What's the rank in West Virginia when the overweight adult was 66.8%?
CREATE TABLE table_name_87 (obesity_rank VARCHAR,overweight__incl_obese__adults VARCHAR,state_and_district_of_columbia VARCHAR)
SELECT obesity_rank FROM table_name_87 WHERE overweight__incl_obese__adults = "66.8%" AND state_and_district_of_columbia = "west virginia"
For those employees who did not have any job in the past, give me the comparison about the average of department_id over the job_id , and group by attribute job_id by a bar chart, and I want to display y axis from high to low order please.
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 regions (REGION_ID decimal(5,0),REGION_NAME varcha...
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY AVG(DEPARTMENT_ID) DESC
Which Total has a Hereditary peer of , and a Lords spiritual of , and a Life peers of 2, and an Affiliation of plaid cymru?
CREATE TABLE table_name_17 (total VARCHAR,affiliation VARCHAR,life_peers VARCHAR,hereditary_peers VARCHAR,lords_spiritual VARCHAR)
SELECT COUNT(total) FROM table_name_17 WHERE hereditary_peers = "–" AND lords_spiritual = "–" AND life_peers = "2" AND affiliation = "plaid cymru"
all suggested edits for a user. http://meta.stackoverflow.com/questions/276461/see-edits-made-to-my-answers
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 p.Id AS "post_link", s.OwnerUserId AS "user_link", s.Id AS "suggested_edit_link", s.Comment, s.CreationDate, s.ApprovalDate, s.RejectionDate, vt.Name, v.UserId AS "user_link" FROM Posts AS p INNER JOIN SuggestedEdits AS s ON s.PostId = p.Id INNER JOIN SuggestedEditVotes AS v ON v.SuggestedEditId = s.Id INNER JOI...
Which Place has a Score larger than 68, and a Player of david ogrin?
CREATE TABLE table_49293 ("Place" text,"Player" text,"Country" text,"Score" real,"To par" text)
SELECT "Place" FROM table_49293 WHERE "Score" > '68' AND "Player" = 'david ogrin'
Find the year in which the least people enter hall of fame.
CREATE TABLE salary (year number,team_id text,league_id text,player_id text,salary number)CREATE TABLE manager_award (player_id text,award_id text,year number,league_id text,tie text,notes number)CREATE TABLE pitching_postseason (player_id text,year number,round text,team_id text,league_id text,w number,l number,g numb...
SELECT yearid FROM hall_of_fame GROUP BY yearid ORDER BY COUNT(*) LIMIT 1
Which constructor had laps amounting to more than 21 where the driver was John Surtees?
CREATE TABLE table_51479 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Constructor" FROM table_51479 WHERE "Laps" > '21' AND "Driver" = 'john surtees'
display job title and average salary of employees.
CREATE TABLE employees (job_id VARCHAR)CREATE TABLE jobs (job_title VARCHAR,job_id VARCHAR)
SELECT job_title, AVG(salary) FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id GROUP BY T2.job_title
Where was the epicenter of the quake on December 1, 2012?
CREATE TABLE table_name_54 (epicenter VARCHAR,date VARCHAR)
SELECT epicenter FROM table_name_54 WHERE date = "december 1, 2012"
Find the first names of students studying in room 108.
CREATE TABLE list (lastname text,firstname text,grade number,classroom number)CREATE TABLE teachers (lastname text,firstname text,classroom number)
SELECT firstname FROM list WHERE classroom = 108
what is procedure short title and drug code of subject id 24425?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do...
SELECT procedures.short_title, prescriptions.formulary_drug_cd FROM procedures INNER JOIN prescriptions ON procedures.hadm_id = prescriptions.hadm_id WHERE procedures.subject_id = "24425"
What is the lyric fm for rnag 93.2?
CREATE TABLE table_18475946_2 (lyric_fm__mhz_ VARCHAR,rnag__mhz_ VARCHAR)
SELECT lyric_fm__mhz_ FROM table_18475946_2 WHERE rnag__mhz_ = "93.2"
What number of the prerequisites for MACROMOL 512 have I met ?
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 varchar,has_final_exam varchar,textbook varchar,class_address varch...
SELECT COUNT(DISTINCT COURSE_1.department, COURSE_0.number) FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite, student_record WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.department = 'MACROMOL' AND COURSE_1.number = 512 ...
For those records from the products and each product's manufacturer, find name and the average of revenue , and group by attribute name, and visualize them by a bar chart, could you list by the x axis in ascending please?
CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)
SELECT T2.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name
Which nationality is kitchener rangers (ohl) college/junior/club team?
CREATE TABLE table_24579 ("Round #" real,"Pick #" real,"Player" text,"Position" text,"Nationality" text,"College/junior/club team" text)
SELECT "Nationality" FROM table_24579 WHERE "College/junior/club team" = 'Kitchener Rangers (OHL)'
How many draws were there when there were 30 tries against?
CREATE TABLE table_17800 ("Club" text,"Played" text,"Won" text,"Drawn" text,"Lost" text,"Points for" text,"Points against" text,"Tries for" text,"Tries against" text,"Try bonus" text,"Losing bonus" text,"Points" text)
SELECT "Drawn" FROM table_17800 WHERE "Tries against" = '30'
state the number of location attendance where record is 15 10 (5 7)
CREATE TABLE table_23481 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT COUNT("Location Attendance") FROM table_23481 WHERE "Record" = '15–10 (5–7)'
provide the number of patients whose diagnoses short title is other alter consciousnes and lab test fluid is ascites?
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 procedures (subject_id text,hadm_id te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Other alter consciousnes" AND lab.fluid = "Ascites"
What notes did the creature comforts film have?
CREATE TABLE table_name_31 (notes VARCHAR,title VARCHAR)
SELECT notes FROM table_name_31 WHERE title = "creature comforts"
What horse had a starting price of 14/1 and weighted 10-7?
CREATE TABLE table_23539 ("Starting price" text,"Number" real,"Name" text,"Age" real,"Weight (st,lb)" text,"Jockey" text,"Trainer" text,"Owner" text,"Colours" text)
SELECT "Name" FROM table_23539 WHERE "Starting price" = '14/1' AND "Weight (st, lb)" = '10-7'
What record has @ ottawa senators as the opponent?
CREATE TABLE table_name_93 (record VARCHAR,opponent VARCHAR)
SELECT record FROM table_name_93 WHERE opponent = "@ ottawa senators"
What club had a score of 18.1?
CREATE TABLE table_name_87 (club VARCHAR,score VARCHAR)
SELECT club FROM table_name_87 WHERE score = "18.1"
What are the first name and last name of all the teachers?
CREATE TABLE teachers (lastname text,firstname text,classroom number)CREATE TABLE list (lastname text,firstname text,grade number,classroom number)
SELECT DISTINCT firstname, lastname FROM teachers
Who were the candidates in the district won by the incumbent Del Latta?
CREATE TABLE table_18359 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "Candidates" FROM table_18359 WHERE "Incumbent" = 'Del Latta'
In this next semester what will Dr. Charlotte Winston be teaching ?
CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE student (student_id int,lastname varchar,firstname varchar,program_id int,declare_major varchar,total_credit int,total_gpa float,en...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Charlotte Winston%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor...
What name has an overall less than 268, and 1 as the round?
CREATE TABLE table_name_98 (name VARCHAR,overall VARCHAR,round VARCHAR)
SELECT name FROM table_name_98 WHERE overall < 268 AND round = 1
after declan lovett , who was ranked next in the 197172 national hurling league ?
CREATE TABLE table_204_525 (id number,"rank" number,"player" text,"county" text,"tally" text,"total" number,"opposition" text)
SELECT "player" FROM table_204_525 WHERE id = (SELECT id FROM table_204_525 WHERE "player" = 'declan lovett') + 1
What is the lowest number of participants in 2010 when there were 0 participants in 2012?
CREATE TABLE table_name_76 (Id VARCHAR)
SELECT MIN(2010) FROM table_name_76 WHERE 2012 < 0
Visualize a scatter chart about the correlation between ACC_Percent and All_Games_Percent , and group by attribute ACC_Road.
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 ACC_Percent, All_Games_Percent FROM basketball_match GROUP BY ACC_Road
Average question score/views by hour.
CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayN...
SELECT TIME_TO_STR(CreationDate, '%M') AS Month, TIME_TO_STR(CreationDate, '%Y') AS Year, ROUND(AVG(CAST(Score AS FLOAT)), 2) AS AvgScore, AVG(ViewCount) AS AvgViews FROM Posts WHERE PostTypeId = 1 GROUP BY TIME_TO_STR(CreationDate, '%M'), TIME_TO_STR(CreationDate, '%Y') ORDER BY TIME_TO_STR(CreationDate, '%Y'), TIME_T...
What is the score of the New Jersey home game?
CREATE TABLE table_42810 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Leading scorer" text,"Attendance" text,"Record" text)
SELECT "Score" FROM table_42810 WHERE "Home" = 'new jersey'
Who was the TO winning team when the TU winning team was Joe Richardson?
CREATE TABLE table_847 ("Rnd" real,"Circuit" text,"GTO Winning Team" text,"GTU Winning Team" text,"TO Winning Team" text,"TU Winning Team" text,"Results" text)
SELECT "TO Winning Team" FROM table_847 WHERE "TU Winning Team" = 'Joe Richardson'
how many married patients had the diagnosis icd9 code 5570?
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.marital_status = "MARRIED" AND diagnoses.icd9_code = "5570"
Display a pie chart for how many music festivals have had each kind of result, ordered descending by count?
CREATE TABLE music_festival (ID int,Music_Festival text,Date_of_ceremony text,Category text,Volume int,Result text)CREATE TABLE artist (Artist_ID int,Artist text,Age int,Famous_Title text,Famous_Release_date text)CREATE TABLE volume (Volume_ID int,Volume_Issue text,Issue_Date text,Weeks_on_Top real,Song text,Artist_ID ...
SELECT Result, COUNT(*) FROM music_festival GROUP BY Result ORDER BY COUNT(*) DESC
Who was the winner when the third place was fernando meligeni?
CREATE TABLE table_53830 ("Tournament" text,"Winner" text,"Runner-up" text,"Score" text,"Third Place" text)
SELECT "Winner" FROM table_53830 WHERE "Third Place" = 'fernando meligeni'
What shows for 2010 when 2011 is 1r at the US Open tournament?
CREATE TABLE table_name_35 (tournament VARCHAR)
SELECT 2010 FROM table_name_35 WHERE 2011 = "1r" AND tournament = "us open"
how long ago was it that don january won ?
CREATE TABLE table_203_327 (id number,"player" text,"country" text,"year(s) won" text,"r1" number,"r2" number,"total" number,"to par" number)
SELECT present_ref - "year(s) won" FROM table_203_327 WHERE "player" = 'don january'
display users name and text comments.
CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,Pos...
SELECT DisplayName, 'text' FROM Users INNER JOIN Comments ON Users.Id = Comments.UserId WHERE Users.DisplayName LIKE 'Tawfik'
What is the lowest Euro for a ticket with a price per valid day of & 34?
CREATE TABLE table_32774 ("Valid" text,"Within" text,"Price in Euro" real,"Price per Valid Day" text,"Price per \"Within\" Day" text,"Area" text)
SELECT MIN("Price in Euro") FROM table_32774 WHERE "Price per Valid Day" = '& 34'
Who is the winning driver that has a construction of brm?
CREATE TABLE table_58324 ("Race Name" text,"Circuit" text,"Date" text,"Winning driver" text,"Constructor" text,"Report" text)
SELECT "Winning driver" FROM table_58324 WHERE "Constructor" = 'brm'
what was the time of patient 030-8973's hospital admission last year?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweigh...
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '030-8973' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
Return a pie chart on how old is the average person for each job?
CREATE TABLE PersonFriend (name varchar(20),friend varchar(20),year INTEGER)CREATE TABLE Person (name varchar(20),age INTEGER,city TEXT,gender TEXT,job TEXT)
SELECT job, AVG(age) FROM Person GROUP BY job
For those employees who was hired before 2002-06-21, a bar chart shows the distribution of job_id and the sum of manager_id , and group by attribute job_id.
CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,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 decimal(2,2),MANAGE...
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID
Create a bar chart showing the total number across premises type
CREATE TABLE Order_Items (item_id INTEGER,order_item_status_code VARCHAR(15),order_id INTEGER,product_id INTEGER,item_status_code VARCHAR(15),item_delivered_datetime DATETIME,item_order_quantity VARCHAR(80))CREATE TABLE Mailshot_Campaigns (mailshot_id INTEGER,product_category VARCHAR(15),mailshot_name VARCHAR(80),mails...
SELECT premises_type, COUNT(*) FROM Premises GROUP BY premises_type
What is the class of the player with a weight of 242 pounds?
CREATE TABLE table_name_9 (class VARCHAR,weight VARCHAR)
SELECT class FROM table_name_9 WHERE weight = 242
What is the lowest rank of Ukraine with fewer than 14 silver medals, fewer than 3 bronze medals, and a total of 4 medals?
CREATE TABLE table_71298 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MIN("Rank") FROM table_71298 WHERE "Silver" < '14' AND "Bronze" < '3' AND "Total" = '4' AND "Nation" = 'ukraine'
count the number of patients whose diagnosis long title is morbid obesity and the lab test category is chemistry.
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Morbid obesity" AND lab."CATEGORY" = "Chemistry"
When was the game with a result of w 27-24 (ot)?
CREATE TABLE table_name_26 (date VARCHAR,result VARCHAR)
SELECT date FROM table_name_26 WHERE result = "w 27-24 (ot)"
What is the score of the game that had 359 people in attendance?
CREATE TABLE table_name_59 (score VARCHAR,attendance VARCHAR)
SELECT score FROM table_name_59 WHERE attendance = "359"
How many different directors are associated with the writer Gaby Chiappe?
CREATE TABLE table_19800 ("#" real,"Episode" text,"Writer" text,"Director" text,"Original air date" text,"Viewing figure" text)
SELECT COUNT("Director") FROM table_19800 WHERE "Writer" = 'Gaby Chiappe'
Bar chart x axis time y axis meter_100, and show by the y axis from high to low.
CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time text)CREATE TABLE stadiu...
SELECT Time, meter_100 FROM swimmer ORDER BY meter_100 DESC
how many patients admitted before the year 2155 had the drug name bismuth subsalicylate?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2155" AND prescriptions.drug = "Bismuth Subsalicylate"
what is the number of patients whose marital status is widowed and diagnoses short title is nb transitory tachypnea?
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 INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "WIDOWED" AND diagnoses.short_title = "NB transitory tachypnea"
Who remixed the version with a length of 4:22?
CREATE TABLE table_name_67 (remixed_by VARCHAR,length VARCHAR)
SELECT remixed_by FROM table_name_67 WHERE length = "4:22"
A bar chart for what are the number of the first names of all students in Smith Hall?, and show by the bar in ascending.
CREATE TABLE Dorm (dormid INTEGER,dorm_name VARCHAR(20),student_capacity INTEGER,gender VARCHAR(1))CREATE TABLE Has_amenity (dormid INTEGER,amenid INTEGER)CREATE TABLE Lives_in (stuid INTEGER,dormid INTEGER,room_number INTEGER)CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCH...
SELECT Fname, COUNT(Fname) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' GROUP BY Fname ORDER BY Fname
What number last Runners-up where there when the Last win was 1999 and the Runners-up was bigger than 1?
CREATE TABLE table_34401 ("Club" text,"Wins" real,"Last Win" text,"Runners-up" real,"Last Runners-up" real)
SELECT COUNT("Last Runners-up") FROM table_34401 WHERE "Last Win" = '1999' AND "Runners-up" > '1'
What is the 4.45 for Yelena Isinbayeva?
CREATE TABLE table_65760 ("Name" text,"Nationality" text,"4.30" text,"4.45" text,"4.55" text,"Result" real)
SELECT "4.45" FROM table_65760 WHERE "Name" = 'yelena isinbayeva'
what is the highest laps when the grid is 1?
CREATE TABLE table_name_94 (laps INTEGER,grid VARCHAR)
SELECT MAX(laps) FROM table_name_94 WHERE grid = 1
What is the total number of rounds that UCLA has?
CREATE TABLE table_name_41 (round VARCHAR,school VARCHAR)
SELECT COUNT(round) FROM table_name_41 WHERE school = "ucla"
which country won only one medal , a bronze medal ?
CREATE TABLE table_203_812 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number)
SELECT "nation" FROM table_203_812 WHERE "total" = 1 AND "bronze" = 1
What is the fewest total goals scored for players with under 171 league appearances, 151 total appearances, and the DF position?
CREATE TABLE table_name_3 (total_goals INTEGER,position VARCHAR,league_apps VARCHAR,total_apps VARCHAR)
SELECT MIN(total_goals) FROM table_name_3 WHERE league_apps < 171 AND total_apps = 151 AND position = "df"
What is the most elevated Played that has a Lost smaller than 12, and a Name of ec amberg (n), and a Position smaller than 4?
CREATE TABLE table_name_59 (played INTEGER,position VARCHAR,lost VARCHAR,name VARCHAR)
SELECT MAX(played) FROM table_name_59 WHERE lost < 12 AND name = "ec amberg (n)" AND position < 4
What is the season # for the production code 3.89?
CREATE TABLE table_31120 ("Series #" real,"Season #" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text)
SELECT "Season #" FROM table_31120 WHERE "Production code" = '3.89'
All players are position mark polak.
CREATE TABLE table_1013129_10 (position VARCHAR,player VARCHAR)
SELECT position FROM table_1013129_10 WHERE player = "Mark Polak"
Which Interview subject has a Centerfold model of athena lundberg?
CREATE TABLE table_39931 ("Date" text,"Centerfold model" text,"Interview subject" text,"20 Questions" text,"Pictorials" text)
SELECT "Interview subject" FROM table_39931 WHERE "Centerfold model" = 'athena lundberg'
What date was the score 3 3, and away team was Barnet?
CREATE TABLE table_65345 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text)
SELECT "Date" FROM table_65345 WHERE "Score" = '3–3' AND "Away team" = 'barnet'
which song is the only one that is shorter than where the spirit is ?
CREATE TABLE table_204_932 (id number,"#" number,"title" text,"time" text,"lead vocals" text,"notes" text)
SELECT "title" FROM table_204_932 WHERE "time" < (SELECT "time" FROM table_204_932 WHERE "title" = 'where the spirit is')
Which Date has a Result of 3 4?
CREATE TABLE table_name_11 (date VARCHAR,result VARCHAR)
SELECT date FROM table_name_11 WHERE result = "3–4"
What was the score for Hawthorn when they were the away team?
CREATE TABLE table_54355 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Away team score" FROM table_54355 WHERE "Away team" = 'hawthorn'
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of first_name and employee_id .
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 departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varc...
SELECT FIRST_NAME, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
What stadium hosted the June 7 game and how many visitors were there?
CREATE TABLE table_72840 ("Game" real,"Date" text,"Opponent" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location/Attendance" text,"Record" text)
SELECT "Location/Attendance" FROM table_72840 WHERE "Date" = 'June 7'
When was Recurrent Neural Network proposed ?
CREATE TABLE paperdataset (paperid int,datasetid int)CREATE TABLE keyphrase (keyphraseid int,keyphrasename varchar)CREATE TABLE field (fieldid int)CREATE TABLE paper (paperid int,title varchar,venueid int,year int,numciting int,numcitedby int,journalid int)CREATE TABLE author (authorid int,authorname varchar)CREATE TAB...
SELECT DISTINCT paper.year FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'Recurrent Neural Network' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid GROUP BY paper.year ORDER BY paper.year
What was the decision from the Vancouver home game on April 21?
CREATE TABLE table_name_2 (decision VARCHAR,home VARCHAR,date VARCHAR)
SELECT decision FROM table_name_2 WHERE home = "vancouver" AND date = "april 21"
What is the mean number of events where the rank is 1 and there are more than 3 wins?
CREATE TABLE table_39082 ("Rank" real,"Player" text,"Country" text,"Earnings ($)" real,"Events" real,"Wins" real)
SELECT AVG("Events") FROM table_39082 WHERE "Rank" = '1' AND "Wins" > '3'
How many papers are published in total?
CREATE TABLE authors (authid number,lname text,fname text)CREATE TABLE inst (instid number,name text,country text)CREATE TABLE papers (paperid number,title text)CREATE TABLE authorship (authid number,instid number,paperid number,authorder number)
SELECT COUNT(*) FROM papers
renal failure ( creatinine > 2 mg / dl ) or hyperkalemia ( serum potassium > 5.5 mg / dl )
CREATE TABLE table_test_30 ("id" int,"ejection_fraction_ef" int,"multiple_long_bone_fractures" bool,"extracellular_volume_expansion" bool,"pregnancy_or_lactation" bool,"bleeding" int,"serum_potassium" float,"prosthetic_heart_valve" bool,"hbg" int,"anticoagulation" bool,"incomplete_spinal_cord_injury" bool,"complex_pelv...
SELECT * FROM table_test_30 WHERE renal_disease = 1 OR creatinine_clearance_cl > 2 OR hyperkalemia = 1 OR serum_potassium > 5.5
How many times was presidential majority 2000/2004 recorded when obamacare: fed/ state/ partnership was Utah shop?
CREATE TABLE table_19507 ("Rank" real,"State" text,"Revenue (millions)" text,"Population" real,"Revenue per capita" text,"Spending (millions)" text,"Spending per capita" text,"Net contribution per capita" text,"Presidential majority 2000/2004" text,"Presidential majority 2008" text,"Presidential majority 2012" text,"Ob...
SELECT COUNT("Presidential majority 2000/2004") FROM table_19507 WHERE "Obamacare: Fed/ State/ Partnership" = 'Utah shop'
cardiogenic shock or symptomatic hypotension or sitting sbp < 95 mmhg
CREATE TABLE table_test_24 ("id" int,"history_of_bleeding_diathesis" bool,"bleeding" int,"systolic_blood_pressure_sbp" int,"hemoglobin_a1c_hba1c" float,"blood_draw" bool,"renal_disease" bool,"allergy_to_aspirin" bool,"allergy_to_clopidogrel" bool,"cardiogenic_shock" bool,"allergy_to_prasugrel" bool,"platelet_count" flo...
SELECT * FROM table_test_24 WHERE cardiogenic_shock = 1 OR symptomatic_hypotension = 1 OR systolic_blood_pressure_sbp < 95
What record has points less than 16, and detroit as the home?
CREATE TABLE table_name_13 (record VARCHAR,points VARCHAR,home VARCHAR)
SELECT record FROM table_name_13 WHERE points < 16 AND home = "detroit"
Who were the governors of the parties associated with delegates from district 1?
CREATE TABLE party (party_id number,year number,party text,governor text,lieutenant_governor text,comptroller text,attorney_general text,us_senate text)CREATE TABLE county (county_id number,county_name text,population number,zip_code text)CREATE TABLE election (election_id number,counties_represented text,district numb...
SELECT T2.governor FROM election AS T1 JOIN party AS T2 ON T1.party = T2.party_id WHERE T1.district = 1
Name the total number for nfl team for ellis gardner
CREATE TABLE table_2508633_6 (nfl_team VARCHAR,player VARCHAR)
SELECT COUNT(nfl_team) FROM table_2508633_6 WHERE player = "Ellis Gardner"
City and Language - Brains.
CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score number,ApprovedByUserId number,ApprovalDate time)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE FlagTypes (Id number,Name...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", u.Id AS "user_link", u.Reputation, COUNT(p.Id) FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id INNER JOIN PostTags AS pt ON pt.PostId = p.Id INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE UPPER(u.Location) LIKE UPPER('%' + '##YourLocation:string##...
give me the number of patients whose admission year is less than 2139 and lab test name is urea nitrogen, urine?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2139" AND lab.label = "Urea Nitrogen, Urine"