instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
What is the status of incumbent Charles Stenholm?
CREATE TABLE table_18223 ("District" text,"Incumbent" text,"Party" text,"Elected" real,"Status" text,"Opponent" text)
SELECT "Status" FROM table_18223 WHERE "Incumbent" = 'Charles Stenholm'
what is the crude birth rate (per 1000) when the natural change (per 1000) is more than 31.6 and the average population (x1000) is less than 1,802?
CREATE TABLE table_11430 ("Average population (x 1000)" real,"Live births" real,"Deaths" text,"Natural change" real,"Crude birth rate (per 1000)" real,"Crude death rate (per 1000)" real,"Natural change (per 1000)" real)
SELECT SUM("Crude birth rate (per 1000)") FROM table_11430 WHERE "Natural change (per 1000)" > '31.6' AND "Average population (x 1000)" < '1,802'
give me the number of patients whose marital status is widowed and lab test fluid is pleural?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "WIDOWED" AND lab.fluid = "Pleural"
What is the title of the representative appointed by James K. Polk?
CREATE TABLE table_name_52 (title VARCHAR,appointed_by VARCHAR)
SELECT title FROM table_name_52 WHERE appointed_by = "james k. polk"
What is the highest Silver, when Gold is '8', and when Total is greater than 31?
CREATE TABLE table_name_61 (silver INTEGER,gold VARCHAR,total VARCHAR)
SELECT MAX(silver) FROM table_name_61 WHERE gold = 8 AND total > 31
Which player is from Tampa, Florida?
CREATE TABLE table_78126 ("Player" text,"Position" text,"School" text,"Hometown" text,"College" text)
SELECT "Player" FROM table_78126 WHERE "Hometown" = 'tampa, florida'
Which candidate won 88 votes in Queens in 1921?
CREATE TABLE table_1108394_47 (queens VARCHAR)
SELECT 1921 FROM table_1108394_47 WHERE queens = "88"
what city has the results of 4:2?
CREATE TABLE table_name_41 (city VARCHAR,results¹ VARCHAR)
SELECT city FROM table_name_41 WHERE results¹ = "4:2"
Which permanent account has registration of invite-only and userpics free of unknown?
CREATE TABLE table_50559 ("Name" text,"Year Began" text,"Registration" text,"Userpics Free" text,"Userpics Paid" text,"Monthly Cost for Paid Account" text,"Yearly Cost for Paid Account" text,"Permanent Account" text)
SELECT "Permanent Account" FROM table_50559 WHERE "Userpics Free" = 'unknown' AND "Registration" = 'invite-only'
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of hire_date and the average of manager_id bin hire_date by time in a bar chart, and order by the y axis in ascending.
CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE loc...
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(MANAGER_ID)
With a previous number of 68165, what is the oldest converted date?
CREATE TABLE table_62796 ("Number" text,"Previous Number(s)" real,"Previous Class" text,"Converted" real,"Withdrawn" real,"Disposal" text)
SELECT MAX("Converted") FROM table_62796 WHERE "Previous Number(s)" = '68165'
what were the three most frequently ordered lab tests for patients who had previously received pulmonary artery catheter placement during the same month, since 2103?
CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,ce...
SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'pulmonary artery catheter placement' AND STRFTIME('%...
What was the score on June 28, 2009?
CREATE TABLE table_name_56 (score VARCHAR,date VARCHAR)
SELECT score FROM table_name_56 WHERE date = "june 28, 2009"
Find the number of papers published by the institution 'University of Pennsylvania'.
CREATE TABLE authorship (authid number,instid number,paperid number,authorder number)CREATE TABLE authors (authid number,lname text,fname text)CREATE TABLE papers (paperid number,title text)CREATE TABLE inst (instid number,name text,country text)
SELECT COUNT(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Pennsylvania"
What is the ratio of Republicans to Democrats in South Carolina?
CREATE TABLE table_67119 ("State ranked in partisan order" text,"Percentage Republicans" text,"Percentage Democrats" text,"Republican/ Democratic" text,"Republican seat plurality" text)
SELECT "Republican/ Democratic" FROM table_67119 WHERE "State ranked in partisan order" = 'south carolina'
Which championship had a Circuit of le mans?
CREATE TABLE table_8624 ("Discipline" text,"Championship" text,"Circuit" text,"Session" text,"Cause" text)
SELECT "Championship" FROM table_8624 WHERE "Circuit" = 'le mans'
What College/junior/club team (league) did mitch fadden play for?
CREATE TABLE table_name_14 (college_junior_club_team__league_ VARCHAR,player VARCHAR)
SELECT college_junior_club_team__league_ FROM table_name_14 WHERE player = "mitch fadden"
What is the Score with an Opponent that is flavia pennetta?
CREATE TABLE table_name_55 (score VARCHAR,opponent VARCHAR)
SELECT score FROM table_name_55 WHERE opponent = "flavia pennetta"
what is the tries fow when losing bonus is losing bonus?
CREATE TABLE table_name_47 (tries_for VARCHAR,losing_bonus VARCHAR)
SELECT tries_for FROM table_name_47 WHERE losing_bonus = "losing bonus"
What is the sum of number with type 0-4-4 forney locomotive, number smaller than 20 and works number of 1251?
CREATE TABLE table_46571 ("Number" real,"Builder" text,"Type" text,"Date" real,"Works number" real)
SELECT COUNT("Date") FROM table_46571 WHERE "Type" = '0-4-4 forney locomotive' AND "Number" < '20' AND "Works number" = '1251'
what is lab test category of subject id 6983?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id tex...
SELECT lab."CATEGORY" FROM lab WHERE lab.subject_id = "6983"
Return a histogram on what is the name of each course and the corresponding number of student enrollment?, could you list in desc by the x axis?
CREATE TABLE Student_Course_Enrolment (registration_id INTEGER,student_id INTEGER,course_id INTEGER,date_of_enrolment DATETIME,date_of_completion DATETIME)CREATE TABLE Course_Authors_and_Tutors (author_id INTEGER,author_tutor_ATB VARCHAR(3),login_name VARCHAR(40),password VARCHAR(40),personal_name VARCHAR(80),middle_na...
SELECT course_name, COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY course_name DESC
tell me the total dose of desitin dosage that patient 13841 had been prescribed since 160 months ago?
CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE outputevents (row_id number,subject_id number,hadm_i...
SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13841) AND prescriptions.drug = 'desitin' AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-160 month')
what are the cost of diagnosis for acute lung injury - etiology unknown?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE patient (uniquepid text,patienthealthsystemstayi...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'diagnosis' AND cost.eventid IN (SELECT diagnosis.diagnosisid FROM diagnosis WHERE diagnosis.diagnosisname = 'acute lung injury - etiology unknown')
What is the low attendance rate against buffalo bills?
CREATE TABLE table_77763 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real)
SELECT MIN("Attendance") FROM table_77763 WHERE "Opponent" = 'buffalo bills'
What is the To par of the T6 Place Player with a Score of 68-69-70=207?
CREATE TABLE table_name_77 (to_par VARCHAR,place VARCHAR,score VARCHAR)
SELECT to_par FROM table_name_77 WHERE place = "t6" AND score = 68 - 69 - 70 = 207
List the number of areas of all appellations in the bar chart, rank by the total number from high to low.
CREATE TABLE appellations (No INTEGER,Appelation TEXT,County TEXT,State TEXT,Area TEXT,isAVA TEXT)CREATE TABLE grapes (ID INTEGER,Grape TEXT,Color TEXT)CREATE TABLE wine (No INTEGER,Grape TEXT,Winery TEXT,Appelation TEXT,State TEXT,Name TEXT,Year INTEGER,Price INTEGER,Score INTEGER,Cases INTEGER,Drink TEXT)
SELECT Area, COUNT(Area) FROM appellations GROUP BY Area ORDER BY COUNT(Area) DESC
What is listed for 5 credits that has 1 credit of 300?
CREATE TABLE table_35138 ("Hand" text,"1 credit" text,"2 credits" text,"3 credits" text,"4 credits" text,"5 credits" text)
SELECT "5 credits" FROM table_35138 WHERE "1 credit" = '300'
Answers with scores over 20 in 2012.
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 * FROM Posts WHERE YEAR(CreationDate) = 2012 AND Score > 20
show me the flights from ATLANTA to BALTIMORE
CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE code_description (code varchar,description text)CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREAT...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIM...
What was the founding university of ?
CREATE TABLE table_2538117_5 (founding_university VARCHAR,letters VARCHAR)
SELECT founding_university FROM table_2538117_5 WHERE letters = "ΑΕΦ"
How may women doubles winner were there when Philippe Aulner was mens singles winner?
CREATE TABLE table_19789 ("Year" real,"Mens singles" text,"Womens singles" text,"Mens doubles" text,"Womens doubles" text,"Mixed doubles" text)
SELECT COUNT("Womens doubles") FROM table_19789 WHERE "Mens singles" = 'Philippe Aulner'
Show me a bar chart for how many movie reviews does each director get?, and I want to display by the y axis in descending please.
CREATE TABLE Movie (mID int,title text,year int,director text)CREATE TABLE Reviewer (rID int,name text)CREATE TABLE Rating (rID int,mID int,stars int,ratingDate date)
SELECT director, COUNT(*) FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director ORDER BY COUNT(*) DESC
Questions per tag ever before.
CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PostNoticeTypes ...
SELECT TagName, COUNT(p.Id) AS k FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE p.PostTypeId = 1 GROUP BY TagName ORDER BY COUNT(p.Id) DESC
2006 of 10 4 is in which 2000?
CREATE TABLE table_39115 ("Tournament" text,"1998" 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,"2012" text,"2013" text)
SELECT "2000" FROM table_39115 WHERE "2006" = '10–4'
what are the four most frequently ordered lab tests for patients who had previously received beta blocker within the same month, during the previous year?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number...
SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'beta blocker' AND DATETIME(treatment.treatmenttime, ...
When the Swedish People's Party had a net gain/loss of 0, how many seats did they have?
CREATE TABLE table_74657 ("Party" text,"Seats" text,"Net gain/loss" text,"% of seats" text,"% of votes" text)
SELECT "Seats" FROM table_74657 WHERE "Net gain/loss" = '0' AND "Party" = 'swedish people''s party'
what was the first time patient 027-73025 during their last hospital encounter received a lab test?
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 patient (uniquepid text,patienthealthsystemstayi...
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-73025' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitala...
In which location is aci vallelunga circuit?
CREATE TABLE table_23315271_2 (location VARCHAR,circuit VARCHAR)
SELECT location FROM table_23315271_2 WHERE circuit = "ACI Vallelunga circuit"
has 3% citrate been administered to patient 18866 on the first hospital visit?
CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,d...
SELECT COUNT(*) > 0 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 = 18866 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND inputevents_cv.it...
What is the english (bcp) phrase 'for thine is the kingdom, the power' in modern german with standard wording?
CREATE TABLE table_72968 ("English (BCP)" text,"Writing system 1 (English-based)" text,"Writing system 2 (German-based)" text,"Modern German (close translation)" text,"Modern German (standard wording)" text)
SELECT "Modern German (standard wording)" FROM table_72968 WHERE "English ( BCP )" = 'For thine is the kingdom, the power'
Which common has an area (km2) of 38.38?
CREATE TABLE table_1449169_1 (common VARCHAR,area__km_2__ VARCHAR)
SELECT common FROM table_1449169_1 WHERE area__km_2__ = "38.38"
Bar chart x axis year y axis the number of year, sort y-axis in descending order.
CREATE TABLE hall_of_fame (player_id TEXT,yearid INTEGER,votedby TEXT,ballots NUMERIC,needed NUMERIC,votes NUMERIC,inducted TEXT,category TEXT,needed_note TEXT)CREATE TABLE player (player_id TEXT,birth_year NUMERIC,birth_month NUMERIC,birth_day NUMERIC,birth_country TEXT,birth_state TEXT,birth_city TEXT,death_year NUME...
SELECT year, COUNT(year) FROM home_game ORDER BY COUNT(year) DESC
What was the final in the game that boris diaw (34) scored the most points?
CREATE TABLE table_30999 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Series" text)
SELECT "Score" FROM table_30999 WHERE "High points" = 'Boris Diaw (34)'
What is the highest Game, when Opponents is less than 80, and when Record is '1-0'?
CREATE TABLE table_76798 ("Game" real,"Date" text,"Opponent" text,"Result" text,"Heat points" real,"Opponents" real,"Record" text,"Streak" text)
SELECT MAX("Game") FROM table_76798 WHERE "Opponents" < '80' AND "Record" = '1-0'
what episode number had 11.73 million viewers?
CREATE TABLE table_27045 ("Episode" real,"First Air Date" text,"Rating (18\u201349)" text,"Share (18\u201349)" real,"Viewers (millions)" text,"Rank (timeslot)" text,"Rank (night)" text)
SELECT "Episode" FROM table_27045 WHERE "Viewers (millions)" = '11.73'
What is the Nielsen ranking for Season 8?
CREATE TABLE table_name_99 (nielsen_ranking VARCHAR,season VARCHAR)
SELECT nielsen_ranking FROM table_name_99 WHERE season = "season 8"
what is the average cost of a hospital that involves a drug named lithium carbonate since 2105?
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 procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE patients (row_id number,subject_id number,...
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'lithium carbonate') AND STRFTIME('%y', cost.chargetime) >= '2105' GROUP BY cost.hadm_id) AS t1
I want the team for replaced by mark mcghee
CREATE TABLE table_10575 ("Team" text,"Outgoing manager" text,"Manner of departure" text,"Replaced by" text,"Date of appointment" text)
SELECT "Team" FROM table_10575 WHERE "Replaced by" = 'mark mcghee'
What was the score when the record 56-46 was met?
CREATE TABLE table_name_7 (score VARCHAR,record VARCHAR)
SELECT score FROM table_name_7 WHERE record = "56-46"
What is the mean number of laps when the grid is less than 19 and time/retired is +21.3 secs?
CREATE TABLE table_42560 ("Driver" text,"Team" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT AVG("Laps") FROM table_42560 WHERE "Grid" < '19' AND "Time/Retired" = '+21.3 secs'
What is the area of the corporation named the powell river, the corporation of the city of?
CREATE TABLE table_28367242_1 (area__km²_ VARCHAR,corporate_name VARCHAR)
SELECT area__km²_ FROM table_28367242_1 WHERE corporate_name = "Powell River, The Corporation of the City of"
Show each location and the number of cinemas there.
CREATE TABLE schedule (cinema_id number,film_id number,date text,show_times_per_day number,price number)CREATE TABLE film (film_id number,rank_in_series number,number_in_season number,title text,directed_by text,original_air_date text,production_code text)CREATE TABLE cinema (cinema_id number,name text,openning_year nu...
SELECT location, COUNT(*) FROM cinema GROUP BY location
Who directed the episode 'Escape'?
CREATE TABLE table_16332 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text,"U.S. viewers (millions)" text)
SELECT "Directed by" FROM table_16332 WHERE "Title" = 'Escape'
i would like to fly from DENVER to PITTSBURGH
CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_required text,minimum_stay int,maximum_stay int,application text,no_discounts text)CREATE TABLE d...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBU...
provide the number of patients whose diagnoses short title is abn react-cardiac cath and lab test abnormal status is delta?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug tex...
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 = "Abn react-cardiac cath" AND lab.flag = "delta"
how much is the diagnosis price for acute respiratory failure - due to obstructive lung disease.
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE microlab (microlabid number,patientunitstayid number...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'diagnosis' AND cost.eventid IN (SELECT diagnosis.diagnosisid FROM diagnosis WHERE diagnosis.diagnosisname = 'acute respiratory failure - due to obstructive lung disease')
Which district has a retired republican hold and an incumbent of rufus p. spalding?
CREATE TABLE table_name_67 (district VARCHAR,result VARCHAR,incumbent VARCHAR)
SELECT district FROM table_name_67 WHERE result = "retired republican hold" AND incumbent = "rufus p. spalding"
How many students and instructors are in each department?
CREATE TABLE takes (id text,course_id text,sec_id text,semester text,year number,grade text)CREATE TABLE instructor (id text,name text,dept_name text,salary number)CREATE TABLE prereq (course_id text,prereq_id text)CREATE TABLE section (course_id text,sec_id text,semester text,year number,building text,room_number text...
SELECT COUNT(DISTINCT T2.id), COUNT(DISTINCT T3.id), T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name GROUP BY T3.dept_name
How many people attended the game in week 13?
CREATE TABLE table_name_60 (attendance VARCHAR,week VARCHAR)
SELECT attendance FROM table_name_60 WHERE week = 13
What is the Tie no when Scarborough is the Home team?
CREATE TABLE table_61080 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text)
SELECT "Tie no" FROM table_61080 WHERE "Home team" = 'scarborough'
What is the number of patients who had a lymphocytes lab test and stayed in the hospital for more than 26 days?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "26" AND lab.label = "Lymphocytes"
What location has 51,212 as the attendance?
CREATE TABLE table_39765 ("Season" real,"Bowl game" text,"Result" text,"Opponent" text,"Stadium" text,"Location" text,"Attendance" text)
SELECT "Location" FROM table_39765 WHERE "Attendance" = '51,212'
Which region had a year March 10, 1998?
CREATE TABLE table_60783 ("Region" text,"Year" text,"Label" text,"Format" text,"Catalog" text)
SELECT "Region" FROM table_60783 WHERE "Year" = 'march 10, 1998'
Who directed the film Gomorra?
CREATE TABLE table_18994724_1 (director_s_ VARCHAR,film_title_used_in_nomination VARCHAR)
SELECT director_s_ FROM table_18994724_1 WHERE film_title_used_in_nomination = "Gomorra"
What game was located at the Los Angeles Memorial Sports Arena?
CREATE TABLE table_name_60 (game VARCHAR,location_attendance VARCHAR)
SELECT game FROM table_name_60 WHERE location_attendance = "los angeles memorial sports arena"
Which league had a playoffs result of a lost semifinal?
CREATE TABLE table_name_31 (league VARCHAR,playoffs VARCHAR)
SELECT league FROM table_name_31 WHERE playoffs = "lost semifinal"
What is the maximum apogee for samos f3-3?
CREATE TABLE table_72283 ("Name" text,"Alt name" text,"Launch date" text,"ID" text,"Mass (kg)" real,"Decay date" text,"Perigee (km)" real,"Apogee (km)" real,"Inclination" text)
SELECT MAX("Apogee (km)") FROM table_72283 WHERE "Name" = 'SAMOS F3-3'
Bar chart x axis carrier y axis the number of carrier, and rank by the Y in ascending.
CREATE TABLE phone_market (Market_ID int,Phone_ID text,Num_of_stock int)CREATE TABLE phone (Name text,Phone_ID int,Memory_in_G int,Carrier text,Price real)CREATE TABLE market (Market_ID int,District text,Num_of_employees int,Num_of_shops real,Ranking int)
SELECT Carrier, COUNT(Carrier) FROM phone GROUP BY Carrier ORDER BY COUNT(Carrier)
How many assets can each parts be used in? List the part name and the number.
CREATE TABLE Asset_Parts (asset_id INTEGER,part_id INTEGER)CREATE TABLE Fault_Log_Parts (fault_log_entry_id INTEGER,part_fault_id INTEGER,fault_status VARCHAR(10))CREATE TABLE Skills (skill_id INTEGER,skill_code VARCHAR(20),skill_description VARCHAR(255))CREATE TABLE Assets (asset_id INTEGER,maintenance_contract_id INT...
SELECT part_name, COUNT(*) FROM Parts AS T1 JOIN Asset_Parts AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name
Return the sum of all payment amounts.
CREATE TABLE country (country_id number,country text,last_update time)CREATE TABLE film (film_id number,title text,description text,release_year time,language_id number,original_language_id number,rental_duration number,rental_rate number,length number,replacement_cost number,rating text,special_features text,last_upda...
SELECT SUM(amount) FROM payment
Who was the pilot at lake dumbleyung?
CREATE TABLE table_name_43 (pilot_s_ VARCHAR,location VARCHAR)
SELECT pilot_s_ FROM table_name_43 WHERE location = "lake dumbleyung"
Which language has the percentage of 2.54?
CREATE TABLE table_name_8 (language VARCHAR,percentage___percentage_ VARCHAR)
SELECT language FROM table_name_8 WHERE percentage___percentage_ = "2.54"
Where is the Eren Talu bidding project located?
CREATE TABLE table_70090 ("Project" text,"Year" text,"Location" text,"Capacity" real,"Suites" text,"Architect" text,"Cost" text)
SELECT "Location" FROM table_70090 WHERE "Project" = 'eren talu bidding project'
What are the distinct types of mills that are built by American or Canadian architects?
CREATE TABLE bridge (architect_id number,id number,name text,location text,length_meters number,length_feet number)CREATE TABLE architect (id text,name text,nationality text,gender text)CREATE TABLE mill (architect_id number,id number,location text,name text,type text,built_year number,notes text)
SELECT DISTINCT T1.type FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id WHERE T2.nationality = 'American' OR T2.nationality = 'Canadian'
Which Mark has an Athlete of tatyana lebedeva?
CREATE TABLE table_13119 ("Mark" text,"Wind*" text,"Athlete" text,"Nationality" text,"Venue" text,"Date" text)
SELECT "Mark" FROM table_13119 WHERE "Athlete" = 'tatyana lebedeva'
What is the grand final dual television commentator status of the year when Amaury Vassili was the spokesperson?
CREATE TABLE table_name_52 (grand_final_dual_television_commentator VARCHAR,spokesperson VARCHAR)
SELECT grand_final_dual_television_commentator FROM table_name_52 WHERE spokesperson = "amaury vassili"
Find the number of medications prescribed for each brand.
CREATE TABLE Affiliated_With (Physician INTEGER,Department INTEGER,PrimaryAffiliation BOOLEAN)CREATE TABLE Appointment (AppointmentID INTEGER,Patient INTEGER,PrepNurse INTEGER,Physician INTEGER,Start DATETIME,End DATETIME,ExaminationRoom TEXT)CREATE TABLE Department (DepartmentID INTEGER,Name VARCHAR(30),Head INTEGER)C...
SELECT Name, COUNT(*) FROM Medication AS T1 JOIN Prescribes AS T2 ON T1.Code = T2.Medication GROUP BY T1.Brand
, and show in descending by the Y.
CREATE TABLE Team (id INTEGER,team_api_id INTEGER,team_fifa_api_id INTEGER,team_long_name TEXT,team_short_name TEXT)CREATE TABLE sqlite_sequence (name any,seq any)CREATE TABLE Player (id INTEGER,player_api_id INTEGER,player_name TEXT,player_fifa_api_id INTEGER,birthday TEXT,height INTEGER,weight INTEGER)CREATE TABLE Te...
SELECT preferred_foot, COUNT(*) FROM Player_Attributes WHERE overall_rating > 80 GROUP BY preferred_foot ORDER BY COUNT(*) DESC
What was the finish of the winner of the 2000 Masters?
CREATE TABLE table_name_54 (finish VARCHAR,year_s__won VARCHAR)
SELECT finish FROM table_name_54 WHERE year_s__won = "2000"
Visualize a bar chart for how many authors submit to the workshop.
CREATE TABLE workshop (Workshop_ID int,Date text,Venue text,Name text)CREATE TABLE Acceptance (Submission_ID int,Workshop_ID int,Result text)CREATE TABLE submission (Submission_ID int,Scores real,Author text,College text)
SELECT Author, COUNT(Author) FROM submission GROUP BY Author
What date was an episode with a run time of 24:30 broadcasted?
CREATE TABLE table_20305 ("Episode" text,"Broadcast date" text,"Run time" text,"Viewers (in millions)" text,"Archive" text)
SELECT "Broadcast date" FROM table_20305 WHERE "Run time" = '24:30'
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 job_id and commission_pct , and order by the X-axis in desc.
CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE jobs (JOB_ID ...
SELECT JOB_ID, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY JOB_ID DESC
Which Holmenkollen has a Country of norway, and a Winner of tom sandberg?
CREATE TABLE table_45909 ("Winner" text,"Country" text,"Winter Olympics" text,"FIS Nordic World Ski Championships" text,"Holmenkollen" text)
SELECT "Holmenkollen" FROM table_45909 WHERE "Country" = 'norway' AND "Winner" = 'tom sandberg'
Out of the total number of patients admitted to emergency, calculate the number of those on Medicaid insurance.
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.insurance = "Medicaid"
What are the names of the products that have a color description of 'red' and the 'fast' characteristic?
CREATE TABLE product_characteristics (product_id number,characteristic_id number,product_characteristic_value text)CREATE TABLE ref_colors (color_code text,color_description text)CREATE TABLE products (product_id number,color_code text,product_category_code text,product_name text,typical_buying_price text,typical_selli...
SELECT product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN characteristics AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "red" AND t3.characteristic_name = "fast"
What is the sum of the weeks on a chart a song with a position less than 1 haas?
CREATE TABLE table_54037 ("Year" real,"Single" text,"Chart" text,"Position" real,"Weeks on chart" real)
SELECT SUM("Weeks on chart") FROM table_54037 WHERE "Position" < '1'
What is the lowest Bike No, when Driver / Passenger is Joris Hendrickx / Kaspars Liepins, and when Position is less than 4?
CREATE TABLE table_48571 ("Position" real,"Driver / Passenger" text,"Equipment" text,"Bike No" real,"Points" real)
SELECT MIN("Bike No") FROM table_48571 WHERE "Driver / Passenger" = 'joris hendrickx / kaspars liepins' AND "Position" < '4'
What is Road Team, when Result is '74-71'?
CREATE TABLE table_name_36 (road_team VARCHAR,result VARCHAR)
SELECT road_team FROM table_name_36 WHERE result = "74-71"
what were the five most frequently prescribed medications until 2 years ago?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,syst...
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-2 year') GROUP BY medication.drugname) AS t1 WHERE t1.c1 <= 5
What's the To par of St Andrews before the year 1888?
CREATE TABLE table_name_35 (to_par_ VARCHAR,a_ VARCHAR,course VARCHAR,year VARCHAR)
SELECT to_par_ AS "a_" FROM table_name_35 WHERE course = "st andrews" AND year < 1888
find the number of patients who have ed route of drug administration and diagnosed with chronic systolic and diastolic heart failure.
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 diagnoses (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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Chronic combined systolic and diastolic heart failure" AND prescriptions.route = "ED"
What is the Main use of transmitter solt in Hungary?
CREATE TABLE table_name_75 (main_use VARCHAR,country VARCHAR,name VARCHAR)
SELECT main_use FROM table_name_75 WHERE country = "hungary" AND name = "transmitter solt"
what is the last nationality on the list ?
CREATE TABLE table_204_174 (id number,"rank" number,"name" text,"nationality" text,"result" number,"notes" text)
SELECT "nationality" FROM table_204_174 ORDER BY id DESC LIMIT 1
In what year did Tom Sneva win a race?
CREATE TABLE table_19090 ("Season" real,"Race Name" text,"Winning Driver" text,"Chassis" text,"Engine" text,"Tires" text,"Team" text)
SELECT "Season" FROM table_19090 WHERE "Winning Driver" = 'Tom Sneva'
show me all flights from PHOENIX to MILWAUKEE on wednesday
CREATE TABLE fare_basis (fare_basis_code text,booking_class text,class_type text,premium text,economy text,discounted text,night text,season text,basis_days text)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer va...
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 = 'MILWAUKEE' AND date_day.day_number = 23 AND date_day.month_number = 4 AND...
What classes involve Special Naval Architecture and Marine Engineering and Orthodontics Practice Management and Transitions ?
CREATE TABLE course (course_id int,name varchar,department varchar,number varchar,credits varchar,advisory_requirement varchar,enforced_requirement varchar,description varchar,num_semesters int,num_enrolled int,has_discussion varchar,has_lab varchar,has_projects varchar,has_exams varchar,num_reviews int,clarity_score i...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id WHERE (area.area LIKE '%Orthodontics Practice Management and Transitions%' OR course.description LIKE '%Orthodontics Practice Management and Transitions%' OR course.name LIKE '%Orthodontics Pra...
What source has delph as the name?
CREATE TABLE table_name_53 (source VARCHAR,name VARCHAR)
SELECT source FROM table_name_53 WHERE name = "delph"
What was the Venue on November 14, 2007?
CREATE TABLE table_9051 ("Date" text,"Venue" text,"Score" text,"Competition" text,"Report" text)
SELECT "Venue" FROM table_9051 WHERE "Date" = 'november 14, 2007'
when was patient 71320 for the first time admitted to the hospital since 2103?
CREATE TABLE d_items (row_id number,itemid number,label text,linksto 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 admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime...
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 71320 AND STRFTIME('%y', admissions.admittime) >= '2103' ORDER BY admissions.admittime LIMIT 1