instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
What is the average for 2009 when 2001 is more than 0, 1996 is less than 1 and 2004 is more than 2
CREATE TABLE table_67533 ("Country" text,"2012" real,"2011" real,"2010" real,"2009" real,"2008" real,"2007" real,"2006" real,"2005" real,"2004" real,"2003" real,"2002" real,"2001" real,"2000" real,"1999" real,"1998" real,"1997" real,"1996" real,"1995" real,"1994" real,"1993" real,"1992" real,"1991" real,"1990" real,"19...
SELECT AVG("2009") FROM table_67533 WHERE "2001" > '0' AND "1996" < '1' AND "2004" > '2'
Who was the opponents of the 5th Wicket Partnership?
CREATE TABLE table_52390 ("Wicket Partnership" text,"Runs" text,"Batsmen" text,"Opponents" text,"Venue" text,"Season" text)
SELECT "Opponents" FROM table_52390 WHERE "Wicket Partnership" = '5th'
Which name has a Lane of 7?
CREATE TABLE table_name_79 (name VARCHAR,lane VARCHAR)
SELECT name FROM table_name_79 WHERE lane = 7
what is the first time patient 83894 was admitted through the phys referral/normal deli to the hospital in 2102?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)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 outputevents (row_id number,subject_id number,hadm_i...
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 83894 AND admissions.admission_location = 'phys referral/normal deli' AND STRFTIME('%y', admissions.admittime) = '2102' ORDER BY admissions.admittime LIMIT 1
What record has November 15 as the date?
CREATE TABLE table_name_32 (record VARCHAR,date VARCHAR)
SELECT record FROM table_name_32 WHERE date = "november 15"
Which first leg had Galatasaray as Team 1?
CREATE TABLE table_56853 ("Team 1" text,"Agg." text,"Team 2" text,"1st leg" text,"2nd leg" text)
SELECT "1st leg" FROM table_56853 WHERE "Team 1" = 'galatasaray'
what is the total number of patients who had received a entral infus nutrit sub procedure two times in the last year?
CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)C...
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'entral infus nutrit s...
What is the British record for the fish with a Guernsey record of 32-8-0?
CREATE TABLE table_65232 ("Fish" text,"Guernsey Record" text,"Year" text,"Location" text,"British Record" text)
SELECT "British Record" FROM table_65232 WHERE "Guernsey Record" = '32-8-0'
How many assets does each third party company supply? List the count and the company id. Show the correlation.
CREATE TABLE Skills (skill_id INTEGER,skill_code VARCHAR(20),skill_description VARCHAR(255))CREATE TABLE Parts (part_id INTEGER,part_name VARCHAR(255),chargeable_yn VARCHAR(1),chargeable_amount VARCHAR(20),other_part_details VARCHAR(255))CREATE TABLE Fault_Log (fault_log_entry_id INTEGER,asset_id INTEGER,recorded_by_st...
SELECT COUNT(*), company_id FROM Third_Party_Companies AS T1 JOIN Assets AS T2 ON T1.company_id = T2.supplier_company_id GROUP BY T1.company_id
When was the motor gear of the LMS 1946 no. 1901 model fitted?
CREATE TABLE table_23652 ("LMS 1932/3 No." real,"LMS 1946 No." real,"BR No." real,"Date built" text,"Date motor gear fitted" text,"Withdrawn" text)
SELECT "Date motor gear fitted" FROM table_23652 WHERE "LMS 1946 No." = '1901'
What are the dates in which the mean sea level pressure was between 30.3 and 31, and count them by a line chart
CREATE TABLE station (id INTEGER,name TEXT,lat NUMERIC,long NUMERIC,dock_count INTEGER,city TEXT,installation_date TEXT)CREATE TABLE trip (id INTEGER,duration INTEGER,start_date TEXT,start_station_name TEXT,start_station_id INTEGER,end_date TEXT,end_station_name TEXT,end_station_id INTEGER,bike_id INTEGER,subscription_...
SELECT date, COUNT(date) FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31 GROUP BY date
What is the district with Republican party in place?
CREATE TABLE table_757 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "District" FROM table_757 WHERE "Party" = 'Republican'
Bar chart of school_id from each all games, display total number from low to high order.
CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Percent int,All_Home text,All_Road text,All_Neutral text)CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,En...
SELECT All_Games, School_ID FROM basketball_match ORDER BY School_ID
give me the number of patients whose diagnoses short title is malfunc oth device/graft and lab test name is urea nitrogen?
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Malfunc oth device/graft" AND lab.label = "Urea Nitrogen"
Top deleted users, with dates of first and last posts.
CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE Comment...
SELECT p.OwnerDisplayName, SUM(p.Score) AS "total_score", COUNT(p.Id) AS "number_of_posts", MIN(p.CreationDate) AS "first_post", MAX(p.CreationDate) AS "last_post", DATEDIFF(day, MIN(p.CreationDate), MAX(p.CreationDate)) AS Duration FROM Posts AS p WHERE p.OwnerUserId IS NULL GROUP BY p.OwnerDisplayName ORDER BY MAX(p....
what was the last procedure time patient 26995 went through since 5 years ago?
CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE procedures_icd (row_id numbe...
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26995) AND DATETIME(procedures_icd.charttime) >= DATETIME(CURRENT_TIME(), '-5 year') ORDER BY procedures_icd.charttime DESC LIMIT 1
what was the last height of patient 26817 in 10/this year?
CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom 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,langu...
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 = 26817)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit ht'...
what number of games did oxford united f.c. play in august 1998 ?
CREATE TABLE table_204_441 (id number,"date" text,"opponent" text,"venue" text,"result" text,"attendance" number,"scorers" text)
SELECT COUNT(*) FROM table_204_441 WHERE "date" = 8 AND "date" = 1998
Which team played away at Victoria park?
CREATE TABLE table_name_78 (away_team VARCHAR,venue VARCHAR)
SELECT away_team AS score FROM table_name_78 WHERE venue = "victoria park"
What is the official target date for the Swedish Krona?
CREATE TABLE table_name_34 (official_target_date VARCHAR,currency VARCHAR)
SELECT official_target_date FROM table_name_34 WHERE currency = "swedish krona"
What opponent played on 1/13/1974?
CREATE TABLE table_name_6 (opponent VARCHAR,date VARCHAR)
SELECT opponent FROM table_name_6 WHERE date = "1/13/1974"
Which episode/s were written by Evan Gore?
CREATE TABLE table_29087004_3 (series__number VARCHAR,written_by VARCHAR)
SELECT series__number FROM table_29087004_3 WHERE written_by = "Evan Gore"
What party is Charles Van Wyck part of?
CREATE TABLE table_name_4 (party VARCHAR,incumbent VARCHAR)
SELECT party FROM table_name_4 WHERE incumbent = "charles van wyck"
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of hire_date and the average of salary bin hire_date by weekday, and could you sort y axis in descending order?
CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2)...
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(SALARY) DESC
For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of first_name and department_id , and I want to sort from low to high by the total number.
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 employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME var...
SELECT FIRST_NAME, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY DEPARTMENT_ID
Which Total has a Rank of 4, and a Silver larger than 2?
CREATE TABLE table_name_11 (total INTEGER,rank VARCHAR,silver VARCHAR)
SELECT MIN(total) FROM table_name_11 WHERE rank = "4" AND silver > 2
Questions with just two tags, [homework] and [CHOOSE YOUR OWN ADVENTURE].
CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteUrl text,Location text,AboutMe text,Views number...
SELECT q.Id AS "post_link", q.Score, q.Tags, q.ClosedDate FROM Posts AS q WHERE q.PostTypeId = 1 AND q.Tags LIKE '%<homework>%' AND q.Tags LIKE '%<' + @CoTag + '>%' AND LENGTH(q.Tags) - LENGTH(REPLACE(q.Tags, '><', '')) = 2 AND ((q.ClosedDate IS NULL AND UPPER(@OpenQs) = 'Y') OR (NOT q.ClosedDate IS NULL AND UPPER(@Clo...
what was the name of the medicine that patient 030-75705 was prescribed with after having had a mannitol procedure in the previous month within the same day?
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 cost (costid number,uniquepid text,patienthealthsystemstayid number,eventt...
SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-75705') AND treatment.treatme...
When did Mathieu play against Andrey Golubev?
CREATE TABLE table_71832 ("Date" text,"Tournament" text,"Surface" text,"Opponent in the Final" text,"Score in the Final" text)
SELECT "Date" FROM table_71832 WHERE "Opponent in the Final" = 'andrey golubev'
For each party, return the name of the party and the number of delegates from that party Plot them as bar chart, show by the total number from high to low.
CREATE TABLE county (County_Id int,County_name text,Population real,Zip_code text)CREATE TABLE election (Election_ID int,Counties_Represented text,District int,Delegate text,Party int,First_Elected real,Committee text)CREATE TABLE party (Party_ID int,Year real,Party text,Governor text,Lieutenant_Governor text,Comptroll...
SELECT T2.Party, AVG(COUNT(*)) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party ORDER BY AVG(COUNT(*)) DESC
What was the transfer window with a moving from of fenerbah e?
CREATE TABLE table_65106 ("Nat." text,"Name" text,"Moving from" text,"Type" text,"Transfer window" text,"Ends" real,"Transfer fee" text)
SELECT "Transfer window" FROM table_65106 WHERE "Moving from" = 'fenerbahçe'
Which position does number 23 play?
CREATE TABLE table_name_13 (position VARCHAR,number VARCHAR)
SELECT position FROM table_name_13 WHERE number = "23"
What was the rank (week) for episode number 34?
CREATE TABLE table_26199130_1 (rank__week_ VARCHAR,no VARCHAR)
SELECT rank__week_ FROM table_26199130_1 WHERE no = 34
what is the number of patients whose language is span and age is less than 72?
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 lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.language = "SPAN" AND demographic.age < "72"
Which FIS Nordic World Ski Championships has Winter Olympics of 1960?
CREATE TABLE table_45910 ("Winner" text,"Country" text,"Winter Olympics" text,"FIS Nordic World Ski Championships" text,"Holmenkollen" text)
SELECT "FIS Nordic World Ski Championships" FROM table_45910 WHERE "Winter Olympics" = '1960'
Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order in a bar chart.
CREATE TABLE Apartment_Facilities (apt_id INTEGER,facility_code CHAR(15))CREATE TABLE Apartment_Bookings (apt_booking_id INTEGER,apt_id INTEGER,guest_id INTEGER,booking_status_code CHAR(15),booking_start_date DATETIME,booking_end_date DATETIME)CREATE TABLE View_Unit_Status (apt_id INTEGER,apt_booking_id INTEGER,status_...
SELECT apt_type_code, COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*)
Where did the player who won in 1991 finish?
CREATE TABLE table_name_1 (finish VARCHAR,year_s__won VARCHAR)
SELECT finish FROM table_name_1 WHERE year_s__won = "1991"
provide the number of patients whose admission year is less than 2179 and procedure long title is endovascular (total) embolization or occlusion of head and neck vessels?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,sho...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2179" AND procedures.long_title = "Endovascular (total) embolization or occlusion of head and neck vessels"
Name the successor for james noble died in previous congress
CREATE TABLE table_225198_3 (successor VARCHAR,reason_for_change VARCHAR)
SELECT successor FROM table_225198_3 WHERE reason_for_change = "James Noble died in previous Congress"
Which title had Muriel Evans as leading lady?
CREATE TABLE table_70877 ("Title" text,"Studio" text,"Role" text,"Leading lady" text,"Director" text)
SELECT "Title" FROM table_70877 WHERE "Leading lady" = 'muriel evans'
Which Matches have a Rank smaller than 5, a Years of 1995 2003, and a Goals smaller than 104?
CREATE TABLE table_name_67 (matches INTEGER,goals VARCHAR,rank VARCHAR,years VARCHAR)
SELECT AVG(matches) FROM table_name_67 WHERE rank < 5 AND years = "1995–2003" AND goals < 104
What are the Spring or Summer courses offered that meet the Core requirement ?
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 int,respected int,participation int,heavy_reading int,tough_grade...
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id...
What loss has 16,458 as an Att.?
CREATE TABLE table_33809 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Time" text,"Att." text,"Record" text)
SELECT "Loss" FROM table_33809 WHERE "Att." = '16,458'
did patient 011-14590's systemicmean ever be less than 91.0 since 03/2105?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime ti...
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 = '011-14590')) AND vitalperiodic.systemicmean < 91.0 AND NOT vitalperi...
Display a bar chart for what are the ids and names of the web accelerators that are compatible with two or more browsers?, and I want to sort y-axis from low to high order.
CREATE TABLE Web_client_accelerator (id int,name text,Operating_system text,Client text,Connection text)CREATE TABLE browser (id int,name text,market_share real)CREATE TABLE accelerator_compatible_browser (accelerator_id int,browser_id int,compatible_since_year int)
SELECT name, id FROM Web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id ORDER BY id
Posts counting for Copy Editor badge.
CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score number,ApprovedByUserId number,ApprovalDate time)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate...
SELECT DISTINCT (p.Id) AS "post_link" FROM Users AS u INNER JOIN PostHistory AS h ON u.Id = h.UserId INNER JOIN Posts AS p ON p.Id = h.PostId WHERE u.AccountId = '##AccountId:int##' AND h.PostHistoryTypeId IN (4, 5) AND (p.OwnerUserId IS NULL OR p.OwnerUserId != u.Id OR p.PostTypeId NOT IN (1, 2))
Name the position for delaware
CREATE TABLE table_27373 ("Pick #" real,"NFL Team" text,"Player" text,"Position" text,"College" text)
SELECT "Position" FROM table_27373 WHERE "College" = 'Delaware'
When 10th, south west district 1 is the mens 2nd xi what is the ladies 1st xi?
CREATE TABLE table_21576644_2 (ladies_1st_xi VARCHAR,mens_2nd_xi VARCHAR)
SELECT ladies_1st_xi FROM table_21576644_2 WHERE mens_2nd_xi = "10th, South West District 1"
What is Country, when Place is 'T9', and when Player is 'Michael Campbell'?
CREATE TABLE table_name_1 (country VARCHAR,place VARCHAR,player VARCHAR)
SELECT country FROM table_name_1 WHERE place = "t9" AND player = "michael campbell"
what was the date of the first vinyl lp release ?
CREATE TABLE table_204_128 (id number,"region" text,"date" text,"label" text,"format" text,"catalog" text)
SELECT "date" FROM table_204_128 WHERE "format" = 'vinyl lp' ORDER BY "date" LIMIT 1
When will The Academic Paradox be offered again ?
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 varchar)CREATE TABLE ta (campus_job_id int,student_id int,location var...
SELECT DISTINCT semester.semester, semester.year FROM semester INNER JOIN course_offering ON semester.semester_id = course_offering.semester INNER JOIN course ON course.course_id = course_offering.course_id WHERE course.name LIKE '%The Academic Paradox%' AND semester.semester_id > (SELECT SEMESTERalias1.semester_id FRO...
For each location, give me a scatter chart showing the relationships between the number of total_passengers and the number of platforms.
CREATE TABLE station (Station_ID int,Name text,Annual_entry_exit real,Annual_interchanges real,Total_Passengers real,Location text,Main_Services text,Number_of_Platforms int)CREATE TABLE train_station (Train_ID int,Station_ID int)CREATE TABLE train (Train_ID int,Name text,Time text,Service text)
SELECT SUM(Number_of_Platforms), SUM(Total_Passengers) FROM station GROUP BY Location
What is the result when the date is August 27, 1980?
CREATE TABLE table_68395 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text)
SELECT "Result" FROM table_68395 WHERE "Date" = 'august 27, 1980'
What is the highest Grid with a Name that is jamie whincup?
CREATE TABLE table_name_67 (grid INTEGER,name VARCHAR)
SELECT MAX(grid) FROM table_name_67 WHERE name = "jamie whincup"
Find all the songs that do not have a back vocal.
CREATE TABLE vocals (songid VARCHAR)CREATE TABLE songs (title VARCHAR,songid VARCHAR)
SELECT DISTINCT title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid = t2.songid EXCEPT SELECT t2.title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid = t2.songid WHERE TYPE = "back"
WHO WROTE THE STORY WITH THE PRODUCTION CODE OF 1ADK-03
CREATE TABLE table_12033013_1 (written_by VARCHAR,production_code VARCHAR)
SELECT written_by FROM table_12033013_1 WHERE production_code = "1ADK-03"
how many patients whose gender is f and diagnoses short title is blood in stool?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,sho...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.short_title = "Blood in stool"
What is the highest Apps, when Goals are greater than 5?
CREATE TABLE table_name_58 (apps INTEGER,goals INTEGER)
SELECT MAX(apps) FROM table_name_58 WHERE goals > 5
What is listed for the 2011 that has a 2005 of 4.2%?
CREATE TABLE table_37725 ("Favorite professional sport" text,"2005" text,"2008" text,"2011" text,"2012" text)
SELECT "2011" FROM table_37725 WHERE "2005" = '4.2%'
Questions: Top Scored/Viewed/Favorited by Tag, Year, Month.
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 ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId nu...
SELECT Posts.Id, Posts.Id AS "post_link", Posts.ViewCount AS Views, Posts.Score, Posts.FavoriteCount AS "FavCount", Posts.Tags FROM Posts WHERE Posts.Tags LIKE @Tag AND YEAR(Posts.CreationDate) = @Year AND MONTH(Posts.CreationDate) = @Month ORDER BY Posts.Score DESC, Posts.ViewCount DESC LIMIT 100
WHAT IS THE LOWEST ELECTORATE WITH 31,511 VOTES, AND PERCENT YES SMALLER THAN 57.2?
CREATE TABLE table_51016 ("Constituency" text,"Electorate" real,"Votes" real,"Turnout" real,"Spoilt" real,"Percent Yes" real)
SELECT MIN("Electorate") FROM table_51016 WHERE "Votes" = '31,511' AND "Percent Yes" < '57.2'
Name the margin for 2002
CREATE TABLE table_71161 ("Margin" real,"Score" text,"Opponent" text,"Venue" text,"Year" real)
SELECT "Margin" FROM table_71161 WHERE "Year" = '2002'
Name the date with score of 9-2
CREATE TABLE table_39536 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text)
SELECT "Date" FROM table_39536 WHERE "Score" = '9-2'
Comments like 'What have you tried?' on accepted answer post.
CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE PostsWithDeleted (Id numb...
SELECT c.Text, c.Id AS "comment_link", p.Score, c.CreationDate, p.ViewCount, LENGTH(c.Text) AS "Len", p.Id AS "post_link" FROM Comments AS c INNER JOIN Posts AS p ON c.PostId = p.Id WHERE c.Text LIKE '%hat %ha% tr%' AND c.UserId = '##UserId##' ORDER BY p.CreationDate DESC LIMIT 100
Which category was Gene Barry nominated in?
CREATE TABLE table_name_54 (category VARCHAR,result VARCHAR,nominee VARCHAR)
SELECT category FROM table_name_54 WHERE result = "nominated" AND nominee = "gene barry"
WHAT SERIES WAS RELEASED BY ITV STUDIOS AND A RELEASE DATE OF AUGUST 15, 2012?
CREATE TABLE table_name_47 (series VARCHAR,released_by VARCHAR,release_date VARCHAR)
SELECT series FROM table_name_47 WHERE released_by = "itv studios" AND release_date = "august 15, 2012"
Can you tell me the total number of Roll that has the Area of aranga?
CREATE TABLE table_name_95 (roll VARCHAR,area VARCHAR)
SELECT COUNT(roll) FROM table_name_95 WHERE area = "aranga"
Which year has a Gen.-Secretary of silvana jansen?
CREATE TABLE table_55246 ("Year" text,"President" text,"Vice President" text,"Gen.-Secretary" text,"Treasurer" text)
SELECT "Year" FROM table_55246 WHERE "Gen.-Secretary" = 'silvana jansen'
what are the four most commonly ordered lab tests ordered for patients who have previously been diagnosed with unable to protect airway within 2 months, the last year?
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,syst...
SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'unable to protect airway' AND DATETIME(diagnosis.dia...
how many patients are single and diagnosed with syncope and collapse?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "SINGLE" AND diagnoses.long_title = "Syncope and collapse"
What is the Weight of the Player from Iskra Odintsovo 2008 Club?
CREATE TABLE table_13904 ("Name" text,"Height" text,"Weight" text,"Spike" text,"2008 club" text)
SELECT "Weight" FROM table_13904 WHERE "2008 club" = 'iskra odintsovo'
Name the number for margin of victory being 3 strokes
CREATE TABLE table_21469545_2 (no VARCHAR,margin_of_victory VARCHAR)
SELECT COUNT(no) FROM table_21469545_2 WHERE margin_of_victory = "3 strokes"
What is the highest Sack with an Assisted larger than 4, with TD's smaller than 0?
CREATE TABLE table_56450 ("Player" text,"Tackles" real,"Solo" real,"Assisted" real,"Sack" real,"Yards" real,"TD's" real)
SELECT MAX("Sack") FROM table_56450 WHERE "Assisted" > '4' AND "TD's" < '0'
How many races had 10.5 points?
CREATE TABLE table_5018 ("Season" text,"Series" text,"Team" text,"Races" text,"Wins" text,"Poles" text,"F/Laps" text,"Podiums" text,"Points" text,"Position" text)
SELECT "Races" FROM table_5018 WHERE "Points" = '10.5'
WHAT WAS THE AVERAGE EMISSION PER KM 2 IN INDIA?
CREATE TABLE table_11251601_2 (avg_emission_per_km_2_of_its_land__tons_ INTEGER,country VARCHAR)
SELECT MAX(avg_emission_per_km_2_of_its_land__tons_) FROM table_11251601_2 WHERE country = "India"
What is the area of xin county?
CREATE TABLE table_4034 ("English Name" text,"Simplified" text,"Traditional" text,"Pinyin" text,"Area" real,"Population" real,"Density" real)
SELECT "Area" FROM table_4034 WHERE "English Name" = 'Xin County'
How many numbers were recorded under revenue when revenue per capita was $6,126?
CREATE TABLE table_19506 ("Rank" real,"State" text,"Revenue (millions)" text,"Population" real,"Revenue per capita" text,"Spending (millions)" text,"Spending per capita" text,"Net contribution per capita" text,"Presidential majority 2000/2004" text,"Presidential majority 2008" text,"Presidential majority 2012" text,"Ob...
SELECT COUNT("Revenue (millions)") FROM table_19506 WHERE "Revenue per capita" = '$6,126'
did patient 006-254182 receive a laboratory test in 09/last year?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE lab (labid number,patientunitstayid num...
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 = '006-254182')) AND DATETIME(lab.labresulttime, 'start of year') = DATETIME(CURRENT_TIME()...
Dump Project Management Stack Exchange (PMSE) Posts.
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 * FROM Posts WHERE OwnerUserId = '##UserId##'
What subjects does COMM 490 cover ?
CREATE TABLE area (course_id int,area varchar)CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE course (course_id int,name varchar,department varchar,number varchar,credits varchar,advisory_requirement v...
SELECT DISTINCT description, name FROM course WHERE department = 'COMM' AND number = 490
what is the name of the title after number 9 ?
CREATE TABLE table_204_238 (id number,"#" number,"title" text,"producer(s)" text,"performer (s)" text,"time" text)
SELECT "title" FROM table_204_238 WHERE "#" = 9 + 1
What is the highest Market Value (billion $), when Rank is 02 2, and when Sales (billion $) is greater than 113.1?
CREATE TABLE table_49281 ("Rank" text,"Company" text,"Headquarters" text,"Industry" text,"Sales (billion $)" real,"Profits (billion $)" real,"Assets (billion $)" real,"Market Value (billion $)" real)
SELECT MAX("Market Value (billion $)") FROM table_49281 WHERE "Rank" = '02 2' AND "Sales (billion $)" > '113.1'
Show the team that have at least two technicians.
CREATE TABLE technician (Team VARCHAR)
SELECT Team FROM technician GROUP BY Team HAVING COUNT(*) >= 2
What do you think the hardest class is ?
CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE area (course_id int,area varchar)CREATE TABLE student (student_id int,las...
SELECT DISTINCT course.name, course.number, program_course.workload FROM course, program_course WHERE course.department = 'EECS' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MAX(PROGRAM_COURSEalias1.workload) FROM course AS COURSEalias1, program_course AS PROGRAM_COURSEalias1 WH...
How many times were there plays with a try of 56?
CREATE TABLE table_17941032_2 (played VARCHAR,tries_for VARCHAR)
SELECT played FROM table_17941032_2 WHERE tries_for = "56"
what is the flight number for the CO flight which leaves DENVER at 1220pm and goes to SAN FRANCISCO
CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE compartment_class (compartment varchar,class_type varchar)CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE city (city_code varchar,city_na...
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.departure_time = 1220 AND flight.to_airport = AIRPORT_SERVICE_...
find the number of patients who have been admitted in hospital this year.
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,disch...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
How many people watched a Glenferrie Oval?
CREATE TABLE table_32311 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT COUNT("Crowd") FROM table_32311 WHERE "Venue" = 'glenferrie oval'
when was the first time patient 027-140654 received a lab test for the anion gap during their current hospital encounter?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number...
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 = '027-140654' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'anion ga...
Which Drobo (2nd) has a Drobo 5d of 2012-11-02?
CREATE TABLE table_11042 ("Drobo (1st)" text,"Drobo (2nd)" text,"Drobo S" text,"Drobo S (2nd)" text,"Drobo FS" text,"Drobo Mini" text,"Drobo 5D" text)
SELECT "Drobo (2nd)" FROM table_11042 WHERE "Drobo 5D" = '2012-11-02'
Find the name of airline which runs the most number of routes.
CREATE TABLE airlines (name VARCHAR,alid VARCHAR)CREATE TABLE routes (alid VARCHAR)
SELECT T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.name ORDER BY COUNT(*) DESC LIMIT 1
tell me the name of the specimen test that patient 031-9128 first received in 11/last year?
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 lab (labid number,patientunitstayid number,labna...
SELECT microlab.culturesite FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-9128')) AND DATETIME(microlab.culturetakentime, 'start of year') =...
What NFL team does player keith woodside play for?
CREATE TABLE table_19493 ("Pick #" real,"NFL Team" text,"Player" text,"Position" text,"College" text)
SELECT "NFL Team" FROM table_19493 WHERE "Player" = 'Keith Woodside'
What is the lowest cr number?
CREATE TABLE table_22640 ("HR no." text,"HR name" text,"CR no." real,"LMS no." real,"Built" text,"Works" text,"Withdrawn" text)
SELECT MIN("CR no.") FROM table_22640
Who's the writer for the episode with a production code 2395114?
CREATE TABLE table_10953197_4 (writer_s_ VARCHAR,production_code VARCHAR)
SELECT writer_s_ FROM table_10953197_4 WHERE production_code = "2395114"
Most duplicated questions in a given tag.
CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,OwnerUserId number,Comment text,Text text,Title te...
SELECT q.Id AS "Question ID", PostLinks.PostId AS "Dupe Target ID", q.Tags AS "Original Tags" FROM PostLinks JOIN Posts AS q ON q.Id = RelatedPostId JOIN PostTags AS p ON p.PostId = q.Id JOIN Tags AS t ON p.TagId = t.Id WHERE LinkTypeId = 3 ORDER BY q.Id
What position did Co-driver Jackie Oliver finish in the 24 hours of Le Mans?
CREATE TABLE table_57726 ("Year" real,"Race" text,"Team" text,"Pos." text,"Co-driver" text)
SELECT "Pos." FROM table_57726 WHERE "Race" = '24 hours of le mans' AND "Co-driver" = 'jackie oliver'
Who is the play-by-play when nbc is the network and darren pang is the ice level reporters?
CREATE TABLE table_22485543_1 (play_by_play VARCHAR,network VARCHAR,ice_level_reporters VARCHAR)
SELECT play_by_play FROM table_22485543_1 WHERE network = "NBC" AND ice_level_reporters = "Darren Pang"
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of first_name and commission_pct in a bar chart.
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 locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID v...
SELECT FIRST_NAME, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
Who are the candidates in the race where Wright Patman is the incumbent?
CREATE TABLE table_1342315_42 (candidates VARCHAR,incumbent VARCHAR)
SELECT candidates FROM table_1342315_42 WHERE incumbent = "Wright Patman"