table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugsto...
what were the three most commonly given procedures for patients who had previously received a oxygen therapy (> 60%) - face mask within the same month, since 6 years ago?
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'oxygen therapy (> 60%) - face mask' AND ...
CREATE TABLE table_12338595_1 ( swimsuit VARCHAR, state VARCHAR )
What swimsuit score did the state of Virginia contestant achieve?
SELECT COUNT(swimsuit) FROM table_12338595_1 WHERE state = "Virginia"
CREATE TABLE table_23802 ( "Pick #" real, "CFL Team" text, "Player" text, "Position" text, "College" text )
Name the number for dl
SELECT "Pick #" FROM table_23802 WHERE "Position" = 'DL'
CREATE TABLE table_17086 ( "Player" text, "Position" text, "School" text, "Hometown" text, "College" text )
What position is Charone Peake?
SELECT "Position" FROM table_17086 WHERE "Player" = 'Charone Peake'
CREATE TABLE table_10190 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
If the away teams score was 15.6 (96), what venue did they play at?
SELECT "Venue" FROM table_10190 WHERE "Away team score" = '15.6 (96)'
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE intakeoutput ( i...
in 06/last year, how much did patient 006-50368 weigh for the last time?
SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-50368') AND NOT patient.admissionweight IS NULL AND DATETIME(patient.unitadmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-...
CREATE TABLE table_44049 ( "Class" text, "Wheel arrangement" text, "Manufacturer" text, "Year made" text, "Quantity made" text, "Quantity preserved" text )
What is Wheel Arrangement, when Manufacturer is 'Baldwin', and when Quantity Made is 12?
SELECT "Wheel arrangement" FROM table_44049 WHERE "Manufacturer" = 'baldwin' AND "Quantity made" = '12'
CREATE TABLE table_name_5 ( meet VARCHAR, time VARCHAR )
What Meet has a Time of 1:04.84?
SELECT meet FROM table_name_5 WHERE time = "1:04.84"
CREATE TABLE table_21321804_1 ( pick__number INTEGER, player VARCHAR )
What is the pick # for player wes lysack?
SELECT MAX(pick__number) FROM table_21321804_1 WHERE player = "Wes Lysack"
CREATE TABLE table_44149 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "Record" text, "Attendance" real )
What was the record on the date of november 10, 1968?
SELECT "Record" FROM table_44149 WHERE "Date" = 'november 10, 1968'
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...
How many patients stayed in hospital for more than 27 days and got diagnosed for intermed coronary synd?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "27" AND diagnoses.short_title = "Intermed coronary synd"
CREATE TABLE table_name_35 ( principal_victims VARCHAR, nat VARCHAR, where_sunk VARCHAR )
Who were the victims of the US ship that sank in the Mississippi River near Memphis?
SELECT principal_victims FROM table_name_35 WHERE nat = "us" AND where_sunk = "mississippi river near memphis"
CREATE TABLE table_2953 ( "Competition" text, "Final position" text, "First match" text, "Last match" text, "Final Place" text )
Name the final position for copa libertadores
SELECT "Final position" FROM table_2953 WHERE "Competition" = 'Copa Libertadores'
CREATE TABLE table_name_41 ( points INTEGER, chassis VARCHAR, year VARCHAR )
What are the highest points with a Chassis of gordini t16, and a Year smaller than 1954?
SELECT MAX(points) FROM table_name_41 WHERE chassis = "gordini t16" AND year < 1954
CREATE TABLE enrolled_in ( stuid number, cid text, grade text ) CREATE TABLE faculty ( facid number, lname text, fname text, rank text, sex text, phone number, room text, building text ) CREATE TABLE member_of ( facid number, dno number, appt_type text ) CREATE...
What is the maximum and minimum grade point of students who live in NYC?
SELECT MAX(T2.gradepoint), MIN(T2.gradepoint) FROM enrolled_in AS T1 JOIN gradeconversion AS T2 JOIN student AS T3 ON T1.grade = T2.lettergrade AND T1.stuid = T3.stuid WHERE T3.city_code = "NYC"
CREATE TABLE table_name_4 ( away_team VARCHAR, score VARCHAR )
Which Away team has a Score of 0 3?
SELECT away_team FROM table_name_4 WHERE score = "0–3"
CREATE TABLE table_13841 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Notes" text )
Which Notes have a Year of 2002?
SELECT "Notes" FROM table_13841 WHERE "Year" = '2002'
CREATE TABLE table_4918 ( "Lane" real, "Name" text, "Nationality" text, "50m Split" real, "Time" text )
What was Arkady Vyatchanin's time?
SELECT "Time" FROM table_4918 WHERE "Name" = 'arkady vyatchanin'
CREATE TABLE table_44939 ( "Date" text, "Rank" real, "Weekend Gross" text, "Theaters" real, "Gross-to-date" text )
Name the Gross-to-date which has a Date of august 23 25?
SELECT "Gross-to-date" FROM table_44939 WHERE "Date" = 'august 23–25'
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...
Next semester , who is going to teach ANTHRBIO 475 ?
SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN course_offering ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN course ON course.course_id = course_offering.course_id INNER JOIN semester...
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number...
Top users in a tag by score and answer count.
SELECT TagUsers.UserLink AS "user_link", TagUsers.Score AS Score, TagUsers.Count AS "count", (TagUsers.Score + TagUsers.Count) / 2.0 AS Total FROM (SELECT a.OwnerUserId AS UserLink, SUM(a.Score) / 10.0 AS Score, COUNT(a.Score) AS "count" FROM Posts AS a, Posts AS q INNER JOIN PostTags AS pt ON q.Id = pt.PostId INNER JO...
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) C...
information on AA flight from WASHINGTON to PHILADELPHIA
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 = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = '...
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, LastEditorDispl...
SWL questions with low scoring answers and no accepted answer.
SELECT q.Id AS "post_link", q.CreationDate, COUNT(a.Id) AS answers, MAX(a.Score) AS max_score FROM Posts AS q LEFT JOIN Posts AS a ON a.ParentId = q.Id WHERE q.PostTypeId = 1 AND q.AcceptedAnswerId IS NULL AND q.Tags LIKE '%star-trek%' AND q.DeletionDate IS NULL AND q.ClosedDate IS NULL GROUP BY q.Id, q.CreationDate HA...
CREATE TABLE table_25818630_2 ( candidate VARCHAR, result____percentage VARCHAR )
Who as the candidate when the result - % was 2.9%?
SELECT candidate FROM table_25818630_2 WHERE result____percentage = "2.9%"
CREATE TABLE table_51555 ( "Race" text, "Candidate" text, "Party" text, "Notes" text, "Votes" real )
Who is the candidate in Race for State representative, hd18?
SELECT "Candidate" FROM table_51555 WHERE "Race" = 'state representative, hd18'
CREATE TABLE table_19167 ( "State" text, "Highest point" text, "Highest elevation" text, "Lowest point" text, "Lowest elevation" text, "Mean elevation" text )
what's the lowest elevation with highest point being charles mound
SELECT "Lowest elevation" FROM table_19167 WHERE "Highest point" = 'Charles Mound'
CREATE TABLE table_1964010_2 ( opponents VARCHAR, score VARCHAR )
Who are the opponents of Mike Byron and partner in matches where the score was 6 4, 4 6, 7 6 (7 4)?
SELECT opponents FROM table_1964010_2 WHERE score = "6–4, 4–6, 7–6 (7–4)"
CREATE TABLE table_43145 ( "Year" real, "Men's singles" text, "Women's singles" text, "Men's doubles" text, "Women's doubles" text, "Mixed doubles" text )
Which men's singles had a women's doubles team of irena ferencov / yweta trminkov ?
SELECT "Men's singles" FROM table_43145 WHERE "Women's doubles" = 'irena ferencová / yweta trminková'
CREATE TABLE table_15013825_8 ( team VARCHAR, copa_conmebol_1992 VARCHAR )
Name the team for copa conmebol 1992 is round of 16
SELECT team FROM table_15013825_8 WHERE copa_conmebol_1992 = "Round of 16"
CREATE TABLE table_77989 ( "Date" text, "Ship" text, "Type" text, "Nationality" text, "Tonnage GRT" real )
what is the most tonnage grt of any ship sunk or captured on 16 jan 16?
SELECT MAX("Tonnage GRT") FROM table_77989 WHERE "Date" = '16 jan 16'
CREATE TABLE table_name_2 ( height VARCHAR, date_of_birth VARCHAR )
How tall is the person born on 1976-12-27?
SELECT height FROM table_name_2 WHERE date_of_birth = "1976-12-27"
CREATE TABLE Ref_Locations ( Location_Code CHAR(15), Location_Name VARCHAR(255), Location_Description VARCHAR(255) ) CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME, Day_Number INTEGER ) CREATE TABLE Roles ( Role_Code CHAR(15), Role_Name VARCHAR(255), Role_Description VARCHAR(255) )...
Display a bar chart for what is the code of each location and the number of documents in that location?
SELECT Location_Code, COUNT(*) FROM Document_Locations GROUP BY Location_Code
CREATE TABLE table_name_22 ( round INTEGER, player VARCHAR, overall VARCHAR )
In which round did Paul McDonald have an overall greater than 109?
SELECT MAX(round) FROM table_name_22 WHERE player = "paul mcdonald" AND overall > 109
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 locations ( LOCATION_ID decimal(4,0...
For all employees who have the letters D or S in their first name, draw a bar chart about the distribution of hire_date and the average of salary bin hire_date by time, I want to sort in asc by the Y-axis.
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(SALARY)
CREATE TABLE table_216776_2 ( municipality VARCHAR, population__2010_ VARCHAR )
What municipality had 26839 people living in it in 2010?
SELECT municipality FROM table_216776_2 WHERE population__2010_ = 26839
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,0), START_DATE date...
For those employees who was hired before 2002-06-21, give me the comparison about the average of manager_id over the job_id , and group by attribute job_id by a bar chart.
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID
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, heavy_papers int, cares_for_students int, heavy_assignments ...
For the Spring or Summer term , are there any 500 -level classes ?
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 = 'EECS' AND course.number BETWEEN 500 AND 500 + 100 AND semester.semester IN ('SP', 'SS', 'SU') AND semester.semester_id = cou...
CREATE TABLE table_204_801 ( id number, "year" number, "derby\nwinner" text, "galaxy" number, "draw" number, "chivas" number )
how many times has galaxy won the derby ?
SELECT COUNT(*) FROM table_204_801 WHERE "derby\nwinner" = 'galaxy'
CREATE TABLE table_name_8 ( tournament VARCHAR, date VARCHAR )
What tournament was played on May 29, 2010?
SELECT tournament FROM table_name_8 WHERE date = "may 29, 2010"
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, ...
how many patients are diagnosed for atherosclerosis of native arteries of the extremities with intermittent claudication and had lab test abnormal status as abnormal?
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 = "Atherosclerosis of native arteries of the extremities with intermittent claudication" AND lab.flag = "abnormal"
CREATE TABLE table_49275 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text, "Points" real )
Which visitor lives in Minnesota?
SELECT "Visitor" FROM table_49275 WHERE "Home" = 'minnesota'
CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city var...
What are the offerings of upper level electives for CS majors ?
SELECT DISTINCT course.department, course.name, course.number FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id
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 medication ( medi...
had a peep lab test patient 017-13959 received since 06/2104?
SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-13959')) AND lab.labname = 'peep' AND STRFTIME('%y-%m', lab.labresulttime) >= '2104-...
CREATE TABLE repair_assignment ( technician_id int, repair_ID int, Machine_ID int ) CREATE TABLE technician ( technician_id real, Name text, Team text, Starting_Year real, Age int ) CREATE TABLE machine ( Machine_ID int, Making_Year int, Class text, Team text, Machi...
Show different teams of technicians and the number of technicians in each team in a pie chart.
SELECT Team, COUNT(*) FROM technician GROUP BY Team
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, ...
what was the medication patient 26398 had been prescribed two or more times in the previous month?
SELECT t1.drug FROM (SELECT prescriptions.drug, COUNT(prescriptions.startdate) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26398) AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 ...
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE d_...
how many hours has it passed since the last time that patient 5828 stayed in ward 57 during their current hospital visit?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5828 AND admissions.dischtime IS NULL)) AND transfers....
CREATE TABLE table_name_52 ( success_rate VARCHAR, year VARCHAR )
What is the success rate for the year 2012?
SELECT success_rate FROM table_name_52 WHERE year = "2012"
CREATE TABLE table_54151 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
Where is the Venue that has an away team score of 13.16 (94) points?
SELECT "Venue" FROM table_54151 WHERE "Away team score" = '13.16 (94)'
CREATE TABLE table_2202 ( "Index (Year)" text, "Author / Editor / Source" text, "Year of publication" text, "Countries sampled" real, "World Ranking (1)" text, "Ranking L.A. (2)" text )
How many countries were sampled for the Prosperity Index (2008)?
SELECT MAX("Countries sampled") FROM table_2202 WHERE "Index (Year)" = 'Prosperity Index (2008)'
CREATE TABLE table_name_79 ( population__2009_estimate_ VARCHAR, largest_city VARCHAR )
What is the 2009 estimate population of the region with Manaus as the largest city?
SELECT population__2009_estimate_ FROM table_name_79 WHERE largest_city = "manaus"
CREATE TABLE table_26713 ( "Legion no and title" text, "Main legion base" text, "Emblem" text, "Date founded/ founder" text, "Date disband" text, "Castra legionaria (legion bases) * = main base. Start date 31 BC if unspecified" text, "Notes" text )
What is the main legion base that disbanded 70 xx?
SELECT "Main legion base" FROM table_26713 WHERE "Date disband" = '70 XX'
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_proje...
Which department does The Good Life Fall under ?
SELECT DISTINCT department FROM course WHERE name LIKE '%The Good Life%'
CREATE TABLE problem_log ( problem_log_id VARCHAR, log_entry_description VARCHAR )
List all the log ids and their descriptions from the problem logs.
SELECT problem_log_id, log_entry_description FROM problem_log
CREATE TABLE table_name_79 ( frequency INTEGER, website VARCHAR )
What is the highest frequency from uncionfeypoder.com?
SELECT MAX(frequency) FROM table_name_79 WHERE website = "uncionfeypoder.com"
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
provide the number of patients whose gender is f and days of hospital stay is greater than 16?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.days_stay > "16"
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 text ) CREATE TABLE procedures ( ...
what is procedure icd9 code and procedure long title of subject name jonathan wiggins?
SELECT procedures.icd9_code, procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Jonathan Wiggins"
CREATE TABLE table_20354_5 ( zodiac_sign VARCHAR, thai_name VARCHAR )
What's the zodiac sign for the month with Thai name ?
SELECT zodiac_sign FROM table_20354_5 WHERE thai_name = "มกราคม"
CREATE TABLE table_75811 ( "Member State sorted by GDP" text, "GDP in s billion of USD (2012)" real, "GDP % of EU (2012)" text, "Annual change % of GDP (2012)" text, "GDP per capita in PPP US$ (2012)" real, "Public Debt % of GDP (2013 Q1)" real, "Deficit (-)/ Surplus (+) % of GDP (2012)" tex...
What is the largest inflation % annual in 2012 of the country with a public debt % of GDP in 2013 Q1 greater than 88.2 and a GDP % of EU in 2012 of 2.9%?
SELECT MAX("Inflation % Annual (2012)") FROM table_75811 WHERE "Public Debt % of GDP (2013 Q1)" > '88.2' AND "GDP % of EU (2012)" = '2.9%'
CREATE TABLE table_26847237_3 ( home_team VARCHAR, opposition VARCHAR )
what is the home team when the opposition is east coast?
SELECT home_team FROM table_26847237_3 WHERE opposition = "East Coast"
CREATE TABLE table_203_611 ( id number, "player" text, "hr" number, "date reached 500 hr" text, "team" text, "seasons played" text )
which player has the highest number of career home runs ?
SELECT "player" FROM table_203_611 ORDER BY "hr" DESC LIMIT 1
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, hospit...
what are the changes in patient 016-29746's direct bilirubin values measured at 2104-07-19 19:27:36 compared to the value measured at 2104-04-05 07:18:00?
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 = '016-29746')) AND lab.labname = 'direct bilirubin' AND lab.labresulttime = '2104...
CREATE TABLE table_name_23 ( title VARCHAR, podcast_date VARCHAR )
What is the title of the episode that aired on September 25, 2005?
SELECT title FROM table_name_23 WHERE podcast_date = "september 25, 2005"
CREATE TABLE table_24798 ( "District" text, "Municipalities" real, "Parishes" real, "Province of 1936" text, "Region" text )
Name the parishes for beira baixa province
SELECT COUNT("Parishes") FROM table_24798 WHERE "Province of 1936" = 'Beira Baixa Province'
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 ) C...
count the number of patients whose admission type is newborn and days of hospital stay is greater than 8?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.days_stay > "8"
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text,...
Greece 1000 with Row Number.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS Place, Id AS "user_link", Reputation, WebsiteUrl, Location FROM Users WHERE Location LIKE '%Thess%' OR Location LIKE '%Greece%' OR Location LIKE N'%Gr' OR (Location LIKE N'%Athens%' AND NOT Location LIKE N'%GA%') ORDER BY Reputation DESC LIMIT 1000
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
how many patients whose admission location is trsf within this facility and procedure icd9 code is 8857?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND procedures.icd9_code = "8857"
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLOYE...
Line chart, the X is the hire date of employees and the Y-axis is the corresponding salary, and I want to list X-axis from high to low order.
SELECT HIRE_DATE, SALARY FROM employees ORDER BY HIRE_DATE DESC
CREATE TABLE table_25302 ( "Station" text, "Line(s)" text, "City/Neighborhood" text, "Year opened" real, "Transit Connections" text, "Park and ride?" text )
What's the transit connection in Columbia City, Seattle?
SELECT "Transit Connections" FROM table_25302 WHERE "City/Neighborhood" = 'Columbia City, Seattle'
CREATE TABLE table_34649 ( "Draw" real, "Singer" text, "Song" text, "Points" real, "Place" real )
What are the Points when the Place is 9?
SELECT "Points" FROM table_34649 WHERE "Place" = '9'
CREATE TABLE table_name_71 ( bronze INTEGER, gold VARCHAR, total VARCHAR )
What is the lowest number of bronze medals for nations with over 6 total and 2 golds?
SELECT MIN(bronze) FROM table_name_71 WHERE gold = 2 AND total > 6
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid number, patie...
among patients who were prescribed fentanyl citrate 0.05 mg/ml ij soln after they had been diagnosed with pleural effusion - right show me the four year survival rate.
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t4.diagnosistime) > 4 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.uniquepid, t2.diagnosistime FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid...
CREATE TABLE table_17441 ( "Date" text, "Winning Team" text, "Score" text, "Winning Pitcher" text, "Losing Pitcher" text, "Attendance" real, "Location" text )
How many games were on May 20?
SELECT COUNT("Attendance") FROM table_17441 WHERE "Date" = 'May 20'
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Votes ( Id number, PostId number, ...
top 10 users from Bengaluru India.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, Location FROM Users WHERE LOWER(Location) LIKE '%Bengaluru%' OR UPPER(Location) LIKE '%Bengaluru%' OR Location LIKE '%Bengaluru%' OR LOWER(Location) LIKE '%Bangalore%' OR UPPER(Location) LIKE '%Bangalore%' OR Location LIKE '%Bang...
CREATE TABLE Documents ( document_id INTEGER, document_type_code VARCHAR(10), grant_id INTEGER, sent_date DATETIME, response_received_date DATETIME, other_details VARCHAR(255) ) CREATE TABLE Tasks ( task_id INTEGER, project_id INTEGER, task_details VARCHAR(255), "eg Agree Object...
When do all the researcher role staff stop working? Bin the time into weekday interval and count them with a bar chart.
SELECT date_to, COUNT(date_to) FROM Project_Staff
CREATE TABLE table_name_31 ( college_junior_club_team VARCHAR, position VARCHAR, pick__number VARCHAR )
What College/junior/club team has a Position of centre, and pick is #22?
SELECT college_junior_club_team FROM table_name_31 WHERE position = "centre" AND pick__number = "22"
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 ) CREAT...
what did patient 016-17669 first have as an intake on the first icu visit?
SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-17669') AND NOT patient.unitdischargetime IS NULL ORDER ...
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
Questions per day for a specific tag. all time count of questions of a specific tag per day, with rollup
SELECT YEAR(p.CreationDate) AS "year", MONTH(p.CreationDate) AS "month", DAY(p.CreationDate) AS "day", COUNT(*) AS "questionsaskedtoday" FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE t.TagName = @tagName GROUP BY YEAR(p.CreationDate), MONTH(p.CreationDate), ...
CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE date_day ( month_number int, d...
which flights are between BOSTON and BALTIMORE WASHINGTON
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight WHERE ((flight.to_airport = AIRPORT_SERVICE_1.airport_code AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND...
CREATE TABLE table_204_748 ( id number, "composer" text, "born" number, "died" number, "nationality" text, "notable works for piano" text, "remarks" text )
tell me the number of french people on the list .
SELECT COUNT("composer") FROM table_204_748 WHERE "nationality" = 'french'
CREATE TABLE table_59941 ( "Spaceport" text, "Launch complex" text, "Launcher" text, "Spacecraft" text, "Flights" text, "Years" text )
Which complex used the Soyuz (r) launcher to facilitate 14 orbital flights?
SELECT "Launch complex" FROM table_59941 WHERE "Launcher" = 'soyuz (r)' AND "Flights" = '14 orbital'
CREATE TABLE table_5919 ( "Character" text, "French voice actor" text, "Italian voice actor" text, "German voice actor" text, "Spanish voice actor" text )
Which character has a French voice actor of Marc Saez and a German voice actor of Dirk Fenselau?
SELECT "Character" FROM table_5919 WHERE "French voice actor" = 'marc saez' AND "German voice actor" = 'dirk fenselau'
CREATE TABLE table_name_86 ( emit__nm_ VARCHAR, mass__g_mol_ VARCHAR )
Which Emission (in nanometers) that has a molar mass of 1078 g/mol?
SELECT emit__nm_ FROM table_name_86 WHERE mass__g_mol_ = "1078"
CREATE TABLE table_15944_5 ( effective_exhaust_velocity__m_s_ VARCHAR, scenario VARCHAR )
What is the effective exhaust velocity in a Space Shuttle Vacuum?
SELECT COUNT(effective_exhaust_velocity__m_s_) FROM table_15944_5 WHERE scenario = "Space shuttle vacuum"
CREATE TABLE table_name_41 ( country VARCHAR, airport VARCHAR )
Which country contains the Shanghai Pudong International airport?
SELECT country FROM table_name_41 WHERE airport = "shanghai pudong international airport"
CREATE TABLE table_31560 ( "Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Winning constructor" text, "Report" text )
Tell me the date for bugatti fpr stanislas czaykowski
SELECT "Date" FROM table_31560 WHERE "Winning constructor" = 'bugatti' AND "Winning driver" = 'stanislas czaykowski'
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, h...
what are the two year survival probability of a patient diagnosed with do not resusctate status?
SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t2.charttime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id...
CREATE TABLE table_57026 ( "Country" text, "Release Date" real, "Music Label" text, "Media" text, "Catalogue Number" text )
What is the release date of the CD by EG Records in the UK?
SELECT SUM("Release Date") FROM table_57026 WHERE "Media" = 'cd' AND "Country" = 'uk' AND "Music Label" = 'eg records'
CREATE TABLE fires ( fire_year number, discovery_date number, discovery_doy number, discovery_time text, stat_cause_code number, stat_cause_descr text, cont_date text, cont_doy text, cont_time text, fire_size number, fire_size_class text, latitude number, longitude nu...
On what type of land (public or private) do more wildfires occur?
SELECT owner_descr FROM fires GROUP BY owner_descr ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE table_204_365 ( id number, "year" number, "single" text, "chart positions\nusa billboard hot dance club play" number, "chart positions\npolish charts" number, "album" text )
how many singles were released in 2010 ?
SELECT COUNT("single") FROM table_204_365 WHERE "year" = 2010
CREATE TABLE table_59567 ( "Opposing Teams" text, "Against" real, "Date" text, "Venue" text, "Status" text )
Which Venue has a Against larger than 13?
SELECT "Venue" FROM table_59567 WHERE "Against" > '13'
CREATE TABLE table_name_38 ( goals_against INTEGER, played INTEGER )
What is the lowest Goals Agains, when Played is greater than 34?
SELECT MIN(goals_against) FROM table_name_38 WHERE played > 34
CREATE TABLE table_name_83 ( location VARCHAR, score VARCHAR, tournament VARCHAR )
What is the location of the tallahassee open, with a Score of 269 ( 19)?
SELECT location FROM table_name_83 WHERE score = "269 (–19)" AND tournament = "tallahassee open"
CREATE TABLE table_25246990_5 ( us_viewers__millions_ VARCHAR, no_in_season VARCHAR )
How many U.S. viewers were there for the number 4 episode in season?
SELECT us_viewers__millions_ FROM table_25246990_5 WHERE no_in_season = 4
CREATE TABLE table_8020 ( "Story #" text, "Title" text, "Doctor" text, "Narrator" text, "Format" text, "release date" text )
Available in 2-CD format, what is the title of story number 026?
SELECT "Title" FROM table_8020 WHERE "Format" = '2-cd' AND "Story #" = '026'
CREATE TABLE table_name_64 ( current_status VARCHAR, make VARCHAR, number_of_seats VARCHAR )
What is the current status for GM Advanced Design with more than 41 seats?
SELECT current_status FROM table_name_64 WHERE make = "gm advanced design" AND number_of_seats > 41
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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), ...
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, find hire_date and the average of department_id bin hire_date by time, and visualize them by a bar chart, could you rank from high to low by the total number?
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(DEPARTMENT_ID) DESC
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 t...
give the number of patients diagnosed under icd9 code 7245 whose lab test status is delta.
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.icd9_code = "7245" AND lab.flag = "delta"
CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId nu...
People with Jesus in their about me section. Yeah, what the name says
SELECT Id AS "user_link", Location, Reputation FROM Users WHERE AboutMe LIKE '%jesus%' OR AboutMe LIKE '%Jesus%' ORDER BY Reputation DESC
CREATE TABLE elimination ( elimination_id text, wrestler_id text, team text, eliminated_by text, elimination_move text, time text ) CREATE TABLE wrestler ( wrestler_id number, name text, reign text, days_held text, location text, event text )
Which reign is the most common among wrestlers?
SELECT reign FROM wrestler GROUP BY reign ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE cost ( costid number, ...
was the systemicsystolic of patient 027-210868 in 08/this year normal?
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-210868')) AND vitalperiodic.systemicsystolic BETWEEN systolic_bp...