instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
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, draw a bar chart about the distribution of hire_date and the average of employee_id bin hire_date by weekday, list by the Y-axis in asc please.
CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE 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 (REGIO...
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)
when was the last time that patient 43735 was diagnosed with a status-post ptca until 1 year ago?
CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttim...
SELECT diagnoses_icd.charttime FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'status-post ptca') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 43735) AND DATETIME(diagn...
how many times is this other skeletal traction procedure done in 2105?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title 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 prescriptions (row_id number,subject_id number,hadm_id number,st...
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'other skeletal traction') AND STRFTIME('%y', procedures_icd.charttime) = '2105'
Which Badges are the most dificult to get?.
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE VoteTypes (Id number,Name...
SELECT Badges.Name AS Name, Badges.Class AS Class, COUNT(Users.Id) AS NumberUsers FROM Badges INNER JOIN Users ON Badges.UserId = Users.Id WHERE Badges.TagBased = 0 GROUP BY Name, Class ORDER BY NumberUsers
WHAT IS THE AVERAGE NANGUN WITH A RANK LARGER THAN 2, TOTAL OF 17.85?
CREATE TABLE table_12236 ("Rank" real,"Athlete" text,"Nanquan" real,"Nangun" real,"Total" real)
SELECT AVG("Nangun") FROM table_12236 WHERE "Rank" > '2' AND "Total" = '17.85'
Where was the cup on 07.02.2009 held?
CREATE TABLE table_20462111_1 (location VARCHAR,date VARCHAR)
SELECT location FROM table_20462111_1 WHERE date = "07.02.2009"
Which CSP classes are PreMajor ?
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 FROM course, program, program_course WHERE course.department LIKE '%CSP%' AND program_course.category LIKE '%PreMajor%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id
What team had a capacity of 102.3%?
CREATE TABLE table_74337 ("Team" text,"Stadium" text,"Home Games" real,"Average Attendance" real,"Total Attendance" real,"Capacity Percentage" text)
SELECT "Team" FROM table_74337 WHERE "Capacity Percentage" = '102.3%'
What was Dom Joly famous for?
CREATE TABLE table_75446 ("Celebrity" text,"Famous for" text,"Entered" text,"Exited" text,"Finished" text)
SELECT "Famous for" FROM table_75446 WHERE "Celebrity" = 'dom joly'
How many patients are admitted from hosp/extram and before the year 2168?
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 text,gender text,language text,religion text,admission_type text,days_stay ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.admityear < "2168"
List the total points of gymnasts in descending order.
CREATE TABLE gymnast (Total_Points VARCHAR)
SELECT Total_Points FROM gymnast ORDER BY Total_Points DESC
What is Date, when Site is 'Louisiana Superdome New Orleans, LA'?
CREATE TABLE table_name_65 (date VARCHAR,site VARCHAR)
SELECT date FROM table_name_65 WHERE site = "louisiana superdome • new orleans, la"
What are all values for the male population in 2001 with a growth rate in 1991-01 of 36.16?
CREATE TABLE table_23093 ("Districts of Bihar" text,"Total Population 2001" real,"Male Population 2001" real,"Female Population 2001" real,"Growth Rate 1981-91" text,"Growth Rate 1991-01" text,"Sex Ratio \u2021 1991" real,"Sex Ratio \u2021 2001" real,"Population density \u2020 1991" real,"Population density \u2020 2001...
SELECT "Male Population 2001" FROM table_23093 WHERE "Growth Rate 1991-01" = '36.16'
how many airlines commenced operation after 2006 ?
CREATE TABLE table_204_163 (id number,"airline" text,"icao" text,"iata" text,"callsign" text,"commenced\noperations" number)
SELECT COUNT("airline") FROM table_204_163 WHERE "commenced\noperations" > 2006
For those employees who was hired before 2002-06-21, give me the comparison about the sum of department_id over the hire_date bin hire_date by weekday by a bar chart.
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 countries (COUNTRY_ID varchar(2),COUN...
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE HIRE_DATE < '2002-06-21'
What largest against has the opposing team of fiji?
CREATE TABLE table_name_44 (against INTEGER,opposing_team VARCHAR)
SELECT MAX(against) FROM table_name_44 WHERE opposing_team = "fiji"
Which Points have a Game smaller than 70, and a Score of 4 8?
CREATE TABLE table_name_85 (points INTEGER,game VARCHAR,score VARCHAR)
SELECT MIN(points) FROM table_name_85 WHERE game < 70 AND score = "4–8"
Which institution's nickname is the Bobcats?
CREATE TABLE table_28398 ("Institution" text,"Location" text,"Nickname" text,"Founded" real,"Founding Religious Affiliation" text,"Enrollment" real,"Joined" real)
SELECT "Institution" FROM table_28398 WHERE "Nickname" = 'Bobcats'
Which ralliers won the stages that were at 18:54 GMT?
CREATE TABLE table_24290 ("Day" text,"Stage" text,"Time (GMT)" text,"Name" text,"Length" text,"Winner" text,"Time" text,"Avg. spd." text,"Rally leader" text)
SELECT "Winner" FROM table_24290 WHERE "Time (GMT)" = '18:54'
How many US viewers (millions) were there for 'cold reveal
CREATE TABLE table_17018 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"U.S. viewers (millions)" text)
SELECT "U.S. viewers (millions)" FROM table_17018 WHERE "Title" = 'Cold Reveal'
Name the horizontal number for number 10
CREATE TABLE table_27732 ("Number" real,"Name" text,"Vertices" text,"Hypotenuse 0 c" text,"Vertical 0 b" text,"Horizontal 0 a" text)
SELECT COUNT("Horizontal 0 a") FROM table_27732 WHERE "Number" = '10'
Calculate the patients diagnosed with icd9 code 5770 who were discharged to home.
CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.discharge_location = "HOME" AND diagnoses.icd9_code = "5770"
Which Goberman has a Date of april 28 april 30, 2008?
CREATE TABLE table_75990 ("Source" text,"Date" text,"Goberman" text,"Loera" text,"Merkley" text,"Neville" text,"Novick" text,"Obrist" text,"Other/ Undecided" text)
SELECT "Goberman" FROM table_75990 WHERE "Date" = 'april 28–april 30, 2008'
What is the smallest byes when the wins are 3?
CREATE TABLE table_name_49 (byes INTEGER,wins VARCHAR)
SELECT MIN(byes) FROM table_name_49 WHERE wins = 3
What was the away team score at western oval?
CREATE TABLE table_name_46 (away_team VARCHAR,venue VARCHAR)
SELECT away_team AS score FROM table_name_46 WHERE venue = "western oval"
What Name has a 2008 Club of Sisley Treviso?
CREATE TABLE table_63577 ("Name" text,"Height" text,"Weight" text,"Spike" text,"2008 club" text)
SELECT "Name" FROM table_63577 WHERE "2008 club" = 'sisley treviso'
What is the time/retired for grid 9?
CREATE TABLE table_58309 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Time/Retired" FROM table_58309 WHERE "Grid" = '9'
What is the average attendance for all events held at Palmerston Park venue?
CREATE TABLE table_45890 ("Date" text,"Opponent" text,"Venue" text,"Result" text,"Attendance" real)
SELECT AVG("Attendance") FROM table_45890 WHERE "Venue" = 'palmerston park'
Give me the comparison about the sum of Height over the Sex , and group by attribute Sex by a bar chart, rank by the Y in ascending please.
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)CREATE TABLE people (People_ID int,Sex text,Name text,Date_of_Birth text,Height real,Weight real)
SELECT Sex, SUM(Height) FROM people GROUP BY Sex ORDER BY SUM(Height)
How many wins occurred for 6th rank?
CREATE TABLE table_37764 ("Year" real,"Class" text,"Team" text,"Points" real,"Rank" text,"Wins" real)
SELECT COUNT("Wins") FROM table_37764 WHERE "Rank" = '6th'
how many of the contestants were students ?
CREATE TABLE table_203_446 (id number,"name" text,"gender" text,"age" number,"from" text,"occupation" text,"prize money (usd)" text,"status" text)
SELECT COUNT("name") FROM table_203_446 WHERE "occupation" = 'student'
What is the title of the episode Alex Reid directed?
CREATE TABLE table_28760804_1 (title VARCHAR,directed_by VARCHAR)
SELECT title FROM table_28760804_1 WHERE directed_by = "Alex Reid"
What title has a Label of warp records / paper bag records?
CREATE TABLE table_34030 ("Year" real,"Title" text,"Label" text,"Format" text,"Album" text)
SELECT "Title" FROM table_34030 WHERE "Label" = 'warp records / paper bag records'
What are the class hours next semester for the DENT 551 lecture ?
CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE area (course_id int,area varchar)CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE ...
SELECT DISTINCT course_offering.start_time FROM course INNER JOIN program_course ON program_course.course_id = course.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'DENT' AND course.nu...
show me the flights from ATLANTA to BOSTON
CREATE TABLE class_of_service (booking_class varchar,rank int,class_description text)CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE code_description (code varchar,description text)CREATE TABLE flight_stop (flight_id int,stop_number int,stop_days text,stop_airport text,arrival_time i...
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 = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON...
Show different locations of railways along with the corresponding number of railways at each location.
CREATE TABLE railway (LOCATION VARCHAR)
SELECT LOCATION, COUNT(*) FROM railway GROUP BY LOCATION
When is the earliest year in milan that guillermo vilas was champion?
CREATE TABLE table_71979 ("Location" text,"Year" real,"Champion" text,"Runner-up" text,"Score" text)
SELECT MIN("Year") FROM table_71979 WHERE "Location" = 'milan' AND "Champion" = 'guillermo vilas'
give me the number of patients whose insurance is self pay and days of hospital stay is greater than 23?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Self Pay" AND demographic.days_stay > "23"
How many episodes aired on october 27, 2008
CREATE TABLE table_11235334_2 (episode VARCHAR,air_date VARCHAR)
SELECT COUNT(episode) FROM table_11235334_2 WHERE air_date = "October 27, 2008"
Most recent post from given set of users.
CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score n...
WITH recent_cte AS (SELECT u.Id AS UserId, MAX(p.Id) AS MaxId FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id WHERE u.Id IN ('##list##') GROUP BY u.Id) SELECT UserId AS "user_link", MaxId AS "post_link", p.CreationDate, p.Score FROM recent_cte INNER JOIN Posts AS p ON MaxId = p.Id ORDER BY p.CreationDate ...
What was her final score on the ribbon apparatus?
CREATE TABLE table_name_86 (score_final VARCHAR,apparatus VARCHAR)
SELECT score_final FROM table_name_86 WHERE apparatus = "ribbon"
is the value of urea nitrogen of a patient last measured on the current hospital visit greater than the value of patient 49176 first measured on the current hospital visit?
CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid...
SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 49176 AND admissions.dischtime IS NULL) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'urea nitrogen') ORDER BY labevents.char...
How many Yards did Player Rob Turner collect?
CREATE TABLE table_name_32 (yards VARCHAR,player VARCHAR)
SELECT yards FROM table_name_32 WHERE player = "rob turner"
who did this player play for after he was on the los angeles rams ?
CREATE TABLE table_204_914 (id number,"year" number,"team" text,"games" number,"attempts" number,"yards" number,"ypc" number,"long" number,"tds" number)
SELECT "team" FROM table_204_914 WHERE "year" > (SELECT MAX("year") FROM table_204_914 WHERE "team" = 'los angeles rams') ORDER BY "year" LIMIT 1
tell me the time of admission and gender of patient with patient id 26285.
CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT demographic.gender, demographic.admittime FROM demographic WHERE demographic.subject_id = "26285"
Which athlete represented the country of egypt?
CREATE TABLE table_name_35 (athlete VARCHAR,country VARCHAR)
SELECT athlete FROM table_name_35 WHERE country = "egypt"
What is the highest grid that tetsuya harada rode in?
CREATE TABLE table_46693 ("Rider" text,"Manufacturer" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT MAX("Grid") FROM table_46693 WHERE "Rider" = 'tetsuya harada'
Who is the director for the witman boys?
CREATE TABLE table_14975415_1 (director VARCHAR,english_title VARCHAR)
SELECT director FROM table_14975415_1 WHERE english_title = "The Witman Boys"
what is the respiration change of patient 027-61708 from the value measured at 2105-12-23 00:00:00 compared to the value measured at 2105-12-22 23:55:00?
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,drugstoptime time)CREATE TABLE patient (uniquepid text,patienthealths...
SELECT (SELECT vitalperiodic.respiration FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-61708')) AND NOT vitalperiodic.respiration ...
What is the time for Moscow, Russia?
CREATE TABLE table_74824 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Time" text,"Location" text)
SELECT "Time" FROM table_74824 WHERE "Location" = 'moscow, russia'
count the number of people diagnosed with anemia-other chronic dis who did not come back to the hospital within the same month during a year before.
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 (SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'anemia-oth...
which district has the most density ?
CREATE TABLE table_203_212 (id number,"#" number,"district" text,"land area (km2)" number,"population\n(2010 census)" number,"density (persons/km2)" number)
SELECT "district" FROM table_203_212 ORDER BY "density (persons/km2)" DESC LIMIT 1
What is the total number of rebounds values for Ann Wauters?
CREATE TABLE table_36148 ("Rank" real,"Name" text,"Team" text,"Games" real,"Rebounds" real)
SELECT COUNT("Rebounds") FROM table_36148 WHERE "Name" = 'ann wauters'
What college did delray brooks go to?
CREATE TABLE table_10919 ("Player" text,"Height" text,"School" text,"Hometown" text,"College" text,"NBA Draft" text)
SELECT "College" FROM table_10919 WHERE "Player" = 'delray brooks'
What engine was used by Equipe Simca Gordini before 1956 with less than 4 points?
CREATE TABLE table_80102 ("Year" real,"Entrant" text,"Chassis" text,"Engine" text,"Points" real)
SELECT "Engine" FROM table_80102 WHERE "Year" < '1956' AND "Points" < '4' AND "Entrant" = 'equipe simca gordini'
Top 200 users from Vietnam.
CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)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,I...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%vietnam%' OR UPPER(Location) LIKE '%IND' ORDER BY Reputation DESC LIMIT 2000
Who is the Winning Driver, when Most Laps Led is Dario Franchitti, and when Pole Position is H lio Castroneves?
CREATE TABLE table_name_10 (winning_driver VARCHAR,most_laps_led VARCHAR,pole_position VARCHAR)
SELECT winning_driver FROM table_name_10 WHERE most_laps_led = "dario franchitti" AND pole_position = "hélio castroneves"
What theme has a mintage of 3527?
CREATE TABLE table_68916 ("Year" real,"Theme" text,"Artist" text,"Mintage" text,"Issue price" real,"Special notes" text)
SELECT "Theme" FROM table_68916 WHERE "Mintage" = '3527'
Which year has an Engine(s) of yamaha v8?
CREATE TABLE table_name_6 (year VARCHAR,engine_s_ VARCHAR)
SELECT year FROM table_name_6 WHERE engine_s_ = "yamaha v8"
Who's the conservative 1st member of the election of 1852?
CREATE TABLE table_78814 ("Election" text,"1st Member" text,"1st Party" text,"2nd Member" text,"2nd Party" text)
SELECT "1st Member" FROM table_78814 WHERE "1st Party" = 'conservative' AND "Election" = '1852'
Which original artist has a Episode of workshop #1?
CREATE TABLE table_69351 ("Episode" text,"Theme" text,"Song choice" text,"Original artist" text,"Order #" text,"Result" text)
SELECT "Original artist" FROM table_69351 WHERE "Episode" = 'workshop #1'
when did patient 011-49649 last come into the hospital via the other hospital?
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,ag...
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '011-49649' AND patient.hospitaladmitsource = 'other hospital' ORDER BY patient.hospitaladmittime DESC LIMIT 1
Who is the opponent when the attendance is 57,331?
CREATE TABLE table_name_41 (opponent VARCHAR,attendance VARCHAR)
SELECT opponent FROM table_name_41 WHERE attendance = "57,331"
who is the replacement when the date of vacancy is 1 september 2008?
CREATE TABLE table_13552 ("Team" text,"Outgoing manager" text,"Manner of departure" text,"Date of vacancy" text,"Replaced by" text,"Date of appointment" text,"Position in table" text)
SELECT "Replaced by" FROM table_13552 WHERE "Date of vacancy" = '1 september 2008'
what were the three most frequent prescriptions of medications for patients who were also prescribed diazepam at the same time since 5 years ago?
CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE medication (medicationid number,patientunitstayi...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'diazepam' AND DATETIME(medication.drugstarttime) >=...
What is Status, when Date is 10/05/1975?
CREATE TABLE table_name_33 (status VARCHAR,date VARCHAR)
SELECT status FROM table_name_33 WHERE date = "10/05/1975"
What points has points for as points for?
CREATE TABLE table_name_25 (points VARCHAR,points_for VARCHAR)
SELECT points FROM table_name_25 WHERE points_for = "points for"
Who is the trainer for Cherry Valley Farm?
CREATE TABLE table_name_94 (trainer VARCHAR,owner VARCHAR)
SELECT trainer FROM table_name_94 WHERE owner = "cherry valley farm"
What is the nationality of Stromile Swift?
CREATE TABLE table_45845 ("Player" text,"Nationality" text,"Position" text,"Years for Grizzlies" text,"School/Club Team" text)
SELECT "Nationality" FROM table_45845 WHERE "Player" = 'stromile swift'
What status has an area km 2 greater than 10.9, with 4,674 of 5,008 as the census ranking
CREATE TABLE table_9037 ("Official Name" text,"Status" text,"Area km 2" real,"Population" real,"Census Ranking" text)
SELECT "Status" FROM table_9037 WHERE "Area km 2" > '10.9' AND "Census Ranking" = '4,674 of 5,008'
Where did the team finish in the season when the playoff result was divisional finals.
CREATE TABLE table_980 ("Year" real,"Team Name" text,"Division" text,"League" text,"Regular Season" text,"Playoffs" text,"Open Cup" text)
SELECT "Regular Season" FROM table_980 WHERE "Playoffs" = 'Divisional Finals'
What is the maximum McCain population turnout number?
CREATE TABLE table_20684390_1 (mccain_number INTEGER)
SELECT MAX(mccain_number) FROM table_20684390_1
what is the insurance and diagnosis icd9 code of subject id 21796?
CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT demographic.insurance, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "21796"
What is Winner, when Year is 2001?
CREATE TABLE table_48161 ("Year" real,"Winner" text,"Jockey" text,"Trainer" text,"Owner" text,"Time" text)
SELECT "Winner" FROM table_48161 WHERE "Year" = '2001'
who is the away team when the tie no is more than 13 and the home team is team bath?
CREATE TABLE table_54296 ("Tie no" real,"Home team" text,"Score" text,"Away team" text,"Attendance" real)
SELECT "Away team" FROM table_54296 WHERE "Tie no" > '13' AND "Home team" = 'team bath'
What is the value for 2007 when 2008 is Q1?
CREATE TABLE table_name_68 (Id VARCHAR)
SELECT 2007 FROM table_name_68 WHERE 2008 = "q1"
Tell me the date for dinah pfizenmaier anna zaja and winner
CREATE TABLE table_name_46 (date VARCHAR,outcome VARCHAR,opponents VARCHAR)
SELECT date FROM table_name_46 WHERE outcome = "winner" AND opponents = "dinah pfizenmaier anna zaja"
list flights from CHICAGO to SAN DIEGO
CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_required text,minimum_stay int,maximum_stay int,application text,no_discounts text)CREATE TABLE d...
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 = 'CHICAGO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN DI...
On what date was the home team Footscray?
CREATE TABLE table_33100 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Date" FROM table_33100 WHERE "Home team" = 'footscray'
The golfer Jeff Sluman golfs for what country?
CREATE TABLE table_name_13 (country VARCHAR,player VARCHAR)
SELECT country FROM table_name_13 WHERE player = "jeff sluman"
how many laps were required to successfully complete the 125cc classification of the 2010 catalan motorcycle grand prix ?
CREATE TABLE table_204_603 (id number,"pos" text,"no" number,"rider" text,"bike" text,"laps" number,"time" text,"grid" number,"points" number)
SELECT MAX("laps") FROM table_204_603
how many patients with metabolic encephalopathy diagnoses are still alive?
CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.short_title = "Metabolic encephalopathy"
Which Giant Slalom was obtained in the 1997 season?
CREATE TABLE table_name_29 (Giant VARCHAR,season VARCHAR)
SELECT Giant AS slalom FROM table_name_29 WHERE season = 1997
What is the To par of T9 Place Player Ernie Els?
CREATE TABLE table_name_95 (to_par VARCHAR,place VARCHAR,player VARCHAR)
SELECT to_par FROM table_name_95 WHERE place = "t9" AND player = "ernie els"
Which Projects template has an IntelliTrace of no, and a Windows Phone development of yes, and a Test impact analysis of no?
CREATE TABLE table_38391 ("Product" text,"Extensions" text,"Projects templates" text,"MSDN integration" text,"Debugging" text,"Profiling" text,"IntelliTrace" text,"Unit test" text,"Code coverage" text,"Test impact analysis" text,"Load testing" text,"Lab management" text,"Architecture and modelling" text,"Windows Phone ...
SELECT "Projects templates" FROM table_38391 WHERE "IntelliTrace" = 'no' AND "Windows Phone development" = 'yes' AND "Test impact analysis" = 'no'
What rank is the team with 1 silver, 3 bronze and a total of less than 8 medals?
CREATE TABLE table_name_32 (rank VARCHAR,total VARCHAR,silver VARCHAR,bronze VARCHAR)
SELECT COUNT(rank) FROM table_name_32 WHERE silver = 1 AND bronze = 3 AND total < 8
When 36 is the amount of ends won how many sets of pf's are there?
CREATE TABLE table_31197 ("Skip (Club)" text,"W" real,"L" real,"PF" real,"PA" real,"Ends Won" real,"Ends Lost" real,"Blank Ends" real,"Stolen Ends" real)
SELECT COUNT("PF") FROM table_31197 WHERE "Ends Won" = '36'
how many times patient 017-83061 has received an enteral meds until 07/2105?
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patie...
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-83061')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.ce...
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id, and show X-axis in desc order please.
CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE ...
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID DESC
What is the area (ha) of the group on the island of Linga Holm that has a Height (m) larger than 7?
CREATE TABLE table_name_31 (area___ha__ VARCHAR,height__m_ VARCHAR,island VARCHAR)
SELECT area___ha__ FROM table_name_31 WHERE height__m_ > 7 AND island = "linga holm"
Who was team 1 when team 2 was Young Africans?
CREATE TABLE table_14821 ("Team 1" text,"Agg." text,"Team 2" text,"1st leg" text,"2nd leg" text)
SELECT "Team 1" FROM table_14821 WHERE "Team 2" = 'young africans'
how many patients whose primary disease is left femur fracture?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "LEFT FEMUR FRACTURE"
Which average bronze had a silver greater than 2 and a gold larger than 7?
CREATE TABLE table_name_9 (bronze INTEGER,silver VARCHAR,gold VARCHAR)
SELECT AVG(bronze) FROM table_name_9 WHERE silver > 2 AND gold > 7
What channel had the prize of 100,000?
CREATE TABLE table_14523485_9 (channel VARCHAR,top_prize VARCHAR)
SELECT channel FROM table_14523485_9 WHERE top_prize = "€100,000"
At which stadiums was attendance total 79176?
CREATE TABLE table_16028479_2 (game_site VARCHAR,attendance VARCHAR)
SELECT game_site FROM table_16028479_2 WHERE attendance = 79176
18 _ 75 years of age
CREATE TABLE table_train_229 ("id" int,"hemoglobin_a1c_hba1c" float,"active_metabolic" bool,"body_weight" float,"hba1c" float,"age" float,"NOUSE" float)
SELECT * FROM table_train_229 WHERE age >= 18 AND age <= 75
when patient 005-73237 did get a lab test the last time during the previous month?
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllab...
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-73237')) AND DATETIME(lab.labresulttime, 'start of month') = DATETIME(CURRENT_T...
Users ranked by number of badges (all kinds).
CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteUrl text,Location text,AboutMe text,Views number,UpVotes number,DownVotes number,ProfileImageUrl text,EmailHash text,AccountId number)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE T...
SELECT UserLink AS "user_link", Rep, NumBadges, COUNT(*) AS "numquestions" FROM (SELECT * FROM (SELECT Users.Id AS "userlink", Users.Reputation AS "rep", COUNT(*) AS "numbadges" FROM Users INNER JOIN Badges ON Users.Id = Badges.UserId WHERE Badges.Class = 1 GROUP BY Users.Id, Users.Reputation) AS UserByBadge ORDER BY N...
what is the number of patients whose drug code is norebase and lab test fluid is blood?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "NOREBASE" AND lab.fluid = "Blood"
Name the high points for april 8
CREATE TABLE table_27722734_11 (high_points VARCHAR,date VARCHAR)
SELECT high_points FROM table_27722734_11 WHERE date = "April 8"