instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Name the total number of episodes written by david cantor | CREATE TABLE table_17641206_6 (episode VARCHAR,written_by VARCHAR) | SELECT COUNT(episode) FROM table_17641206_6 WHERE written_by = "David Cantor" |
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, a bar chart shows the distribution of hire_date and the average of employee_id bin hire_date by time, and rank in descending by the y-axis. | 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),MANAGER_ID decimal(6,0),DEPARTMENT_ID decimal(4,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),S... | SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(EMPLOYEE_ID) DESC |
What is the country with a 68-73-69=210 score? | CREATE TABLE table_name_91 (country VARCHAR,score VARCHAR) | SELECT country FROM table_name_91 WHERE score = 68 - 73 - 69 = 210 |
What is the Place of the Player with a Score of 70-71=141? | CREATE TABLE table_name_61 (place VARCHAR,score VARCHAR) | SELECT place FROM table_name_61 WHERE score = 70 - 71 = 141 |
Name the Outcome which has a Score in the final of 4 6, 4 6 on october 21, 1990? | CREATE TABLE table_45729 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Partner" text,"Opponents in the final" text,"Score in the final" text) | SELECT "Outcome" FROM table_45729 WHERE "Score in the final" = '4–6, 4–6' AND "Date" = 'october 21, 1990' |
Who is the Constructor for driver Piercarlo Ghinzani and a Ford cosworth dfv 3.0 v8 engine? | CREATE TABLE table_name_42 (constructor VARCHAR,driver VARCHAR,engine VARCHAR) | SELECT constructor FROM table_name_42 WHERE driver = "piercarlo ghinzani" AND engine = "ford cosworth dfv 3.0 v8" |
What nationality is Diogo? | CREATE TABLE table_60812 ("Nat." text,"Name" text,"Moving from" text,"Type" text,"Transfer window" text,"Ends" real,"Transfer fee" text) | SELECT "Nat." FROM table_60812 WHERE "Name" = 'diogo' |
Who did they play at Atlanta-Fulton County Stadium? | CREATE TABLE table_60262 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Game site" text,"Record" text,"Attendance" real) | SELECT "Opponent" FROM table_60262 WHERE "Game site" = 'atlanta-fulton county stadium' |
Visualize a scatter chart about the correlation between School_ID and ACC_Percent , and group by attribute ACC_Home. | 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 School_ID, ACC_Percent FROM basketball_match GROUP BY ACC_Home |
Find the total number of instructors for each department with a bar chart, show by the total number in asc. | CREATE TABLE student (ID varchar(5),name varchar(20),dept_name varchar(20),tot_cred numeric(3,0))CREATE TABLE department (dept_name varchar(20),building varchar(15),budget numeric(12,2))CREATE TABLE classroom (building varchar(15),room_number varchar(7),capacity numeric(4,0))CREATE TABLE takes (ID varchar(5),course_id ... | SELECT T1.dept_name, COUNT(DISTINCT T3.ID) FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name ORDER BY COUNT(DISTINCT T3.ID) |
What was the latest week with a date of November 12, 1967 and less than 34,761 in attendance? | CREATE TABLE table_name_60 (week INTEGER,date VARCHAR,attendance VARCHAR) | SELECT MAX(week) FROM table_name_60 WHERE date = "november 12, 1967" AND attendance < 34 OFFSET 761 |
For the roll of 651, what was the lowest Decile? | CREATE TABLE table_name_79 (decile INTEGER,roll VARCHAR) | SELECT MIN(decile) FROM table_name_79 WHERE roll = 651 |
What is the Name of ng/na? | CREATE TABLE table_75565 ("Name" text,"Pada 1" text,"Pada 2" text,"Pada 3" text,"Pada 4" text) | SELECT "Name" FROM table_75565 WHERE "Pada 3" = 'ङ ng/na' |
Are 500 -level classes offered in Spring or Summer ? | CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE student (student_id int,lastname varchar,firstname varchar,program_id int,declare_major varchar,total_credit int,total_gpa float,entered_as varchar,admit_term int,predicted_graduation_semester int,degree... | SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'department0' AND course.number BETWEEN 500 AND 500 + 100 AND semester.semester IN ('SP', 'SU', 'SS') AND semester.semester_i... |
What was the score when Mark parterned with lorenzo manta? | CREATE TABLE table_name_19 (score VARCHAR,partner VARCHAR) | SELECT score FROM table_name_19 WHERE partner = "lorenzo manta" |
What is the position of the pittsburgh steelers? | CREATE TABLE table_name_29 (position VARCHAR,nfl_club VARCHAR) | SELECT position FROM table_name_29 WHERE nfl_club = "pittsburgh steelers" |
List of all question links. | CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TA... | SELECT 'http://chemistry.stackexchange.com/q/' + CAST(q.Id AS TEXT(10)) FROM Posts AS q WHERE q.PostTypeId = 1 ORDER BY q.Id |
What is Date, when Constellation is 'Delphinus'? | CREATE TABLE table_60681 ("HD designation" text,"Constellation" text,"Distance (ly)" real,"Spectral type" text,"Signal power (kW)" real,"Date sent" text,"Arrival date" text) | SELECT "Date sent" FROM table_60681 WHERE "Constellation" = 'delphinus' |
What is the average value for Gold, when the value for Silver is greater than 2, and when the Nation is West Germany? | CREATE TABLE table_70658 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT AVG("Gold") FROM table_70658 WHERE "Silver" > '2' AND "Nation" = 'west germany' |
What is the day 1 when day 5 is math? | CREATE TABLE table_77120 ("Day 1" text,"Day 2" text,"Day 3" text,"Day 4" text,"Day 5" text,"Wednesday" text) | SELECT "Day 1" FROM table_77120 WHERE "Day 5" = 'math' |
how many patients were born before the year 2071 with an item id 50953? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2071" AND lab.itemid = "50953" |
In what Location in the United States the Time 2:25.62? | CREATE TABLE table_67972 ("Event" text,"Time" text,"Nationality" text,"Date" text,"Meet" text,"Location" text) | SELECT "Location" FROM table_67972 WHERE "Nationality" = 'united states' AND "Time" = '2:25.62' |
Name the length for all class and date of march 18 | CREATE TABLE table_name_63 (length VARCHAR,class VARCHAR,date VARCHAR) | SELECT length FROM table_name_63 WHERE class = "all" AND date = "march 18" |
Which member of the National Party is from the Hinkler electorate? | CREATE TABLE table_name_6 (member VARCHAR,party VARCHAR,electorate VARCHAR) | SELECT member FROM table_name_6 WHERE party = "national" AND electorate = "hinkler" |
Which Date has a Home team of st kilda? | CREATE TABLE table_name_19 (date VARCHAR,home_team VARCHAR) | SELECT date FROM table_name_19 WHERE home_team = "st kilda" |
Which is the easiest class to be taken to fulfill the Other requirement ? | CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE course (course_id int,name varchar,department varchar,number varchar,credits varchar,advisory_requirement varchar,enforced_requirement varchar,description varchar,num_semesters int,num_enrolled int,has_d... | SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%Other%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_c... |
how many patients with morbid obesity/sda primary disease are dead? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid 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,ethni... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "1" AND demographic.diagnosis = "MORBID OBESITY/SDA" |
What is the score of game 33? | CREATE TABLE table_15780049_6 (score VARCHAR,game VARCHAR) | SELECT score FROM table_15780049_6 WHERE game = 33 |
Questions with bounties awarded in the past. | CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)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,LastEdito... | SELECT Posts.Id AS "post_link", Votes.BountyAmount AS "Bounty Amount", Votes.CreationDate AS "Bounty Creation Date" FROM Posts INNER JOIN Votes ON Votes.PostId = Posts.Id WHERE Votes.VoteTypeId = 8 ORDER BY Votes.BountyAmount DESC, Votes.CreationDate DESC |
What was the original air date of the episode that had 5.30 million U.S. viewers? | CREATE TABLE table_27767 ("Series #" real,"Season #" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real,"U.S. viewers (millions)" text) | SELECT "Original air date" FROM table_27767 WHERE "U.S. viewers (millions)" = '5.30' |
Ignore movies whose director is NULL For each director, what are the titles and the highest rating among all of their movies they reviewed? Draw the result by a bar chart, rank x-axis in asc order. | CREATE TABLE Reviewer (rID int,name text)CREATE TABLE Movie (mID int,title text,year int,director text)CREATE TABLE Rating (rID int,mID int,stars int,ratingDate date) | SELECT title, MAX(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE director <> "null" GROUP BY title ORDER BY title |
What is the smallest Draws with a Result of runner-up, and Losses larger than 1? | CREATE TABLE table_62036 ("Year" real,"Result" text,"Matches" real,"Wins" real,"Draws" real,"Losses" real) | SELECT MIN("Draws") FROM table_62036 WHERE "Result" = 'runner-up' AND "Losses" > '1' |
Which Away team score has a Home team of richmond? | CREATE TABLE table_name_58 (away_team VARCHAR,home_team VARCHAR) | SELECT away_team AS score FROM table_name_58 WHERE home_team = "richmond" |
what is the meet when the date is 3 august 2012? | CREATE TABLE table_8715 ("Event" text,"Record" text,"Nationality" text,"Date" text,"Meet" text,"Place" text) | SELECT "Meet" FROM table_8715 WHERE "Date" = '3 august 2012' |
What seasons had 288 games and more than 100 goals? | CREATE TABLE table_10518 ("Order" real,"Name" text,"Seasons" text,"Games" real,"Goals" real) | SELECT "Seasons" FROM table_10518 WHERE "Goals" > '100' AND "Games" = '288' |
count the number of patients whose diagnoses short title is other psoriasis 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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Other psoriasis" AND prescriptions.drug_type = "MAIN" |
List the research staff details, and order in ascending order, and count them by a bar chart | CREATE TABLE Tasks (task_id INTEGER,project_id INTEGER,task_details VARCHAR(255),"eg Agree Objectives" VARCHAR(1))CREATE TABLE Grants (grant_id INTEGER,organisation_id INTEGER,grant_amount DECIMAL(19,4),grant_start_date DATETIME,grant_end_date DATETIME,other_details VARCHAR(255))CREATE TABLE Organisation_Types (organis... | SELECT staff_details, COUNT(staff_details) FROM Research_Staff GROUP BY staff_details ORDER BY staff_details |
what is the number of patients who are in careunit csru until 2101? | CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE... | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT transfers.hadm_id FROM transfers WHERE transfers.careunit = 'csru' AND STRFTIME('%y', transfers.intime) <= '2101') |
Who is the player with an E to par and a 68-73-69=210? | CREATE TABLE table_name_49 (player VARCHAR,to_par VARCHAR,score VARCHAR) | SELECT player FROM table_name_49 WHERE to_par = "e" AND score = 68 - 73 - 69 = 210 |
What are the ids and names of the web accelerators that are compatible with two or more browsers. Visualize by bar chart. | CREATE TABLE Web_client_accelerator (id int,name text,Operating_system text,Client text,Connection text)CREATE TABLE browser (id int,name text,market_share real)CREATE TABLE accelerator_compatible_browser (accelerator_id int,browser_id int,compatible_since_year int) | SELECT name, id FROM Web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id |
provide the number of patients who were admitted before the year 2162 and their primary disease is coronary artery disease\coronary artery bypass graft; myomectomy/sda . | 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 lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT; MYOMECTOMY/SDA" AND demographic.admityear < "2162" |
Who is the artist that drew higher than 4? | CREATE TABLE table_64036 ("Draw" real,"Artist" text,"Song" text,"Percentage" text,"Place" real) | SELECT "Artist" FROM table_64036 WHERE "Draw" > '4' |
Show the booking status code and the corresponding number of bookings. Show bar chart. | CREATE TABLE Apartment_Facilities (apt_id INTEGER,facility_code CHAR(15))CREATE TABLE Apartment_Buildings (building_id INTEGER,building_short_name CHAR(15),building_full_name VARCHAR(80),building_description VARCHAR(255),building_address VARCHAR(255),building_manager VARCHAR(50),building_phone VARCHAR(80))CREATE TABLE ... | SELECT booking_status_code, COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code |
Deleted posts based on comments. Your comments with the most upvotes | CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)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... | SELECT p.Id AS "post_link", p.LastActivityDate FROM Posts AS p INNER JOIN Comments AS c ON c.PostId = p.Id INNER JOIN Users AS u ON p.OwnerUserId = u.Id INNER JOIN PostHistory AS h ON p.Id = h.PostId WHERE c.UserId = '##USERID##' AND h.PostHistoryTypeId = '12' ORDER BY p.LastActivityDate DESC |
For which song was the score 6.5 + 6.0 + 6.0 + 5.5 = 24.0? | CREATE TABLE table_name_25 (song VARCHAR,score VARCHAR) | SELECT song FROM table_name_25 WHERE score = 6.5 + 6.0 + 6.0 + 5.5 = 24.0 |
when did patient 013-29301 get prescription for zofran and protonix for the last time at the same time in 08/this year? | 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 t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'zofran' AND patient.uniquepid = '013-29301' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TI... |
what is the procedure they gave to patient 027-188709 two or more times in their current hospital encounter? | CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,observationtime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,... | SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, COUNT(treatment.treatmenttime) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid ... |
What classes am I eligible for after completing PAT 102 ? | CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE student_record (student_id int,course_id int,semester int,grade varchar,how varchar,transfer_source varchar,earn_cr... | SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0 INNER JOIN course_prerequisite ON COURSE_0.course_id = course_prerequisite.course_id INNER JOIN course AS COURSE_1 ON COURSE_1.course_id = course_prerequisite.pre_course_id WHERE COURSE_1.department = 'PAT' AND COURSE_1.number =... |
windows phone post count, view count, view/post ratio per day. | CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Tags text,Ans... | SELECT DATE(p.CreationDate) AS pdate, COUNT(*) AS nposts_per_day, SUM(p.ViewCount) AS nviews_per_day, SUM(p.ViewCount) / COUNT(*) AS view_post_ratio FROM Tags JOIN PostTags AS pt ON Tags.Id = pt.TagId JOIN Posts AS p ON pt.PostId = p.Id WHERE Tags.TagName = @TagName GROUP BY DATE(p.CreationDate) ORDER BY pdate DESC LIM... |
What is the played number with points 1 is 80, and goals for is more than 77? | CREATE TABLE table_name_57 (played VARCHAR,points_1 VARCHAR,goals_for VARCHAR) | SELECT COUNT(played) FROM table_name_57 WHERE points_1 = "80" AND goals_for > 77 |
For all employees who have the letters D or S in their first name, give me the comparison about the average of manager_id over the job_id , and group by attribute job_id by a bar chart, and sort from low to high by the y axis please. | CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))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 job_history (EMPLOYEE_ID decimal(6,... | SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(MANAGER_ID) |
which paralymics year had the largest number of medals overall ? | CREATE TABLE table_204_374 (id number,"event" text,"gold" number,"silver" number,"bronze" number,"total" number,"ranking" text) | SELECT "event" FROM table_204_374 ORDER BY "total" DESC LIMIT 1 |
renal function: serum creatinine > 2 mg / dl or creatinine clearance <= 50 ml / min | CREATE TABLE table_dev_57 ("id" int,"intra_aortic_balloon_pump_iabp" bool,"systolic_blood_pressure_sbp" int,"heart_disease" bool,"vasopressors" bool,"temperature" float,"creatinine_clearance_cl" float,"cardiogenic_shock" bool,"height" int,"serum_creatinine" float,"NOUSE" float) | SELECT * FROM table_dev_57 WHERE serum_creatinine > 2 OR creatinine_clearance_cl <= 50 |
For each product with some problems, list the count of problems and the product id. Show the correlation. | CREATE TABLE Problem_Status_Codes (problem_status_code VARCHAR(20),problem_status_description VARCHAR(80))CREATE TABLE Staff (staff_id INTEGER,staff_first_name VARCHAR(80),staff_last_name VARCHAR(80),other_staff_details VARCHAR(255))CREATE TABLE Problems (problem_id INTEGER,product_id INTEGER,closure_authorised_by_staf... | SELECT COUNT(*), T1.product_id FROM Problems AS T1 JOIN Product AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_id |
What is the driver for Grid 8? | CREATE TABLE table_58479 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT "Driver" FROM table_58479 WHERE "Grid" = '8' |
until 3 years ago how many patients were prescribed carvedilol 6.25 mg po tabs in the same hospital visit after the procedure of pulmonary/ccm consultation. | CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE lab (labid number,patientunitstayid nu... | 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 = 'pulmonary/ccm consultation' AND DATETIME(treatment.treatmenttime) <= DATE... |
Posts by score, from the bottom up. As requested in https://physics.meta.stackexchange.com/q/9813/.
Please don't use this query to go and downvote posts, which would make it self-reinforcing in a really ugly way. This information is relatively useful but please be mindful of how you use it.
Similarly, before you... | CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE PostT... | SELECT Posts.Id AS "post_link", Posts.OwnerUserId AS "user_link", Posts.Score, Posts.CreationDate, CASE WHEN Posts.PostTypeId = 2 THEN 'Answer' ELSE (CASE WHEN NOT Posts.ClosedDate IS NULL THEN 'Closed Question' ELSE 'Open Question' END) END AS "Post Type" FROM Posts JOIN PostTypes ON Posts.PostTypeId = PostTypes.Id OR... |
Give me the comparison about ACC_Percent over the All_Neutral , show in desc by the All_Neutral please. | 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 All_Neutral, ACC_Percent FROM basketball_match ORDER BY All_Neutral DESC |
What is the name of the player who begin playing for the LA Lakers in 1974? | CREATE TABLE table_32942 ("Player" text,"Nationality" text,"Position" text,"From" text,"School/Country" text) | SELECT "Player" FROM table_32942 WHERE "From" = '1974' |
For those employees who was hired before 2002-06-21, return a bar chart about the distribution of hire_date and the average of salary bin hire_date by weekday, and could you list y axis from high to low 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 regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE employees (EMPLO... | SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(SALARY) DESC |
What is the Rank of the Officer with Badge/Serial Number 11755 who died in Gunfire? | CREATE TABLE table_45355 ("Rank" text,"Badge/Serial Number" text,"Tenure" text,"Date of death" text,"Cause of death" text) | SELECT "Rank" FROM table_45355 WHERE "Cause of death" = 'gunfire' AND "Badge/Serial Number" = '11755' |
what is the diagnosis cost of poisoning-barbiturates? | CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)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 prescriptio... | SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'diagnoses_icd' AND cost.event_id IN (SELECT diagnoses_icd.row_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'poisoning-barbiturates')) |
Total of 3, and a Gold larger than 0, and a Nation of belarus, and a Silver larger than 2 has what sum of bronze? | CREATE TABLE table_35262 ("Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT SUM("Bronze") FROM table_35262 WHERE "Total" = '3' AND "Gold" > '0' AND "Nation" = 'belarus' AND "Silver" > '2' |
how many patients whose age is less than 48 and drug route is sl? | 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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "48" AND prescriptions.route = "SL" |
How much Overall has a Pick # of 26? | CREATE TABLE table_name_25 (overall INTEGER,pick__number VARCHAR) | SELECT SUM(overall) FROM table_name_25 WHERE pick__number = 26 |
What is the USN 2013 ranking with a BW 2013 ranking less than 1000, a Forbes 2011 ranking larger than 17, and a CNN 2011 ranking less than 13? | CREATE TABLE table_name_63 (usn_2013 INTEGER,cnn_2011 VARCHAR,bw_2013 VARCHAR,forbes_2011 VARCHAR) | SELECT SUM(usn_2013) FROM table_name_63 WHERE bw_2013 < 1000 AND forbes_2011 > 17 AND cnn_2011 < 13 |
How many episodes have the title 'a perfect crime'? | CREATE TABLE table_26479 ("Episode #" real,"Prod #" real,"Title" text,"Directed by" text,"Written by" text,"Originalairdate" text,"Filmed" text) | SELECT COUNT("Episode #") FROM table_26479 WHERE "Title" = 'A Perfect Crime' |
What is the Date of the match with Opponent in the final Kenneth Carlsen? | CREATE TABLE table_45476 ("Outcome" text,"Date" text,"Championship" text,"Surface" text,"Opponent in the final" text,"Score in the final" text) | SELECT "Date" FROM table_45476 WHERE "Opponent in the final" = 'kenneth carlsen' |
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of job_id and manager_id , and could you display by the bars in descending? | CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,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 departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decima... | SELECT JOB_ID, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY JOB_ID DESC |
What is the average Election, when % Of Nation Vote is 45.23%, and when # Of Prefectural Votes is less than 14,961,199? | CREATE TABLE table_48594 ("Election" real,"Leader" text,"# of seats won" real,"# of National votes" real,"% of National vote" text,"# of Prefectural votes" real,"% of Prefectural vote" text) | SELECT AVG("Election") FROM table_48594 WHERE "% of National vote" = '45.23%' AND "# of Prefectural votes" < '14,961,199' |
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of founder and the sum of code , and group by attribute founder, and I want to sort in desc by the bar. | 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.Founder, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Founder ORDER BY T2.Founder DESC |
WHAT IS THE 2011 PERFORMANCE AT THE MIAMI MASTERS? | CREATE TABLE table_name_74 (tournament VARCHAR) | SELECT 2011 FROM table_name_74 WHERE tournament = "miami masters" |
What is the Scoring rank when there are less than 21 events played with a rank of n/a in years less than 2011? | CREATE TABLE table_name_19 (scoring_rank VARCHAR,year VARCHAR,events_played VARCHAR,rank VARCHAR) | SELECT scoring_rank FROM table_name_19 WHERE events_played < 21 AND rank = "n/a" AND year < 2011 |
what is the five most commonly given procedure for patients of 30s in 2103? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,... | SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) AND STRFTIME('%y', treatment.treatmenttime) = '2103' GROUP BY treatment.t... |
Name the least attendance for 52-37 record | CREATE TABLE table_name_53 (attendance INTEGER,record VARCHAR) | SELECT MIN(attendance) FROM table_name_53 WHERE record = "52-37" |
Who was Class AAA during the same year that Class AAAAA was Brownsville Pace? | CREATE TABLE table_16094 ("School Year" text,"Class A" text,"Class AA" text,"Class AAA" text,"Class AAAA" text,"Class AAAAA" text) | SELECT "Class AAA" FROM table_16094 WHERE "Class AAAAA" = 'Brownsville Pace' |
count the number of patients whose days of hospital stay is greater than 17 and drug name is potassium phosphate? | 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 procedures (subject_id text,hadm_id text,icd9_code text,sho... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "17" AND prescriptions.drug = "Potassium Phosphate" |
Who were the winning riders of the championship in Euer Valley, CA and whose horse was Magic Sirocco? | CREATE TABLE table_27833186_1 (rider_names VARCHAR,location VARCHAR,horse_name VARCHAR) | SELECT rider_names FROM table_27833186_1 WHERE location = "Euer Valley, CA" AND horse_name = "Magic Sirocco" |
What was the attendance at the game played on December 10, 1972? | CREATE TABLE table_14959246_2 (attendance VARCHAR,date VARCHAR) | SELECT attendance FROM table_14959246_2 WHERE date = "December 10, 1972" |
What is the segment C of the episode where segment B is Film Digitization? | CREATE TABLE table_15187735_19 (segment_c VARCHAR,segment_b VARCHAR) | SELECT segment_c FROM table_15187735_19 WHERE segment_b = "Film Digitization" |
What is the result for the Green-Communist party when the Left Bloc has 3.6%? | CREATE TABLE table_66275 ("Date Released" text,"Polling institute" text,"Social Democratic" text,"Socialist" text,"Green-Communist" text,"People's Party" text,"Left Bloc" text,"Lead" text) | SELECT "Green-Communist" FROM table_66275 WHERE "Left Bloc" = '3.6%' |
Top reputation users with no answer score. | CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Posts (Id number,Po... | SELECT u.Id AS "user_link", u.Reputation AS Reputation FROM Posts AS p INNER JOIN Users AS u ON p.OwnerUserId = u.Id GROUP BY u.Id, u.Reputation HAVING SUM(p.Score * (1 - ABS(SIGN(p.PostTypeId - 2)))) < 100000 ORDER BY Reputation DESC LIMIT 100 |
Who had the highest rebounds in game 2? | CREATE TABLE table_23286112_12 (high_rebounds VARCHAR,game VARCHAR) | SELECT high_rebounds FROM table_23286112_12 WHERE game = 2 |
What is the average grid for the +2.2 secs time/retired? | CREATE TABLE table_name_44 (grid INTEGER,time_retired VARCHAR) | SELECT AVG(grid) FROM table_name_44 WHERE time_retired = "+2.2 secs" |
Name the 2011 with 2010 of 2r | CREATE TABLE table_70328 ("Tournament" text,"2008" text,"2010" text,"2011" text,"2012" text,"2013" text) | SELECT "2011" FROM table_70328 WHERE "2010" = '2r' |
when was the first time patient 86555 was prescribed medication via po route? | CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)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 numbe... | SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 86555) AND prescriptions.route = 'po' ORDER BY prescriptions.startdate LIMIT 1 |
tell me patient 017-20711's total chest tube output: mediastinal r anterior output on last month/16. | CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,observationtime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,orga... | SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-20711')) AND intakeoutput.celllabel = 'chest... |
Is the only person teaching Biochem Res-Med Stu Prof. Corrigan ? | 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 DISTINCT course.department, course.name, course.number, instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.name LIKE '%Biochem Res-Med Stu%' AND NOT instructor.name LIKE '%Corrigan%' AND offering_instructor.instructor_id = i... |
Name the total number of first elected for dranesville | CREATE TABLE table_71744 ("Position" text,"Name" text,"Party" text,"First elected" real,"District" text) | SELECT COUNT("First elected") FROM table_71744 WHERE "District" = 'dranesville' |
List posts of deleted user. | CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,Cr... | SELECT Id AS "post_link", OwnerDisplayName FROM Posts WHERE OwnerDisplayName = 'user121799' |
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and the average of code , and group by attribute name, and display from high to low by the y-axis please. | CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL) | SELECT T2.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T1.Code DESC |
When in the 1st league position, how many people watch as they faced West Ham United? | CREATE TABLE table_name_18 (attendance INTEGER,league_position VARCHAR,opponents VARCHAR) | SELECT MIN(attendance) FROM table_name_18 WHERE league_position = "1st" AND opponents = "west ham united" |
Sum - Number of Answer - Android. | CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwner... | SELECT COUNT(P.ViewCount) FROM Posts AS P WHERE NOT P.Tags LIKE '%android%' |
count the number of times that patient 26817 had had .45ns flush intake in 09/this year. | CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance text,language text,marital_status text,ethnicity text,age number)CREATE TABL... | SELECT COUNT(*) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26817)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = '.45ns flush'... |
when was the last time patient 74159 had surgery on the last hospital encounter? | CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE d_icd_diagnoses (row_id ... | SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 74159 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) ORDER BY procedures_icd.charttime DESC LIMIT 1 |
Draw a bar chart about the distribution of Sex and the average of Height , and group by attribute Sex, and display in ascending by the Y. | CREATE TABLE people (People_ID int,Sex text,Name text,Date_of_Birth text,Height real,Weight real)CREATE TABLE candidate (Candidate_ID int,People_ID int,Poll_Source text,Date text,Support_rate real,Consider_rate real,Oppose_rate real,Unsure_rate real) | SELECT Sex, AVG(Height) FROM people GROUP BY Sex ORDER BY AVG(Height) |
what is the date (from) where date (to) is 1919? | CREATE TABLE table_12562214_1 (date__from_ VARCHAR,date__to_ VARCHAR) | SELECT date__from_ FROM table_12562214_1 WHERE date__to_ = "1919" |
What is the green-communist with a 15.5% lead? | CREATE TABLE table_name_82 (green_communist VARCHAR,lead VARCHAR) | SELECT green_communist FROM table_name_82 WHERE lead = "15.5%" |
WHAT IS THE LEAGUE WITH A ROUND LARGER THAN 6? | CREATE TABLE table_name_82 (college_junior_club_team__league_ VARCHAR,round INTEGER) | SELECT college_junior_club_team__league_ FROM table_name_82 WHERE round > 6 |
What is the Rank of the Nation with more than 1 Gold and a more than 4 Total medals? | CREATE TABLE table_44690 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT SUM("Rank") FROM table_44690 WHERE "Gold" > '1' AND "Total" > '4' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.