instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
what flights are available from DENVER to PHILADELPHIA with stopover in PITTSBURGH
CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,length int,weight int,capacity int,pay_load int,cruising_speed int,range_m...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND CITY...
What is the rating of episode 1.04?
CREATE TABLE table_30447 ("Episode" text,"Date Aired" text,"Timeslot" text,"Rating" text,"Nightly Rank" real,"Weekly Rank" text)
SELECT "Rating" FROM table_30447 WHERE "Episode" = '1.04'
What is the average rank of the city of el paso, which has a population greater than 672,538?
CREATE TABLE table_name_69 (rank INTEGER,city VARCHAR,population VARCHAR)
SELECT AVG(rank) FROM table_name_69 WHERE city = "el paso" AND population > 672 OFFSET 538
Find the number of the names of stadiums that some Australian swimmers have been to, I want to show by the y-axis from high to low.
CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time ...
SELECT T4.Name, COUNT(T4.Name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID JOIN event AS t3 ON t2.Event_ID = t3.ID JOIN stadium AS t4 ON t4.ID = t3.Stadium_ID WHERE t1.Nationality = 'Australia' GROUP BY T4.Name ORDER BY COUNT(T4.Name) DESC
How many poles in the year 2000
CREATE TABLE table_22581 ("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 MAX("Poles") FROM table_22581 WHERE "Year" = '2000'
Which state's delegate is from Lexington, Ky and is 5'4' tall?
CREATE TABLE table_15726 ("State" text,"Name" text,"Hometown" text,"Age 1" real,"Height" text)
SELECT "State" FROM table_15726 WHERE "Height" = '5''4' AND "Hometown" = 'lexington, ky'
Draw a bar chart about the distribution of All_Home and Team_ID , and group by attribute ACC_Road, and could you rank by the Y in asc?
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_Home, Team_ID FROM basketball_match GROUP BY ACC_Road, All_Home ORDER BY Team_ID
What surface did hayley ericksen play on?
CREATE TABLE table_45056 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Partner" text,"Opponents in the final" text,"Score" text)
SELECT "Surface" FROM table_45056 WHERE "Partner" = 'hayley ericksen'
Who was the successor that was formally installed on March 30, 1870?
CREATE TABLE table_26647 ("State (class)" text,"Vacator" text,"Reason for change" text,"Successor" text,"Date of successors formal installation" text)
SELECT "Successor" FROM table_26647 WHERE "Date of successors formal installation" = 'March 30, 1870'
What is listed in eliminated when the finish is 15th voted out 9th jury Member Day 46?
CREATE TABLE table_28742659_2 (eliminated VARCHAR,finish VARCHAR)
SELECT eliminated FROM table_28742659_2 WHERE finish = "15th voted Out 9th Jury Member Day 46"
Who did Clinton appoint as a Chief Judge?
CREATE TABLE table_name_2 (chief_judge VARCHAR,appointed_by VARCHAR)
SELECT chief_judge FROM table_name_2 WHERE appointed_by = "clinton"
What is the title rank of the actor who played the character of arthur hastings during series 1-8, 13?
CREATE TABLE table_name_24 (title_rank VARCHAR,series VARCHAR,character VARCHAR)
SELECT title_rank FROM table_name_24 WHERE series = "1-8, 13" AND character = "arthur hastings"
List the name of physicians who took some appointment, and count them by a bar chart, sort Y-axis in ascending order.
CREATE TABLE On_Call (Nurse INTEGER,BlockFloor INTEGER,BlockCode INTEGER,OnCallStart DATETIME,OnCallEnd DATETIME)CREATE TABLE Physician (EmployeeID INTEGER,Name VARCHAR(30),Position VARCHAR(30),SSN INTEGER)CREATE TABLE Undergoes (Patient INTEGER,Procedures INTEGER,Stay INTEGER,DateUndergoes DATETIME,Physician INTEGER,A...
SELECT Name, COUNT(Name) FROM Appointment AS T1 JOIN Physician AS T2 ON T1.Physician = T2.EmployeeID GROUP BY Name ORDER BY COUNT(Name)
What are the record(s) for the team with a winning percentage of .464?
CREATE TABLE table_15313204_1 (records VARCHAR,pct VARCHAR)
SELECT records FROM table_15313204_1 WHERE pct = ".464"
what's the result with candidates being billy tauzin (d) unopposed
CREATE TABLE table_18257 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "Result" FROM table_18257 WHERE "Candidates" = 'Billy Tauzin (D) Unopposed'
provide the number of patients 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 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...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Syncope and collapse"
what's the results of week 12?
CREATE TABLE table_name_57 (result VARCHAR,week VARCHAR)
SELECT result FROM table_name_57 WHERE week = 12
What is the nationality of the player who played guard in 2006?
CREATE TABLE table_name_85 (nationality VARCHAR,position_s_ VARCHAR,season_s_ VARCHAR)
SELECT nationality FROM table_name_85 WHERE position_s_ = "guard" AND season_s_ = "2006"
How many tariff codes have a bts retail price of 2.553p/min?
CREATE TABLE table_10408617_5 (tariff_code VARCHAR,bts_retail_price__regulated_ VARCHAR)
SELECT COUNT(tariff_code) FROM table_10408617_5 WHERE bts_retail_price__regulated_ = "2.553p/min"
How many kids go to Brechin High School?
CREATE TABLE table_21563298_1 (roll INTEGER,school VARCHAR)
SELECT MAX(roll) FROM table_21563298_1 WHERE school = "Brechin High school"
when did patient 016-12011 last take an intake on 12/31/last year?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,cellla...
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-12011')) AND intakeoutput.cellpath LIKE '%intake%...
which was scuttled earlier , ha-206 or ha-208 ?
CREATE TABLE table_204_522 (id number,"boat #" text,"name" text,"builder" text,"laid down" text,"launched" text,"completed" text,"fate" text)
SELECT "name" FROM table_204_522 WHERE "name" IN ('ha-206', 'ha-208') ORDER BY "launched" LIMIT 1
What is the average FA cup that has a league of 0, fahmi hatta as the player, with a Malaysia cup less than 0?
CREATE TABLE table_name_56 (fa_cup INTEGER,malaysia_cup VARCHAR,league VARCHAR,player VARCHAR)
SELECT AVG(fa_cup) FROM table_name_56 WHERE league = 0 AND player = "fahmi hatta" AND malaysia_cup < 0
WHAT WAS THE OVERALL NUMBER WITH A POSITON OF DB, AND ROUND GREATER THAN 8?
CREATE TABLE table_name_27 (overall VARCHAR,position VARCHAR,round VARCHAR)
SELECT COUNT(overall) FROM table_name_27 WHERE position = "db" AND round > 8
What is the air date of the episode written by Itamar Moses?
CREATE TABLE table_25356350_3 (original_air_date VARCHAR,written_by VARCHAR)
SELECT original_air_date FROM table_25356350_3 WHERE written_by = "Itamar Moses"
What is the total number of top fives when casey mears had more than 1 poles and top tens less than 9?
CREATE TABLE table_name_54 (top_fives INTEGER,poles VARCHAR,top_tens VARCHAR)
SELECT SUM(top_fives) FROM table_name_54 WHERE poles > 1 AND top_tens < 9
What are the phone numbers for each employee, and count them by a bar chart, and sort in descending by the names.
CREATE TABLE Employee (EmployeeId integer,LastName varchar(20),FirstName varchar(20),Title varchar(30),ReportsTo integer,BirthDate datetime,HireDate datetime,Address varchar(70),City varchar(40),State varchar(40),Country varchar(40),PostalCode varchar(10),Phone varchar(24),Fax varchar(24),Email varchar(60))CREATE TABLE...
SELECT Phone, COUNT(Phone) FROM Employee GROUP BY Phone ORDER BY Phone DESC
Highest ranked SO users from Armenia.
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 ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE (LOWER(Location) LIKE '%yerevan%' OR LOWER(Location) LIKE '%armenia%') ORDER BY Reputation DESC
What is City of License, when Frequency is 101.1?
CREATE TABLE table_name_20 (city_of_license VARCHAR,frequency VARCHAR)
SELECT city_of_license FROM table_name_20 WHERE frequency = "101.1"
give me the number of patients whose diagnoses short title is pseudomonas infect nos?
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 diagnoses.short_title = "Pseudomonas infect NOS"
Which College has a Name of hardy brown?
CREATE TABLE table_44009 ("Round" real,"Pick" real,"Name" text,"Position" text,"College" text,"AAFC Team" text)
SELECT "College" FROM table_44009 WHERE "Name" = 'hardy brown'
what were the top five most frequent diagnoses among the patients in the age 30s in 2104?
CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE cost (row_id numbe...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN...
What country has the most height in the northwestern peak of rysy?
CREATE TABLE table_24285393_1 (country_or_region VARCHAR,highest_point VARCHAR)
SELECT country_or_region FROM table_24285393_1 WHERE highest_point = "Northwestern peak of Rysy"
what's the tournament where winner is raymond floyd (1)
CREATE TABLE table_11622255_1 (tournament VARCHAR,winner VARCHAR)
SELECT tournament FROM table_11622255_1 WHERE winner = "Raymond Floyd (1)"
What date was Montreal the visitor?
CREATE TABLE table_39131 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Record" text)
SELECT "Date" FROM table_39131 WHERE "Visitor" = 'montreal'
Name the most lead margin for republican joe kenney being 23%
CREATE TABLE table_21789 ("Poll Source" text,"Dates administered" text,"Democrat: John Lynch" text,"Republican: Joe Kenney" text,"Lead Margin" real)
SELECT MAX("Lead Margin") FROM table_21789 WHERE "Republican: Joe Kenney" = '23%'
what were the five most commonly prescribed drugs at the same time in this year for patients who were prescribed famotidine (pf) 20 mg/2 ml iv soln?
CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,dischargeweight number,hospitaladmittime time,hospitaladmitsource text,unitadmittime time,unitdischargetime tim...
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 = 'famotidine (pf) 20 mg/2 ml iv soln' AND DATETIME(me...
What is the lowest number of bronze medals for a country with less than 1 gold and 0 silver?
CREATE TABLE table_name_70 (bronze INTEGER,gold VARCHAR,silver VARCHAR)
SELECT MIN(bronze) FROM table_name_70 WHERE gold = 1 AND silver < 0
what is basikal when mana is mano, pergi is gi and Ikut is turuk?
CREATE TABLE table_name_53 (basikal VARCHAR,ikut VARCHAR,mana VARCHAR,pergi VARCHAR)
SELECT basikal FROM table_name_53 WHERE mana = "mano" AND pergi = "gi" AND ikut = "turuk"
What Leading scorer had a Score of 80 112?
CREATE TABLE table_41959 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Leading scorer" text,"Record" text)
SELECT "Leading scorer" FROM table_41959 WHERE "Score" = '80–112'
what test was given to patient 10855 the first time this month?
CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod 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 ...
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT labevents.itemid FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10855) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month...
Which district elected incumbent Earle Cabell?
CREATE TABLE table_18380 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "District" FROM table_18380 WHERE "Incumbent" = 'Earle Cabell'
When did the Indians play a game with a record of 28-41?
CREATE TABLE table_name_66 (date VARCHAR,record VARCHAR)
SELECT date FROM table_name_66 WHERE record = "28-41"
What was relegated in the 2nd division of middlesex?
CREATE TABLE table_78380 ("Season" text,"1st Division" text,"Relegated" text,"2nd Division" text,"Promoted" text)
SELECT "Relegated" FROM table_78380 WHERE "2nd Division" = 'middlesex'
What is the decision of the game on January 13?
CREATE TABLE table_77029 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Record" text)
SELECT "Decision" FROM table_77029 WHERE "Date" = 'january 13'
WHat kind of 2009 season has a City of panama city, and a Group of group b?
CREATE TABLE table_name_21 (city VARCHAR,group VARCHAR)
SELECT 2009 AS _season FROM table_name_21 WHERE city = "panama city" AND group = "group b"
How many hosts does each nationality have? List the nationality and the count with a bar chart, display by the Y in ascending.
CREATE TABLE party_host (Party_ID int,Host_ID int,Is_Main_in_Charge bool)CREATE TABLE party (Party_ID int,Party_Theme text,Location text,First_year text,Last_year text,Number_of_hosts int)CREATE TABLE host (Host_ID int,Name text,Nationality text,Age text)
SELECT Nationality, COUNT(*) FROM host GROUP BY Nationality ORDER BY COUNT(*)
find tags with tag dot tag not dot.
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 PostTypes (Id number,Name text)CREATE TABLE Tags (Id number,Tag...
SELECT t.TagName, t2.TagName FROM Tags AS t, Tags AS t2 WHERE t.TagName = REPLACE(t2.TagName, '.', '') AND t.Id != t2.Id
Can you tell the Lost that has the Try BP of 10, and the Club of uwic rfc?
CREATE TABLE table_name_50 (lost VARCHAR,try_bp VARCHAR,club VARCHAR)
SELECT lost FROM table_name_50 WHERE try_bp = "10" AND club = "uwic rfc"
What team owns the Venue of western oval?
CREATE TABLE table_56033 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Home team" FROM table_56033 WHERE "Venue" = 'western oval'
tell me the percentile of the sodium value of 136.0 among patients of the same age as patient 012-4131 in their first hospital encounter?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature ...
SELECT DISTINCT t1.c1 FROM (SELECT lab.labresult, PERCENT_RANK() OVER (ORDER BY lab.labresult) AS c1 FROM lab WHERE lab.labname = 'sodium' AND lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age = (SELECT patient.age FROM patient WHERE patient.uniquepid = '012-4131' AND NOT patient...
What is the type for a vessel of lublin class?
CREATE TABLE table_65334 ("Vessel" text,"Origin" text,"Type" text,"In service" real,"Unit" text)
SELECT "Type" FROM table_65334 WHERE "Vessel" = 'lublin class'
What is the highest number of losses for teams with under 3 draws and 51 points?
CREATE TABLE table_6815 ("Position" real,"Club" text,"Games played" real,"Wins" real,"Draws" real,"Loses" real,"Goals scored" real,"Goals conceded" real,"Points" real)
SELECT MAX("Loses") FROM table_6815 WHERE "Draws" < '3' AND "Points" = '51'
has patient 028-42654 had a lab test until 54 months ago.
CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,cul...
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 = '028-42654')) AND DATETIME(lab.labresulttime) <= DATETIME(CURRENT_TIME(), '-54 month')
Which Total matches is the highest one that has Points % of 70%?
CREATE TABLE table_5979 ("Year" text,"Total matches" real,"Total W-L-H" text,"Singles W-L-H" text,"Points won" real,"Points %" text)
SELECT MAX("Total matches") FROM table_5979 WHERE "Points %" = '70%'
What are the top 10 tags associated with posts created in 2017?.
CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE Tags (Id number,TagName text,Count number,Excer...
SELECT Tags.TagName, Tags.Count FROM Tags WHERE Tags.Id IN (SELECT PostTags.TagId FROM PostTags WHERE PostTags.PostId IN (SELECT Posts.Id FROM Posts WHERE YEAR(Posts.CreationDate) = 2017)) ORDER BY (Tags.Count) DESC LIMIT 10
count the number of people that died after being diagnosed with ac dvt/emb prox low ext in the same month until 2102.
CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_items (row...
SELECT COUNT(DISTINCT t2.subject_id) FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_di...
What is every number for the hometown of Canton, Illinois?
CREATE TABLE table_25376 ("No." real,"Player" text,"Hometown" text,"Class" text,"Position" text,"Height" text,"Weight" real)
SELECT "No." FROM table_25376 WHERE "Hometown" = 'Canton, Illinois'
What was the capacity for the Denver Broncos?
CREATE TABLE table_74335 ("Team" text,"Stadium" text,"Home Games" real,"Average Attendance" real,"Total Attendance" real,"Capacity Percentage" text)
SELECT "Capacity Percentage" FROM table_74335 WHERE "Team" = 'Denver Broncos'
what was the number of patients who had a tobramycin - random lab test since 2103?
CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,dischargeweight number,hospitaladmittime time,hospitaladmitsource text,unitadmittime time,unitdischargetime tim...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT lab.patientunitstayid FROM lab WHERE lab.labname = 'tobramycin - random' AND STRFTIME('%y', lab.labresulttime) >= '2103')
how many patients of asian ethnicity are admitted before the year 2110?
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 WHERE demographic.ethnicity = "ASIAN" AND demographic.admityear < "2110"
What kind of decor has the least number of reservations?
CREATE TABLE reservations (code number,room text,checkin text,checkout text,rate number,lastname text,firstname text,adults number,kids number)CREATE TABLE rooms (roomid text,roomname text,beds number,bedtype text,maxoccupancy number,baseprice number,decor text)
SELECT T2.decor FROM reservations AS T1 JOIN rooms AS T2 ON T1.room = T2.roomid GROUP BY T2.decor ORDER BY COUNT(T2.decor) LIMIT 1
What date was the competition of the Emerging Nations Tournament and a result of Scotland 34-9 Russia?
CREATE TABLE table_62449 ("Date" text,"Result" text,"Competition" text,"Venue" text,"Attendance" real)
SELECT "Date" FROM table_62449 WHERE "Competition" = 'emerging nations tournament' AND "Result" = 'scotland 34-9 russia'
Which Assist/pass has a Goal of 5?
CREATE TABLE table_name_31 (assist_pass VARCHAR,goal VARCHAR)
SELECT assist_pass FROM table_name_31 WHERE goal = "5"
Who was the away team when the home team scored 9.16 (70)?
CREATE TABLE table_33070 ("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_33070 WHERE "Home team score" = '9.16 (70)'
On what date was the venue of Glenferrie Oval?
CREATE TABLE table_name_12 (date VARCHAR,venue VARCHAR)
SELECT date FROM table_name_12 WHERE venue = "glenferrie oval"
On what date was the gte north classic tournament?
CREATE TABLE table_57036 ("Date" text,"Tournament" text,"Location" text,"Purse($)" real,"Winner" text,"Score" text,"1st Prize($)" real)
SELECT "Date" FROM table_57036 WHERE "Tournament" = 'gte north classic'
A bar chart shows the distribution of other_details and the average of monthly_rental , and group by attribute other_details.
CREATE TABLE Students (student_id INTEGER,address_id INTEGER,first_name VARCHAR(80),middle_name VARCHAR(40),last_name VARCHAR(40),cell_mobile_number VARCHAR(40),email_address VARCHAR(40),date_first_rental DATETIME,date_left_university DATETIME,other_student_details VARCHAR(255))CREATE TABLE Teachers (teacher_id INTEGER...
SELECT other_details, AVG(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
What is the long value for the year with an average/game of 160.9?
CREATE TABLE table_48145 ("Season" text,"GP\u2013GS" text,"Comp\u2013Att" text,"Pct." text,"Yards" text,"Long" text,"Avg/G" text)
SELECT "Long" FROM table_48145 WHERE "Avg/G" = '160.9'
What is the fewest number of attendees at Kardinia Park?
CREATE TABLE table_10166 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT MIN("Crowd") FROM table_10166 WHERE "Venue" = 'kardinia park'
What is Block A when Prince Devitt is Devitt (9:53)?
CREATE TABLE table_name_49 (block_a VARCHAR,prince_devitt VARCHAR)
SELECT block_a FROM table_name_49 WHERE prince_devitt = "devitt (9:53)"
Who directed the title that was written by Adam Milch?
CREATE TABLE table_12419515_4 (directed_by VARCHAR,written_by VARCHAR)
SELECT directed_by FROM table_12419515_4 WHERE written_by = "Adam Milch"
give me the number of patients whose admission year is less than 2200 and drug route is pr?
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 lab (subject_id text,hadm_id text,itemid text,charttime tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2200" AND prescriptions.route = "PR"
how much does a drug called glucagen cost.
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean num...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'glucagen')
When did Motherwell win?
CREATE TABLE table_name_15 (date VARCHAR,winners VARCHAR)
SELECT date FROM table_name_15 WHERE winners = "motherwell"
how many total women were victims ?
CREATE TABLE table_204_693 (id number,"place" text,"total" number,"men" number,"women" number,"children" number,"elderly" number,"serbs" number,"jews" number,"romani" number,"rusyns" number,"hungarians" number,"russians" number)
SELECT SUM("women") FROM table_204_693
What is the fewest number of golds for teams with a total of 3 and fewer than 2 silvers?
CREATE TABLE table_64135 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MIN("Gold") FROM table_64135 WHERE "Total" = '3' AND "Silver" < '2'
what year did the champions have a 3-0 record before 1983 ?
CREATE TABLE table_204_110 (id number,"year" number,"champion" text,"city" text,"llws" text,"record" text)
SELECT "year" FROM table_204_110 WHERE "record" = '3-0' AND "year" < 1983
provide the age and religion of subject id 65652.
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t...
SELECT demographic.age, demographic.religion FROM demographic WHERE demographic.subject_id = "65652"
What Report is on June 3, 2000?
CREATE TABLE table_64999 ("Date" text,"Venue" text,"Score" text,"Comp" text,"Report" text)
SELECT "Report" FROM table_64999 WHERE "Date" = 'june 3, 2000'
WHAT EPISODE HAS A REGION NUMBER BIGGER THAN 1, AND 32 DVDS?
CREATE TABLE table_name_58 (episode_no VARCHAR,region_no VARCHAR,no_of_dvds VARCHAR)
SELECT episode_no FROM table_name_58 WHERE region_no > 1 AND no_of_dvds = "32"
Average quality of answers by users. Average votes of answers for users with at least MinAnswers answers
CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score ...
SELECT ROUND(CAST(Votes AS FLOAT) / Posts, 2) AS "votes", ROUND(CAST(Upvotes AS FLOAT) / Posts, 2) AS "upvotes", ROUND(CAST(Downvotes AS FLOAT) / Posts, 2) AS "downvotes", ROUND(CAST(Upvotes AS FLOAT) / Downvotes, 2) AS "up/down_ratio" FROM (SELECT COUNT(DISTINCT v.PostId) AS "posts", COUNT(*) AS "votes", COUNT(CASE v....
What is Final, when Team is United States (USA) USA I?
CREATE TABLE table_name_66 (final VARCHAR,team VARCHAR)
SELECT final FROM table_name_66 WHERE team = "united states (usa) usa i"
Who were the candidates when Shirley Chisholm was the incumbent?
CREATE TABLE table_18329 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "Candidates" FROM table_18329 WHERE "Incumbent" = 'Shirley Chisholm'
What position did Pranita Sahu's team get?
CREATE TABLE table_18278508_2 (position VARCHAR,co_contestant__yaar_vs_pyaar_ VARCHAR)
SELECT position FROM table_18278508_2 WHERE co_contestant__yaar_vs_pyaar_ = "Pranita Sahu"
Tell me the result for attendance of 54,462
CREATE TABLE table_31768 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" text)
SELECT "Result" FROM table_31768 WHERE "Attendance" = '54,462'
how many of the patients with intraoperative cardiac pacemaker had clinical chemistry lab tests?
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 INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Intraoperative cardiac pacemaker" AND lab."CATEGORY" = "Chemistry"
and flights leaving from ATLANTA to OAKLAND leaving after 1700
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 flight_stop (flight_id int,stop_number int,stop_days text,stop_airport text,arrival_time int,arrival_airline text,arrival_flig...
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 = 'OAKLAND' AND flight.departure_time > 1700 AND flight.to_airport = AIRPORT_SERVICE_1.airpo...
Show different teams in eliminations and the number of eliminations from each team Visualize by bar chart, and order by the the total number from high to low please.
CREATE TABLE wrestler (Wrestler_ID int,Name text,Reign text,Days_held text,Location text,Event text)CREATE TABLE Elimination (Elimination_ID text,Wrestler_ID text,Team text,Eliminated_By text,Elimination_Move text,Time text)
SELECT Team, COUNT(*) FROM Elimination GROUP BY Team ORDER BY COUNT(*) DESC
subject is a male or female between the ages of 50 and 80 with a body mass index ( bmi ) below 31 . female must be post _ menopausal at least 1 year or surgically sterilized.
CREATE TABLE table_train_84 ("id" int,"gender" string,"mini_mental_state_examination_mmse" int,"modified_hachinski_ischemia_scale" int,"post_menopausal" bool,"allergy_to_rifaximin" bool,"surgically_sterilized" bool,"body_mass_index_bmi" float,"age" float,"NOUSE" float)
SELECT * FROM table_train_84 WHERE (gender = 'male' OR (gender = 'female' AND (post_menopausal >= 1 OR surgically_sterilized = 1))) AND (age >= 50 AND age <= 80) AND body_mass_index_bmi < 31
What year has 2 wins?
CREATE TABLE table_name_59 (year VARCHAR,wins VARCHAR)
SELECT year FROM table_name_59 WHERE wins = "2"
Find the id of the order which is shipped most recently.
CREATE TABLE products (product_id number,product_name text,product_details text)CREATE TABLE shipments (shipment_id number,order_id number,invoice_number number,shipment_tracking_number text,shipment_date time,other_shipment_details text)CREATE TABLE orders (order_id number,customer_id number,order_status text,date_ord...
SELECT order_id FROM shipments WHERE shipment_date = (SELECT MAX(shipment_date) FROM shipments)
What is richmond's score as the home team?
CREATE TABLE table_name_93 (home_team VARCHAR)
SELECT home_team AS score FROM table_name_93 WHERE home_team = "richmond"
How many points are in the scored category for the team that played less than 18 games?
CREATE TABLE table_14006 ("Position" real,"Team" text,"Played" real,"Wins" real,"Draws" real,"Losses" real,"Scored" real,"Conceded" real,"Points" real)
SELECT SUM("Scored") FROM table_14006 WHERE "Played" < '18'
In Week 7, what is the highest attendance number?
CREATE TABLE table_43426 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real)
SELECT MAX("Attendance") FROM table_43426 WHERE "Week" = '7'
Which Attendance has a Game smaller than 3, and a Date of october 31?
CREATE TABLE table_name_49 (attendance VARCHAR,game VARCHAR,date VARCHAR)
SELECT COUNT(attendance) FROM table_name_49 WHERE game < 3 AND date = "october 31"
Bin all date of transactions into the weekday interval, and compute the average of the share count for each bin Return the result using a bar chart, and show by the Y in descending.
CREATE TABLE Ref_Transaction_Types (transaction_type_code VARCHAR(10),transaction_type_description VARCHAR(80))CREATE TABLE Transactions_Lots (transaction_id INTEGER,lot_id INTEGER)CREATE TABLE Purchases (purchase_transaction_id INTEGER,purchase_details VARCHAR(255))CREATE TABLE Lots (lot_id INTEGER,investor_id INTEGER...
SELECT date_of_transaction, AVG(share_count) FROM Transactions ORDER BY AVG(share_count) DESC
What place does Fred Funk, who has a score of 69-69=138, have?
CREATE TABLE table_name_71 (place VARCHAR,player VARCHAR,score VARCHAR)
SELECT place FROM table_name_71 WHERE score = 69 - 69 = 138 AND player = "fred funk"
What circuit had 16 rounds?
CREATE TABLE table_name_79 (circuit VARCHAR,round VARCHAR)
SELECT circuit FROM table_name_79 WHERE round = 16
What After debt has raised 3Q of $5,358,585?
CREATE TABLE table_56216 ("Candidate" text,"Money Raised,3Q" text,"Loans Received,3Q" text,"Money Spent,3Q" text,"Total Receipts" text,"Cash On Hand" text,"After Debt" text)
SELECT "After Debt" FROM table_56216 WHERE "Money Raised, 3Q" = '$5,358,585'