instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
how many patients whose insurance is medicare and diagnoses short title is preterm nec 2500+g?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicare" AND diagnoses.short_title = "Preterm NEC 2500+g"
WHAT IS THE 2011 PERFORMANCE AT THE MIAMI MASTERS?
CREATE TABLE table_50693 ("Tournament" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text)
SELECT "2011" FROM table_50693 WHERE "Tournament" = 'miami masters'
What was the date of appointment for Christos Kassianos who belonged to AEK?
CREATE TABLE table_9888 ("Team" text,"Outgoing manager" text,"Manner of departure" text,"Date of vacancy" text,"Replaced by" text,"Date of appointment" text)
SELECT "Date of appointment" FROM table_9888 WHERE "Team" = 'aek' AND "Replaced by" = 'christos kassianos'
what were the three most frequently prescribed drugs for patients who had also been prescribed paroxetine hcl at the same time?
CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'paroxetine hcl') AS t1 JOIN (SELECT admissions.subject_id, prescr...
Draw a bar chart of owner versus total number of rating in percent, rank X from high to low order.
CREATE TABLE program (Program_ID int,Name text,Origin text,Launch real,Owner text)CREATE TABLE broadcast (Channel_ID int,Program_ID int,Time_of_day text)CREATE TABLE channel (Channel_ID int,Name text,Owner text,Share_in_percent real,Rating_in_percent real)CREATE TABLE broadcast_share (Channel_ID int,Program_ID int,Date...
SELECT Owner, SUM(Rating_in_percent) FROM channel GROUP BY Owner ORDER BY Owner DESC
What is taipei's lowest 2010 population?
CREATE TABLE table_9083 ("City" text,"Chinese" text,"Pinyin" text,"County" text,"Population (2010)" real)
SELECT MIN("Population (2010)") FROM table_9083 WHERE "City" = 'taipei'
What is the original air date for the writer tanaka shinichi?
CREATE TABLE table_26591434_1 (original_airdate VARCHAR,writer VARCHAR)
SELECT original_airdate FROM table_26591434_1 WHERE writer = "Tanaka Shinichi"
How many votes were cast when the constituency was midlothian?
CREATE TABLE table_25818630_2 (votes__cast VARCHAR,constituency VARCHAR)
SELECT votes__cast FROM table_25818630_2 WHERE constituency = "Midlothian"
Which Seasonhas a Score of 3 3 aet , 4 3 pen?
CREATE TABLE table_name_52 (season INTEGER,score VARCHAR)
SELECT MAX(season) FROM table_name_52 WHERE score = "3 – 3 aet , 4–3 pen"
What was the tournament for the week of August 4?
CREATE TABLE table_45960 ("Tournament" text,"Surface" text,"Week" text,"Winner and score" text,"Finalist" text,"Semifinalists" text)
SELECT "Tournament" FROM table_45960 WHERE "Week" = 'august 4'
What is the green rating for the vehicle with L/100km urban (cold) over 10.9, mpg in the US (urban) over 14.1, manufacturer of Volkswagen, and engine capacity under 3189?
CREATE TABLE table_name_68 (green_rating VARCHAR,engine_capacity VARCHAR,manufacturer VARCHAR,l_100km_urban__cold_ VARCHAR,mpg_us_urban VARCHAR)
SELECT green_rating FROM table_name_68 WHERE l_100km_urban__cold_ > 10.9 AND mpg_us_urban > 14.1 AND manufacturer = "volkswagen" AND engine_capacity < 3189
Show all account ids and account details.
CREATE TABLE projects (project_id number,project_details text)CREATE TABLE documents (document_id number,document_type_code text,project_id number,document_date time,document_name text,document_description text,other_details text)CREATE TABLE ref_document_types (document_type_code text,document_type_name text,document_...
SELECT account_id, account_details FROM accounts
Which division is the Derbyshire Falcons in?
CREATE TABLE table_name_68 (division VARCHAR,team VARCHAR)
SELECT division FROM table_name_68 WHERE team = "derbyshire falcons"
Name the artist for 1595 televotes
CREATE TABLE table_24322 ("Draw" real,"Song" text,"Artist" text,"Panel Points" real,"Televotes" real,"Televote Points" real,"Score" real,"Placing" text)
SELECT "Artist" FROM table_24322 WHERE "Televotes" = '1595'
What is the title of the 8th doctor published in January 2003?
CREATE TABLE table_name_74 (title VARCHAR,doctor VARCHAR,published VARCHAR)
SELECT title FROM table_name_74 WHERE doctor = "8th" AND published = "january 2003"
What is the PA when the PF is 77?
CREATE TABLE table_72477 ("Locale" text,"Skip" text,"W" real,"L" real,"PF" real,"PA" real,"Ends Won" real,"Ends Lost" real,"Blank Ends" real,"Stolen Ends" real,"Shot Pct." real)
SELECT "PA" FROM table_72477 WHERE "PF" = '77'
Which rank has a total less than 9, less than 2 bronze, and from France?
CREATE TABLE table_name_26 (rank VARCHAR,nation VARCHAR,total VARCHAR,bronze VARCHAR)
SELECT rank FROM table_name_26 WHERE total < 9 AND bronze < 2 AND nation = "france"
What is the branding of the FM 97.7 station owned by the Canadian Broadcasting Corporation?
CREATE TABLE table_name_80 (branding VARCHAR,owner VARCHAR,frequency VARCHAR)
SELECT branding FROM table_name_80 WHERE owner = "canadian broadcasting corporation" AND frequency = "fm 97.7"
What is the Country of the Player with a To par of 4?
CREATE TABLE table_name_72 (country VARCHAR,to_par VARCHAR)
SELECT country FROM table_name_72 WHERE to_par = "–4"
how long was the first duma on rigtists
CREATE TABLE table_204_599 (id number,"party" text,"first duma" text,"second duma" text,"third duma" text,"fourth duma" text)
SELECT "first duma" FROM table_204_599 WHERE "party" = 'rightists'
give me the number of patients whose admission type is elective and drug name is amiodarone?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethni...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND prescriptions.drug = "Amiodarone"
What are the draws when wins are fwewer than 9 and byes fewer than 2?
CREATE TABLE table_name_15 (draws VARCHAR,wins VARCHAR,byes VARCHAR)
SELECT COUNT(draws) FROM table_name_15 WHERE wins < 9 AND byes < 2
on the first intensive care unit visit the sao2 of patient 022-151182 was ever greater than 97.0?
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,hospitalid number,wardid number,admissionheight number,admissionweigh...
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 = '022-151182') AND NOT patient.unitdischargetime IS NULL ORDER BY pati...
What is the location for the office whose term ended December 2, 1976
CREATE TABLE table_1602620_1 (location VARCHAR,term_ended VARCHAR)
SELECT location FROM table_1602620_1 WHERE term_ended = "December 2, 1976"
What was the original air date of a series number after 78, written by Jenee V. Giles?
CREATE TABLE table_11656 ("Series #" real,"Season #" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real)
SELECT "Original air date" FROM table_11656 WHERE "Series #" > '78' AND "Written by" = 'jenee v. giles'
What is the population density of the administrative division with a population in 2010 of 264170 according to the census?
CREATE TABLE table_73336 ("Administrative division" text,"Area (km\u00b2) 2005" text,"Population 2010 Census" real,"Population 2011 SIAK Database" text,"Population density (/km\u00b2 2010)" real)
SELECT "Population density (/km\u00b2 2010)" FROM table_73336 WHERE "Population 2010 Census" = '264170'
What shows for House 1950 with a 1950 less than 1980, and Governors 1950 of governors 1970?
CREATE TABLE table_44778 ("1950" real,"General 1950" text,"Senate 1950" text,"House 1950" text,"Governors 1950" text)
SELECT "House 1950" FROM table_44778 WHERE "1950" < '1980' AND "Governors 1950" = 'governors 1970'
Draw a bar chart for how many sections does each course have?
CREATE TABLE ENROLL (CLASS_CODE varchar(5),STU_NUM int,ENROLL_GRADE varchar(50))CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCHOOL_CODE varchar(8),EMP_NUM int,DEPT_ADDRESS varchar(20),DEPT_EXTENSION varchar(4))CREATE TABLE STUDENT (STU_NUM int,STU_LNAME varchar(15),STU_FNAME varchar(15),STU_INI...
SELECT CRS_CODE, COUNT(*) FROM CLASS GROUP BY CRS_CODE
What is the average latitude and longitude of the starting points of all trips?
CREATE TABLE trip (start_station_id VARCHAR)CREATE TABLE station (lat INTEGER,long INTEGER,id VARCHAR)
SELECT AVG(T1.lat), AVG(T1.long) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id
What position did he finish in 1987?
CREATE TABLE table_73589 ("Year" real,"Starts" real,"Wins" real,"Top 5" real,"Top 10" real,"Poles" real,"Avg. Start" text,"Avg. Finish" text,"Winnings" text,"Position" text,"Team(s)" text)
SELECT "Position" FROM table_73589 WHERE "Year" = '1987'
What is the lowest population (2011) for the community with an Area of 12,241km2 and a Density (inhabitants/km 2) smaller than 21.1?
CREATE TABLE table_8971 ("Name" text,"Seat" text,"Population (2011)" real,"Area (km 2)" real,"Density (inhabitants/km 2)" real)
SELECT MIN("Population (2011)") FROM table_8971 WHERE "Area (km 2 )" = '12,241' AND "Density (inhabitants/km 2 )" < '21.1'
Find the number of ethnically white russian patients born before the year 1846.
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.ethnicity = "WHITE - RUSSIAN" AND demographic.dob_year < "1846"
calculate the average age of male patients who died before 2173.
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,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla...
SELECT AVG(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.dod_year < "2173.0"
What is the status when the against is 11?
CREATE TABLE table_78923 ("Opposing Teams" text,"Against" real,"Date" text,"Venue" text,"Status" text)
SELECT "Status" FROM table_78923 WHERE "Against" = '11'
What's the release date in the 1.1.10 release?
CREATE TABLE table_30590 ("Version" text,"Release" text,"Release date" text,"End of maintenance" text,"Requirement" text)
SELECT "Release date" FROM table_30590 WHERE "Release" = '1.1.10'
had in the first hospital encounter patient 31088's respiratory rate been greater than 23.0?
CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE patients (row_id number,subject_id number,ge...
SELECT COUNT(*) > 0 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 = 31088 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND chartevents.itemid IN (...
How many people came to the game at Victoria Park?
CREATE TABLE table_51468 ("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_51468 WHERE "Venue" = 'victoria park'
New comments on old questions.
CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId number)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount numb...
SELECT Comments.Id AS "comment_link", Comments.Score, Comments.CreationDate AS CommentDate, Posts.CreationDate AS PostDate, DATEDIFF(day, Posts.CreationDate, CreationDate) AS Diff, Comments.Text FROM Comments JOIN Posts ON Comments.PostId = Posts.Id WHERE DATEDIFF(day, Posts.CreationDate, CreationDate) > 365 ORDER BY C...
In how many districts is the incumbent Dave E. Satterfield, Jr.
CREATE TABLE table_1342292_45 (result VARCHAR,incumbent VARCHAR)
SELECT COUNT(result) FROM table_1342292_45 WHERE incumbent = "Dave E. Satterfield, Jr."
What is the greatest rank for Fifth third center?
CREATE TABLE table_71948 ("Rank" real,"Name" text,"Height ft (m)" text,"Floors" real,"Year" real)
SELECT MAX("Rank") FROM table_71948 WHERE "Name" = 'fifth third center'
What was Shaun Murphy's outcome in the Premier League Snooker championship held before 2010?
CREATE TABLE table_78839 ("Outcome" text,"Year" real,"Championship" text,"Opponent in the final" text,"Score" text)
SELECT "Outcome" FROM table_78839 WHERE "Championship" = 'premier league snooker' AND "Year" < '2010'
What are the types of competition and number of competitions for that type?
CREATE TABLE club_rank (rank number,club_id number,gold number,silver number,bronze number,total number)CREATE TABLE club (club_id number,name text,region text,start_year text)CREATE TABLE competition_result (competition_id number,club_id_1 number,club_id_2 number,score text)CREATE TABLE competition (competition_id num...
SELECT competition_type, COUNT(*) FROM competition GROUP BY competition_type
What year was mcmahon stadium founded?
CREATE TABLE table_27599216_6 (founded INTEGER,football_stadium VARCHAR)
SELECT MAX(founded) FROM table_27599216_6 WHERE football_stadium = "McMahon Stadium"
Name the total number of swimsuits when evening gown is 8.329 and average is less than 8.497
CREATE TABLE table_57082 ("State" text,"Interview" real,"Swimsuit" real,"Evening gown" real,"Average" real)
SELECT COUNT("Swimsuit") FROM table_57082 WHERE "Evening gown" = '8.329' AND "Average" < '8.497'
whats the cost to get a metastatic adenocarcinoma - unknown primary diagnosis.
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 diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime ti...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'diagnosis' AND cost.eventid IN (SELECT diagnosis.diagnosisid FROM diagnosis WHERE diagnosis.diagnosisname = 'metastatic adenocarcinoma - unknown primary')
when patient 79919 was prescribed 0.9% sodium chloride first time in 06/last year.
CREATE TABLE d_items (row_id number,itemid number,label text,linksto 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,charttime time)CREATE TABLE microbiologyevents (row_id number,su...
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 79919) AND prescriptions.drug = '0.9% sodium chloride' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') A...
How many were penanced for a total of 7666?
CREATE TABLE table_name_48 (penanced VARCHAR,total VARCHAR)
SELECT penanced FROM table_name_48 WHERE total = "7666"
How many games had 22 goals before 1935?
CREATE TABLE table_77667 ("Debut year" real,"Player" text,"Date of birth" text,"Games" real,"Goals" real,"Years at club" text)
SELECT SUM("Games") FROM table_77667 WHERE "Goals" = '22' AND "Debut year" < '1935'
which team was the opponents of this team the most ?
CREATE TABLE table_203_344 (id number,"#" number,"date" text,"opponent" text,"score" text,"win" text,"loss" text,"save" text,"attendance" number,"record" text,"other info" text)
SELECT "opponent" FROM table_203_344 GROUP BY "opponent" ORDER BY COUNT(*) DESC LIMIT 1
WHich Province of Silla has a Modern equivalent of south jeolla, and a Administrative district of seungju?
CREATE TABLE table_name_33 (province_of_silla VARCHAR,modern_equivalent VARCHAR,administrative_district VARCHAR)
SELECT province_of_silla FROM table_name_33 WHERE modern_equivalent = "south jeolla" AND administrative_district = "seungju"
What is the batting style of Makhaya Ntini?
CREATE TABLE table_57387 ("Player" text,"Date of Birth" text,"Batting Style" text,"Bowling Style" text,"First Class Team" text)
SELECT "Batting Style" FROM table_57387 WHERE "Player" = 'makhaya ntini'
what is the difference in the crowd population on april 22 and april 29 ?
CREATE TABLE table_203_536 (id number,"#" number,"date" text,"opponent" text,"score" text,"win" text,"loss" text,"save" text,"crowd" number,"record" text)
SELECT ABS((SELECT "crowd" FROM table_203_536 WHERE "date" = 'apr 22') - (SELECT "crowd" FROM table_203_536 WHERE "date" = 'apr 29'))
What was the original airdate for 'Something New'?
CREATE TABLE table_2944 ("No. in Series" real,"No. in Season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real,"U.S. viewers (millions)" text)
SELECT "Original air date" FROM table_2944 WHERE "Title" = 'Something New'
Comments containing string1 but not string2, string3, string4.
CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,...
SELECT Id AS "comment_link", Text, UserId AS "user_link", CreationDate FROM Comments WHERE Text LIKE '%##string1?\ve##%' AND NOT (Text LIKE '%##string2?\vec##%') AND NOT (Text LIKE '%##string3?\ver##%') AND NOT (Text LIKE '%##string4?\vee##%') ORDER BY CreationDate DESC
Out of all the upper level classes , what number have labs ?
CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE comment_instructor (instruc...
SELECT COUNT(DISTINCT course.course_id) FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.has_lab = 'Y' AND program_course.category LIKE '%ULCS%'
What company was the constructor when Nick Heidfeld was the driver/
CREATE TABLE table_67302 ("Driver" text,"Constructor" text,"Laps" text,"Time/Retired" text,"Grid" text)
SELECT "Constructor" FROM table_67302 WHERE "Driver" = 'nick heidfeld'
How many different isolation numbers does the Jack Mountain peak have?
CREATE TABLE table_19716903_1 (isolation VARCHAR,mountain_peak VARCHAR)
SELECT COUNT(isolation) FROM table_19716903_1 WHERE mountain_peak = "Jack Mountain"
Even our heroes can fail. If you are upset of a few downwote know that even the biggest can fail too. See the most downvoted answers of the top users
CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number,ApprovalDate time,ApprovalModeratorId number,DeactivationDat...
SELECT p.Id AS "post_link", Score, u.Id AS "user_link" FROM Posts AS p, Users AS u ORDER BY Score LIMIT 10
Which horse was Horse 1 when ren guzm n raced with the mulch n association?
CREATE TABLE table_10579 ("Year" real,"City" text,"Rider 1" text,"Rider 2" text,"Horse 1" text,"Horse 2" text,"Association" text)
SELECT "Horse 1" FROM table_10579 WHERE "Rider 1" = 'rené guzmán' AND "Association" = 'mulchén'
Which venue had a score of 1-1?
CREATE TABLE table_53374 ("Date" text,"Venue" text,"Score" text,"Competition" text,"Turkey scorers" text,"Match report" text)
SELECT "Venue" FROM table_53374 WHERE "Score" = '1-1'
Which Intelli Trace has a No Extension and Windows Phone development of no?
CREATE TABLE table_38390 ("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 "IntelliTrace" FROM table_38390 WHERE "Extensions" = 'no' AND "Windows Phone development" = 'no'
What are the first name and last name of all the instructors?
CREATE TABLE activity (actid number,activity_name text)CREATE TABLE faculty (facid number,lname text,fname text,rank text,sex text,phone number,room text,building text)CREATE TABLE faculty_participates_in (facid number,actid number)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major numbe...
SELECT fname, lname FROM faculty WHERE rank = "Instructor"
Name the goals with since less than 2007 and App(GS/Sub) of 97 (69/28)
CREATE TABLE table_70007 ("Nat." text,"Name" text,"Since" real,"App(GS/Sub)" text,"Goals" real,"Transfer fee" text)
SELECT "Goals" FROM table_70007 WHERE "Since" < '2007' AND "App(GS/Sub)" = '97 (69/28)'
For those records from the products and each product's manufacturer, what is the relationship between code and code , and group by attribute name?
CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)
SELECT T1.Code, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Name
when did patient 9038 last have an intake since 663 days ago?
CREATE TABLE d_icd_diagnoses (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 d_labitems (row_id number,itemid number,label text)CREATE TABLE o...
SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9038)) AND DATETIME(inputevents_cv.charttime) >= DATETIME(CURRENT_TIME(), '-663 day') ORDER ...
tell me the number of private insurance patients who had elective hospital admission.
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethni...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.insurance = "Private"
Number of questions by month between dates.
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,...
SELECT TIME_TO_STR(p.CreationDate, '%Y') + (TIME_TO_STR(p.CreationDate, '%m') - 1) / 12.0 AS ddd, COUNT(*) AS N FROM Posts AS p WHERE TIME_TO_STR(p.CreationDate, '%Y') >= '##startYear?2010##' AND TIME_TO_STR(p.CreationDate, '%Y') <= '##endYear?2015##' GROUP BY TIME_TO_STR(p.CreationDate, '%Y') + (TIME_TO_STR(p.Creation...
Find the number of courses offered by Psychology department in each year with a line chart, could you order by the X-axis from high to low?
CREATE TABLE classroom (building varchar(15),room_number varchar(7),capacity numeric(4,0))CREATE TABLE student (ID varchar(5),name varchar(20),dept_name varchar(20),tot_cred numeric(3,0))CREATE TABLE teaches (ID varchar(5),course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0))CREATE TABLE prereq ...
SELECT year, COUNT(year) FROM course AS T1 JOIN section AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY year DESC
what is the ship types delivered when the total vessels built for usmc is 13 ships for usmc (plus 37 more for usn)?
CREATE TABLE table_56232 ("Yard Name" text,"Location (City,State)" text,"1st Ship Delivery Date" text,"Ship Types Delivered" text,"Total Number of Ways" text,"Total Vessels Built for USMC" text)
SELECT "Ship Types Delivered" FROM table_56232 WHERE "Total Vessels Built for USMC" = '13 ships for usmc (plus 37 more for usn)'
what is the last church located in koreatown ?
CREATE TABLE table_203_274 (id number,"church name" text,"address" text,"community" text,"school" text)
SELECT "church name" FROM table_203_274 WHERE "community" = 'koreatown' ORDER BY id DESC LIMIT 1
What in the series number of the episode written by Lauren Gussis?
CREATE TABLE table_26610 ("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 MIN("No. in series") FROM table_26610 WHERE "Written by" = 'Lauren Gussis'
If the height order is 1 and the soundfield type is mixed-order, what are all the channels?
CREATE TABLE table_73540 ("Horizontal order" real,"Height order" real,"Soundfield type" text,"Number of channels" real,"Channels" text)
SELECT "Channels" FROM table_73540 WHERE "Soundfield type" = 'mixed-order' AND "Height order" = '1'
Show the names and heights of buildings with at least two institutions founded after 1880. Plot them as bar chart.
CREATE TABLE building (building_id text,Name text,Street_address text,Years_as_tallest text,Height_feet int,Floors int)CREATE TABLE protein (common_name text,protein_name text,divergence_from_human_lineage real,accession_number text,sequence_length real,sequence_identity_to_human_protein text,Institution_id text)CREATE...
SELECT Name, Height_feet FROM building AS T1 JOIN Institution AS T2 ON T1.building_id = T2.building_id WHERE T2.Founded > 1880
Java posts with minimum score of 15.
CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TA...
SELECT Title, Body, CreationDate, Id AS "post_link", Tags, Score FROM Posts WHERE PostTypeId IN (1) AND CreationDate > '2020-01-01' AND CreationDate < '2020-12-31' AND Tags LIKE ('%java%') AND Score >= 15 ORDER BY CreationDate DESC
How many episodes were written by Gregg Mettler?
CREATE TABLE table_29436238_1 (no_in_series VARCHAR,written_by VARCHAR)
SELECT COUNT(no_in_series) FROM table_29436238_1 WHERE written_by = "Gregg Mettler"
Top n posters for a given country. Gets the top n poster for a country of your choice
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE Comments (Id number,PostId number,Score number,Te...
SELECT TOP(@TopCount) AS Id, DisplayName, Reputation, LastAccessDate, Age, Location FROM Users WHERE Location LIKE '##COuntry##%' ORDER BY Reputation DESC
i'm requesting flight information on a flight from DENVER to SAN FRANCISCO on wednesday
CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,ground_fare int)CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE restri...
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, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND date_day.day_number = 23 AND date_day.month_number = 4...
Who is the away team that scored 12.17 (89)?
CREATE TABLE table_55570 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Away team" FROM table_55570 WHERE "Away team score" = '12.17 (89)'
Show all product sizes.
CREATE TABLE products (product_id number,parent_product_id number,production_type_code text,unit_price number,product_name text,product_color text,product_size text)CREATE TABLE order_items (order_item_id number,order_id number,product_id number,product_quantity text,other_order_item_details text)CREATE TABLE invoices ...
SELECT DISTINCT product_size FROM products
What country scored 67?
CREATE TABLE table_name_76 (country VARCHAR,score VARCHAR)
SELECT country FROM table_name_76 WHERE score = 67
What was the date of the first match of the Fifa Club World Cup that ended with the final position as winners?
CREATE TABLE table_name_6 (first_match VARCHAR,final_position VARCHAR,competition VARCHAR)
SELECT first_match FROM table_name_6 WHERE final_position = "winners" AND competition = "fifa club world cup"
Which category had a year of 1991?
CREATE TABLE table_name_41 (category VARCHAR,year VARCHAR)
SELECT category FROM table_name_41 WHERE year = 1991
Who is J.E. Armstrong when W.H. Archer is D.M. Lawson?
CREATE TABLE table_1320857_1 (je_armstrong VARCHAR,wh_archer VARCHAR)
SELECT je_armstrong FROM table_1320857_1 WHERE wh_archer = "D.M. Lawson"
Which Nationality has a Former Team of denver nuggets?
CREATE TABLE table_8855 ("Pick" real,"Player" text,"Position" text,"Nationality" text,"Former Team" text)
SELECT "Nationality" FROM table_8855 WHERE "Former Team" = 'denver nuggets'
Show the average price of hotels for different pet policy.
CREATE TABLE HOTELS (pets_allowed_yn VARCHAR,price_range INTEGER)
SELECT pets_allowed_yn, AVG(price_range) FROM HOTELS GROUP BY pets_allowed_yn
Name the location attendance for dirk nowitzki , caron butler (17)
CREATE TABLE table_25854 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Series" text)
SELECT "Location Attendance" FROM table_25854 WHERE "High points" = 'Dirk Nowitzki , Caron Butler (17)'
Find the name and account balance of the customer whose name includes the letter a .
CREATE TABLE customer (cust_name VARCHAR,acc_bal VARCHAR)
SELECT cust_name, acc_bal FROM customer WHERE cust_name LIKE '%a%'
When Gigi Fern ndez Natalia Zvereva 6 2, 6 1 won, who was the Tier II Runner-up?
CREATE TABLE table_43260 ("Week of" text,"Tier" text,"Winner" text,"Runner-up" text,"Semi finalists" text)
SELECT "Runner-up" FROM table_43260 WHERE "Tier" = 'tier ii' AND "Winner" = 'gigi fernández natalia zvereva 6–2, 6–1'
How many games have a score of 85-92?
CREATE TABLE table_76883 ("Game" real,"Date" text,"Opponent" text,"Score" text,"Location" text,"Record" text)
SELECT COUNT("Game") FROM table_76883 WHERE "Score" = '85-92'
What is the least number of gold medals won among nations ranked 1 with no silver medals?
CREATE TABLE table_name_8 (gold INTEGER,rank VARCHAR,silver VARCHAR)
SELECT MIN(gold) FROM table_name_8 WHERE rank = 1 AND silver < 1
what are the four most frequent drugs that were prescribed in the same month to the patients aged 20s after they had been diagnosed with atrial fibrillation in this year?
CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE d_labitems ...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 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 ...
Will 351 be taught by Prof. Jonathan Brumit next semester ?
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 COUNT(*) > 0 FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 351 AND instructor.name LIKE '%Jonathan Brumit%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering...
what is average age of patients whose insurance is private and days of hospital stay is 7?
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 AVG(demographic.age) FROM demographic WHERE demographic.insurance = "Private" AND demographic.days_stay = "7"
What was the class when part 2 was *h t?
CREATE TABLE table_name_61 (class VARCHAR,part_2 VARCHAR)
SELECT class FROM table_name_61 WHERE part_2 = "*hēt"
Which Game has a Score of 101-109 (ot)?
CREATE TABLE table_name_28 (game INTEGER,score VARCHAR)
SELECT AVG(game) FROM table_name_28 WHERE score = "101-109 (ot)"
what is date of birth of subject name shawn green?
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)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marita...
SELECT demographic.dob FROM demographic WHERE demographic.name = "Shawn Green"
What is Name, when Best is 1:15.673?
CREATE TABLE table_49036 ("Name" text,"Team" text,"Qual 1" text,"Qual 2" text,"Best" text)
SELECT "Name" FROM table_49036 WHERE "Best" = '1:15.673'
Show all student IDs with more than total 10 hours per week on all sports played.
CREATE TABLE Sportsinfo (StuID VARCHAR,hoursperweek INTEGER)
SELECT StuID FROM Sportsinfo GROUP BY StuID HAVING SUM(hoursperweek) > 10
Which courses am I required to take prior to UC 325 ?
CREATE TABLE area (course_id int,area varchar)CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE jobs (job_id int,job_title varchar,description varchar,requirement varchar,city varchar,state varchar,country varchar,zip int)CREATE TABLE program (program_id int,name varchar,college varc...
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT...
What is the 2002 result where 2011 and 2000 are 1R?
CREATE TABLE table_62071 ("Tournament" text,"2000" text,"2001" text,"2002" text,"2003" text,"2004" text,"2005" text,"2006" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text)
SELECT "2002" FROM table_62071 WHERE "2011" = '1r' AND "2000" = '1r'