table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE table_name_3 ( railway_number_s_ VARCHAR, class VARCHAR )
What is the railway number of the aw class?
SELECT railway_number_s_ FROM table_name_3 WHERE class = "aw"
CREATE TABLE table_name_38 ( births__000s_ INTEGER, deaths VARCHAR )
What is the average births that had a death rate of 0.4
SELECT AVG(births__000s_) FROM table_name_38 WHERE deaths = 0.4
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 ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE COURSE ( CRS_CODE...
how many students are in each department?, and display X from high to low order.
SELECT DEPT_CODE, COUNT(*) FROM STUDENT GROUP BY DEPT_CODE ORDER BY DEPT_CODE DESC
CREATE TABLE table_name_71 ( date_of_birth VARCHAR, player VARCHAR )
When was roshan mahanama born?
SELECT date_of_birth FROM table_name_71 WHERE player = "roshan mahanama"
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), ...
For those employees who was hired before 2002-06-21, draw a line chart about the change of commission_pct over hire_date , could you list by the X in descending?
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE DESC
CREATE TABLE table_41649 ( "Year" text, "Starts" real, "Cuts Made" real, "Wins" real, "Top 10" real, "Top 25" real, "Earnings (\u20ac)" real, "Money list rank" text )
What is the average number of starts when the money list rank is 108 and the rank in the top 25 is greater than 4?
SELECT AVG("Starts") FROM table_41649 WHERE "Money list rank" = '108' AND "Top 25" > '4'
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...
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, visualize a scatter chart about the correlation between employee_id and salary .
SELECT EMPLOYEE_ID, SALARY FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
CREATE TABLE table_7941 ( "Heat" real, "Lane" real, "Name" text, "Country" text, "Mark" text, "React" real )
What country does Glory Alozie play for?
SELECT "Country" FROM table_7941 WHERE "Name" = 'glory alozie'
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose...
what are the four most frequent procedures that followed in the same hospital visit for the patients who were diagnosed with mal neo bronch/lung nec in this year?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_i...
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 ) C...
give the maximum number of days of hospital stay for patients who had liver transplant.
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "LIVER TRANSPLANT"
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREA...
this year patient 027-82318 has been diagnosed with hiv positive - cd4 > 350?
SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-82318')) AND diagnosis.diagnosisname = 'hiv positive - cd4 > 350' AND DA...
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE cost ( row_id number, subject_id...
what was the top four of the most frequent procedures until 3 years ago?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY procedur...
CREATE TABLE table_44199 ( "NTSC M" text, "PAL B,G,H" text, "PAL I" text, "PAL N" text, "PAL M" text )
What is the NTSC M for Pal M 525/60?
SELECT "NTSC M" FROM table_44199 WHERE "PAL M" = '525/60'
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text,...
Closed posts by votes on answers. This is used to see how many closed questions have up, down and neutral voted answers. A single post can be in all three categories if there is an answer which is positive, negative and neutral.
WITH ClosedPostsVotes AS (SELECT p.Id AS "Post Link", SUM(CASE WHEN a.Score > 0 THEN 1 ELSE 0 END) AS Up, SUM(CASE WHEN a.Score < 0 THEN 1 ELSE 0 END) AS Down, SUM(CASE WHEN a.Score = 0 THEN 1 ELSE 0 END) AS Neutral FROM Posts AS p INNER JOIN Posts AS a ON a.ParentId = p.Id WHERE NOT p.ClosedDate IS NULL GROUP BY p.Id)...
CREATE TABLE table_name_21 ( opponent VARCHAR, game VARCHAR )
Who is the opponent in game 7?
SELECT opponent FROM table_name_21 WHERE game = 7
CREATE TABLE table_204_771 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
how many countries in this competition had more than two silver medals ?
SELECT COUNT("nation") FROM table_204_771 WHERE "silver" > 2
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 varchar, minor varchar, internship varch...
What has Dr. India Plough taught in the past ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course_offering.semester < (SELECT SEMESTERalias0.semester_id FROM semester AS SEMESTERalias0 WHERE SEMESTERalias0.semester = 'WN' AND SEMESTERalias0.year = 2016) AND course.course_id = cour...
CREATE TABLE table_19508 ( "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 majorit...
What was the spending per capita when the revenue per capita was $7,755?
SELECT "Spending per capita" FROM table_19508 WHERE "Revenue per capita" = '$7,755'
CREATE TABLE table_name_58 ( week INTEGER, result VARCHAR )
What was the last week when the team had a bye week?
SELECT MAX(week) FROM table_name_58 WHERE result = "bye"
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 d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABL...
what are the five most commonly prescribed medications for patients who were previously prescribed nystatin ointment within 2 months, a year before?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'nystatin ointment' AND DATETIME(prescriptions.startdate, 'start o...
CREATE TABLE table_7833 ( "Team" text, "Head Coach" text, "City" text, "Stadium" text, "Capacity" real )
What is the Capacity of the Rainer Kraft's Stadium?
SELECT AVG("Capacity") FROM table_7833 WHERE "Head Coach" = 'rainer kraft'
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 ) CRE...
Zero-answer zero-upvote unclosed questions with no recent updates since date.
SELECT p.Title, p.CreationDate, p.LastActivityDate, p.Tags, 'http://stackoverflow.com/questions/' + CAST(p.Id AS TEXT(50)) AS Link FROM Posts AS p LEFT JOIN PostLinks AS l ON l.PostId = p.Id LEFT JOIN Votes AS v ON p.Id = v.PostId WHERE p.PostTypeId = 1 AND p.AnswerCount = 0 AND p.Score <= 0 AND l.Id IS NULL AND v.Id I...
CREATE TABLE table_37964 ( "Callsign" text, "Area served" text, "Frequency" text, "Band" text, "On-air ID" text, "Purpose" text )
Name the frequency with on-air ID of 1way fm
SELECT "Frequency" FROM table_37964 WHERE "On-air ID" = '1way fm'
CREATE TABLE table_name_10 ( sodium VARCHAR, lithium VARCHAR, rubidium VARCHAR )
what is the properties of sodium when lithium is h a l o g e n s and rubidium is nacl (2.1)?
SELECT sodium FROM table_name_10 WHERE lithium = "h a l o g e n s" AND rubidium = "nacl (2.1)"
CREATE TABLE table_3295 ( "Season" real, "Series" text, "Team" text, "Races" real, "Wins" real, "Poles" real, "F/Laps" real, "Podiums" real, "Points" real, "Position" text )
What is the smallest number of races competed in with 11 podiums?
SELECT MIN("Races") FROM table_3295 WHERE "Podiums" = '11'
CREATE TABLE table_name_61 ( team_2 VARCHAR )
Name the 2nd leg for defence force
SELECT 2 AS nd_leg FROM table_name_61 WHERE team_2 = "defence force"
CREATE TABLE table_19829 ( "Locale" text, "Skip" text, "W" real, "L" real, "PF" real, "PA" real, "Ends Won" real, "Ends Lost" real, "Blank Ends" real, "Stolen Ends" real, "Shot Pct." text )
What is the total of all Shot PCT occurrences when the value of Blank Ends is 8?
SELECT COUNT("Shot Pct.") FROM table_19829 WHERE "Blank Ends" = '8'
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...
what is subject name of subject id 3343?
SELECT demographic.name FROM demographic WHERE demographic.subject_id = "3343"
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, ...
what is the number of patients who have drug code vori200?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "VORI200"
CREATE TABLE table_14980 ( "Stage" text, "Time" text, "Name" text, "Length" text, "Winner" text, "Rally leader" text )
What was the Winner of the SS5 Stage?
SELECT "Winner" FROM table_14980 WHERE "Stage" = 'ss5'
CREATE TABLE table_73521 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What location attendance has russell westbrook (5) as high assists and nenad krstic (8) as high rebounds?
SELECT "Location Attendance" FROM table_73521 WHERE "High assists" = 'Russell Westbrook (5)' AND "High rebounds" = 'Nenad Krstic (8)'
CREATE TABLE table_204_662 ( id number, "week" number, "date" text, "opponent" text, "result" text, "attendance" number, "bye" text )
what was the number of points scored in week 3 ?
SELECT "result" + "result" FROM table_204_662 WHERE "week" = 3
CREATE TABLE table_name_95 ( year INTEGER, location VARCHAR )
What was the earliest year a game was played in Athens?
SELECT MIN(year) FROM table_name_95 WHERE location = "athens"
CREATE TABLE table_17651 ( "#" real, "Athlete (NOC)" text, "Shooting" text, "Fencing" text, "Swimming" text, "Riding" text, "Running" text, "Total" real )
What's the number of the player with 68.46 (1144 pts) in riding?
SELECT MAX("#") FROM table_17651 WHERE "Riding" = '68.46 (1144 pts)'
CREATE TABLE performance ( Performance_ID real, Date text, Host text, Location text, Attendance int ) CREATE TABLE member_attendance ( Member_ID int, Performance_ID int, Num_of_Pieces int ) CREATE TABLE member ( Member_ID text, Name text, Nationality text, Role text )
Show different locations and the number of performances at each location Visualize by bar chart, and display by the Y-axis in descending.
SELECT Location, COUNT(*) FROM performance GROUP BY Location ORDER BY COUNT(*) DESC
CREATE TABLE table_name_92 ( venue VARCHAR, home_team VARCHAR )
In what venue is Essendon the home team?
SELECT venue FROM table_name_92 WHERE home_team = "essendon"
CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, ...
Next Winter , what are the special topics classes ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE (course.number = 398 OR course.number = 498 OR course.number = 598) AND course.department = 'E...
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 ( microl...
when was patient 006-195316 prescribed for a medication for the last time on this hospital visit?
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-195316' AND patient.hospitaldischargetime IS NULL)) ORDER ...
CREATE TABLE table_204_994 ( id number, "date" text, "time" text, "opponent#" text, "rank#" text, "site" text, "tv" text, "result" text, "attendance" number )
what is the largest attendance on the chart
SELECT MAX("attendance") FROM table_204_994
CREATE TABLE dorm_amenity ( amenid number, amenity_name text ) CREATE TABLE lives_in ( stuid number, dormid number, room_number number ) CREATE TABLE dorm ( dormid number, dorm_name text, student_capacity number, gender text ) CREATE TABLE has_amenity ( dormid number, amen...
Find the name of amenity that is most common in all dorms.
SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T1.amenid = T2.amenid GROUP BY T2.amenid ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE table_59497 ( "Opposing Teams" text, "Against" real, "Date" text, "Venue" text, "Status" text )
Which Opposing Teams is on 06/02/1988?
SELECT "Opposing Teams" FROM table_59497 WHERE "Date" = '06/02/1988'
CREATE TABLE table_1949994_7 ( format VARCHAR, end_date VARCHAR )
What's the format of the season that ended on June 25?
SELECT format FROM table_1949994_7 WHERE end_date = "June 25"
CREATE TABLE table_47314 ( "Year" text, "Indians admitted" real, "Pakistanis admitted" real, "Sri Lankans admitted" real, "Bangladeshis admitted" real, "Nepalis admitted" real )
What was the most Nepalis admitted when fewer than 1,896 Bangladeshis were admitted?
SELECT MAX("Nepalis admitted") FROM table_47314 WHERE "Bangladeshis admitted" < '1,896'
CREATE TABLE table_name_42 ( label VARCHAR, region VARCHAR, format VARCHAR )
What label is in download format in the United States?
SELECT label FROM table_name_42 WHERE region = "united states" AND format = "download"
CREATE TABLE table_name_12 ( share VARCHAR, audience VARCHAR )
Which share had an audience of 4.693.000?
SELECT share FROM table_name_12 WHERE audience = "4.693.000"
CREATE TABLE table_14630796_1 ( class_aAA VARCHAR, school_year VARCHAR )
Name the total number of class aaa for 2006-07
SELECT COUNT(class_aAA) FROM table_14630796_1 WHERE school_year = "2006-07"
CREATE TABLE inventory ( inventory_id number, film_id number, store_id number, last_update time ) CREATE TABLE actor ( actor_id number, first_name text, last_name text, last_update time ) CREATE TABLE rental ( rental_id number, rental_date time, inventory_id number, cus...
What is the genre name of the film HUNGER ROOF?
SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id = T2.category_id JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'HUNGER ROOF'
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellv...
what is patient 007-15837's bedside glucose difference from the last value measured on the current hospital visit compared to the second to last value measured on the current hospital visit?
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 = '007-15837' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'bedsi...
CREATE TABLE department ( dept_code text, dept_name text, school_code text, emp_num number, dept_address text, dept_extension text ) CREATE TABLE student ( stu_num number, stu_lname text, stu_fname text, stu_init text, stu_dob time, stu_hrs number, stu_class text, ...
What is the name and the average gpa of department whose students have the highest average gpa?
SELECT T2.dept_name, AVG(T1.stu_gpa) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY AVG(T1.stu_gpa) DESC LIMIT 1
CREATE TABLE table_name_11 ( team VARCHAR, runner_up VARCHAR )
What team defeated the Capital City Giants?
SELECT team FROM table_name_11 WHERE runner_up = "capital city giants"
CREATE TABLE table_55038 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
When the Venue was mcg what was the sum of all Crowds for that venue?
SELECT SUM("Crowd") FROM table_55038 WHERE "Venue" = 'mcg'
CREATE TABLE table_1341640_26 ( incumbent VARCHAR, district VARCHAR )
What was the incumbent for missouri 1?
SELECT incumbent FROM table_1341640_26 WHERE district = "Missouri 1"
CREATE TABLE table_48083 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
Which Opponent has a Round smaller than 3, and a Time of 1:09?
SELECT "Opponent" FROM table_48083 WHERE "Round" < '3' AND "Time" = '1:09'
CREATE TABLE team_franchise ( franchise_id text, franchise_name text, active text, na_assoc text ) CREATE TABLE manager_half ( player_id text, year number, team_id text, league_id text, inseason number, half number, g number, w number, l number, rank number ) CR...
Count the number of games taken place in park 'Columbia Park' in 1907.
SELECT COUNT(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 1907 AND T2.park_name = 'Columbia Park'
CREATE TABLE genres ( name VARCHAR, id VARCHAR ) CREATE TABLE tracks ( genre_id VARCHAR )
List the top 5 genres by number of tracks. List genres name and total tracks.
SELECT T1.name, COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 5
CREATE TABLE table_203_818 ( id number, "kategori" text, "1995" text, "2004" text, "2005" text, "2006" text, "2007" text )
how many categories are listed on this chart ?
SELECT COUNT("kategori") FROM table_203_818
CREATE TABLE table_name_80 ( wins INTEGER, against INTEGER )
What is the sum of wins against the smaller score 1148?
SELECT SUM(wins) FROM table_name_80 WHERE against < 1148
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABL...
In the Fall which upper level SW classes will there be ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.department = 'SW' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Fall' AN...
CREATE TABLE table_47431 ( "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
What was the Opponent in the Tarragona Tournament?
SELECT "Opponent" FROM table_47431 WHERE "Tournament" = 'tarragona'
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABL...
What questions have the highest ratio of votes to views?. Returns the top 50 questions, ordered by their score divided by the number of views they've received.
SELECT UpVotes, Views FROM Users WHERE AccountId = 9464
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, Di...
Votes distribution of regular users who have cast votes.
SELECT VotesFloor, COUNT(*) AS UserCount FROM (SELECT FLOOR((UpVotes + DownVotes) / @Interval) * @Interval AS VotesFloor FROM Users WHERE UpVotes + DownVotes > 0 AND Id > 0) AS Hist WHERE @IsRemoveLeast != 1 OR (VotesFloor != 0) GROUP BY VotesFloor ORDER BY VotesFloor DESC
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE cost ( row_i...
the arterial bp [systolic] of patient 8569 measured at 2105-07-31 21:30:00 was less than the value measured at 2105-07-31 19:00:00?
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8569)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'ar...
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 )
Count the names of all the products in the store and return me a bar chart.
SELECT Name, COUNT(Name) FROM Products GROUP BY Name
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_discussion varchar, has_lab varchar, has_p...
Does anyone other than Prof. Heather Thompson teach 475 ?
SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 475 AND NOT instructor.name LIKE '%Heather Thompson%' AND offering_instructor.instructor_id = instructor.instructor_id AND o...
CREATE TABLE table_1341453_11 ( results VARCHAR, incumbent VARCHAR )
How did the election end for Robert Wexler?
SELECT results FROM table_1341453_11 WHERE incumbent = "Robert Wexler"
CREATE TABLE table_32132 ( "Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Winning constructor" text, "Report" text )
Which Circuit did Johnny Wakefield win?
SELECT "Circuit" FROM table_32132 WHERE "Winning driver" = 'johnny wakefield'
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, v...
what is the first id of the care unit of patient 47295 in 2100?
SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 47295) AND NOT transfers.careunit IS NULL AND STRFTIME('%y', transfers.intime) = '2100' ORDER BY transfers.intime LIMIT 1
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABL...
Closed questions that have answers for year 2020.
SELECT AnswerCount, COUNT(1) FROM (SELECT PostId FROM PostHistory WHERE PostHistoryTypeId = 10) AS Hist INNER JOIN (SELECT Id, AnswerCount FROM Posts WHERE PostTypeId = 1 AND YEAR(CreationDate) = 2020) AS Post ON Hist.PostId = Post.Id GROUP BY AnswerCount ORDER BY AnswerCount
CREATE TABLE table_53973 ( "Peak" text, "metres" real, "feet" real, "Latitude (N)" text, "Longitude (E)" text, "Prominence (m)" real )
What is the lowest feet total with a Longitude (E) of 76 34 06 , and a Prominence (m) under 1,701?
SELECT MIN("feet") FROM table_53973 WHERE "Longitude (E)" = '76°34′06″' AND "Prominence (m)" < '1,701'
CREATE TABLE table_65293 ( "Rank" real, "Athlete" text, "Country" text, "Time" text, "Notes" text )
What is the rank of the athletes that have Notes of fb, and a Time of 6:47.30?
SELECT SUM("Rank") FROM table_65293 WHERE "Notes" = 'fb' AND "Time" = '6:47.30'
CREATE TABLE table_78338 ( "Candidate" text, "Money Raised, 2Q" text, "Loans Received, 2Q" text, "Money Spent, 2Q" text, "Total Receipts" text, "Cash On Hand" text )
Tell me the money raised when 2Q has total receipts of $890,398
SELECT "Money Raised, 2Q" FROM table_78338 WHERE "Total Receipts" = '$890,398'
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 ) ...
among patients treated with main drug, how many of them had wheelchair dependence?
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 = "Wheelchair dependence" AND prescriptions.drug_type = "MAIN"
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number,...
what were the medications patient 022-199074 was allergic to since 108 months ago?
SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-199074')) AND DATETIME(allergy.allergytime) >= DATETIME(CURRENT_TIME(), ...
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, ...
what is the name of the insurance of patient 3929 during their current hospital encounter?
SELECT admissions.insurance FROM admissions WHERE admissions.subject_id = 3929 AND admissions.dischtime IS NULL
CREATE TABLE table_name_40 ( season VARCHAR, pos VARCHAR, pts VARCHAR )
What season had 6th position and 36 points?
SELECT season FROM table_name_40 WHERE pos = "6th" AND pts = "36"
CREATE TABLE table_58993 ( "Driver" text, "Race 1" real, "Race 2" text, "Race 3" text, "Points" real )
How many race 1's have 5 as the race 3, with points less than 59?
SELECT SUM("Race 1") FROM table_58993 WHERE "Race 3" = '5' AND "Points" < '59'
CREATE TABLE table_name_18 ( name VARCHAR, replacement VARCHAR )
Who was replaced by Lieve Wierinck?
SELECT name FROM table_name_18 WHERE replacement = "lieve wierinck"
CREATE TABLE table_name_9 ( total_passengers INTEGER, annual_change VARCHAR, rank VARCHAR )
What is the sum of Total Passengers when the annual change is 9.7% and the rank is less than 6?
SELECT SUM(total_passengers) FROM table_name_9 WHERE annual_change = "9.7%" AND rank < 6
CREATE TABLE table_name_62 ( home_port VARCHAR, pennant VARCHAR )
What is the home port of m40?
SELECT home_port FROM table_name_62 WHERE pennant = "m40"
CREATE TABLE table_name_65 ( round INTEGER, player VARCHAR, pick VARCHAR )
Which Round has a Player of dan chicoine, and a Pick larger than 23?
SELECT AVG(round) FROM table_name_65 WHERE player = "dan chicoine" AND pick > 23
CREATE TABLE products ( code number, name text, price number, manufacturer number ) CREATE TABLE manufacturers ( code number, name text, headquarter text, founder text, revenue number )
What are the average prices of products, grouped by manufacturer name?
SELECT AVG(T1.price), T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name
CREATE TABLE table_name_7 ( artist VARCHAR, draw VARCHAR, points VARCHAR )
Which artist has a draw higher than 4 and fewer than 5 points?
SELECT artist FROM table_name_7 WHERE draw > 4 AND points < 5
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_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE admis...
what is the name of the drug prescribed to patient 99647 in the same hospital encounter, after receiving a fiber-optic bronchoscopy procedure in 12/this year?
SELECT t2.drug FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 99647 AND procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_proce...
CREATE TABLE table_25445 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text )
How many opponents have wimbledon (2) as the championship?
SELECT COUNT("Opponents") FROM table_25445 WHERE "Championship" = 'Wimbledon (2)'
CREATE TABLE table_name_30 ( name VARCHAR, themed_area VARCHAR, manufacturer VARCHAR )
What is the name of the dreamworks experience from Ferrari?
SELECT name FROM table_name_30 WHERE themed_area = "dreamworks experience" AND manufacturer = "ferrari"
CREATE TABLE table_name_34 ( peak VARCHAR, hk_viewers VARCHAR, rank VARCHAR )
How many entries have a HK viewers of 2.23 million, and a Rank below 2?
SELECT COUNT(peak) FROM table_name_34 WHERE hk_viewers = "2.23 million" AND rank > 2
CREATE TABLE table_75562 ( "Name" text, "Pada 1" text, "Pada 2" text, "Pada 3" text, "Pada 4" text )
Which Pada 3 has a Pada 1 of te?
SELECT "Pada 3" FROM table_75562 WHERE "Pada 1" = 'टे te'
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 prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time...
what was the last height of patient 19412 on their current hospital visit.
SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19412 AND admissions.dischtime IS NULL)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items...
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDat...
Character Max Length Limits across the Site.
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE CHARACTER_MAXIMUM_LENGTH > 0
CREATE TABLE table_18025024_7 ( ncaat_record VARCHAR, date VARCHAR )
What is the June 21 ncaat baseball record for Fresno State Bulldogs?
SELECT ncaat_record FROM table_18025024_7 WHERE date = "June 21"
CREATE TABLE table_9568 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Location" text )
How many rounds was the fight at UFC 34?
SELECT SUM("Round") FROM table_9568 WHERE "Event" = 'ufc 34'
CREATE TABLE table_name_6 ( nvr_page VARCHAR, home_port VARCHAR )
What is the NVR Page of the ship with a Home Port of Sasebo, Japan?
SELECT nvr_page FROM table_name_6 WHERE home_port = "sasebo, japan"
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugst...
compute the number of times patient 006-47961 has been prescribed glucagon 1 mg (1 unit) inj in 10/2104.
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 = '006-47961')) AND medication.drugname = 'glucagon 1 mg (1 unit) inj' AND STRFTI...
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction 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...
How many of next semester 's classes will be HMP ?
SELECT COUNT(DISTINCT course_offering.course_id) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'HMP' AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016
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...
Users with ongoing temporal suspension.
SELECT Id AS "user_link", * FROM Users WHERE Users.Reputation = 1 AND Users.Id > 1 AND (DownVotes > 0 OR Id IN (SELECT UserId FROM Badges WHERE Name = 'Explainer')) ORDER BY Users.DisplayName
CREATE TABLE table_43547 ( "Game" real, "December" real, "Opponent" text, "Score" text, "Decision" text, "Record" text )
What game has valiquette as the decision, with @ los angeles kings as the opponent?
SELECT "Game" FROM table_43547 WHERE "Decision" = 'valiquette' AND "Opponent" = '@ los angeles kings'
CREATE TABLE table_name_27 ( played INTEGER, drawn VARCHAR, first_game VARCHAR, lost VARCHAR )
What is the sum of matches played that has a year of first match before 2000, fewer than 21 lost, and 0 drawn?
SELECT SUM(played) FROM table_name_27 WHERE first_game < 2000 AND lost < 21 AND drawn < 0
CREATE TABLE table_54675 ( "Year" real, "Pick" text, "Player name" text, "Position" text, "College" text )
Tell me the year for defensive tackle and college of lsu
SELECT "Year" FROM table_54675 WHERE "Position" = 'defensive tackle' AND "College" = 'lsu'
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 )
For those records from the products and each product's manufacturer, show me about the distribution of founder and the average of price , and group by attribute founder in a bar chart, list y-axis in asc order.
SELECT Founder, AVG(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY AVG(Price)
CREATE TABLE table_13128 ( "Position" real, "Team" text, "Played" real, "Drawn" real, "Lost" real, "Goals For" real, "Goals Against" real, "Goal Difference" text, "Points 1" text )
Which Goals For has a Team of congleton town, and a Lost larger than 11?
SELECT MAX("Goals For") FROM table_13128 WHERE "Team" = 'congleton town' AND "Lost" > '11'