instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
what are the number of patients who received a calculated thyroxine (t4) index lab test during the previous year?
CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_locatio...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'calculated thyroxine (t4) index') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(...
Show the names of countries and the average speed of roller coasters from each country with a bar chart, and I want to display by the y axis from high to low.
CREATE TABLE country (Country_ID int,Name text,Population int,Area int,Languages text)CREATE TABLE roller_coaster (Roller_Coaster_ID int,Name text,Park text,Country_ID int,Length real,Height real,Speed text,Opened text,Status text)
SELECT T1.Name, AVG(T2.Speed) FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID GROUP BY T1.Name ORDER BY AVG(T2.Speed) DESC
with build 5/69-6/69 what's the order?
CREATE TABLE table_37603 ("Order" real,"Built" text,"Serial Numbers" text,"Quantity" real,"1st No." text)
SELECT SUM("Order") FROM table_37603 WHERE "Built" = '5/69-6/69'
Name the most number of total votes for election for 1878
CREATE TABLE table_19769687_3 (_number_of_total_votes INTEGER,election VARCHAR)
SELECT MAX(_number_of_total_votes) FROM table_19769687_3 WHERE election = "1878"
what's the party with incumbent being william e. evans
CREATE TABLE table_72432 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "Party" FROM table_72432 WHERE "Incumbent" = 'William E. Evans'
Who won the Senior British Open when Hale Irwin (3/7) won the Senior PGA Championship?
CREATE TABLE table_41394 ("Year" real,"Senior PGA Championship" text,"The Tradition" text,"Senior Players Championship" text,"U.S. Senior Open" text,"Senior British Open" text)
SELECT "Senior British Open" FROM table_41394 WHERE "Senior PGA Championship" = 'hale irwin (3/7)'
When Patrick Carpentier is driving and has less than 19 points with 90 laps, what team is racing?
CREATE TABLE table_name_43 (team VARCHAR,driver VARCHAR,laps VARCHAR,points VARCHAR)
SELECT team FROM table_name_43 WHERE laps = 90 AND points < 19 AND driver = "patrick carpentier"
get me the number of self pay insurance patients who have been diagnosed with lumbago.
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Self Pay" AND diagnoses.long_title = "Lumbago"
Name the incumbent for robert monell (j) 63.6% tilly lynde 36.4%
CREATE TABLE table_28850 ("District" text,"Incumbent" text,"Party" text,"First elected" text,"Result" text,"Candidates" text)
SELECT "Incumbent" FROM table_28850 WHERE "Candidates" = 'Robert Monell (J) 63.6% Tilly Lynde 36.4%'
Name the location attendance for l 105 123 (ot)
CREATE TABLE table_27733258_6 (location_attendance VARCHAR,score VARCHAR)
SELECT location_attendance FROM table_27733258_6 WHERE score = "L 105–123 (OT)"
on the last hospital visit, what was the average antithrombin value for patient 92063?
CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE d_items (row_id number,itemid number,label t...
SELECT AVG(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 92063 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.labe...
tell me the primary disease and days for which patient with patient id 8440 was hospitalized.
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 demographic.days_stay, demographic.diagnosis FROM demographic WHERE demographic.subject_id = "8440"
tell me the total 8 hr total fluid removed output that patient 030-28944 has had on this month/26?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number...
SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-28944')) AND intakeoutput.celllabel = '8 hr ...
What year(s) was axis & allies: d-day released?
CREATE TABLE table_21599 ("Release" real,"Title" text,"Start" real,"Pieces" real,"Board (inches)" text,"Board (cm)" text,"Type" text,"New units New units when compared to the original A&A: Classic version of the game." text,"Playable Powers" text)
SELECT "Release" FROM table_21599 WHERE "Title" = 'Axis & Allies: D-Day'
What is the builder launched 30 october 1944?
CREATE TABLE table_1206583_2 (builder VARCHAR,launched VARCHAR)
SELECT builder FROM table_1206583_2 WHERE launched = "30 October 1944"
what is the number of patients whose ethnicity is asian and drug name is loperamide?
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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "ASIAN" AND prescriptions.drug = "Loperamide"
Who is the director when the share is 11.8?
CREATE TABLE table_31245 ("Episode" real,"Title" text,"Directed by" text,"Written by" text,"UK viewers (million)" text,"Share (%)" text,"Original air date" text)
SELECT "Directed by" FROM table_31245 WHERE "Share (%)" = '11.8'
What are the names of all products, and count them by a bar chart, sort by the x-axis in desc.
CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)
SELECT Name, COUNT(Name) FROM Products GROUP BY Name ORDER BY Name DESC
Which episode title featured a visit to the country of Cuba?
CREATE TABLE table_37128 ("Episode No." text,"Episode Title" text,"UK Broadcast Date" text,"Presenter" text,"Details of Journey" text,"Countries Visited" text)
SELECT "Episode Title" FROM table_37128 WHERE "Countries Visited" = 'cuba'
Show each state and the number of addresses in each state Show bar chart, sort by the Y-axis from low to high.
CREATE TABLE Customer_Address_History (customer_id INTEGER,address_id INTEGER,date_from DATETIME,date_to DATETIME)CREATE TABLE Addresses (address_id INTEGER,line_1_number_building VARCHAR(80),city VARCHAR(50),zip_postcode VARCHAR(20),state_province_county VARCHAR(50),country VARCHAR(50))CREATE TABLE Order_Items (order_...
SELECT state_province_county, COUNT(*) FROM Addresses GROUP BY state_province_county ORDER BY COUNT(*)
What is the attendance of week 1
CREATE TABLE table_32610 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real)
SELECT "Attendance" FROM table_32610 WHERE "Week" = '1'
What is 3rd Place, when Runner-Up is 'Simon Ehne', and when Prize is $100,000?
CREATE TABLE table_9735 ("Season" text,"Winner" text,"Prize" text,"Runner-Up" text,"3rd place" text)
SELECT "3rd place" FROM table_9735 WHERE "Runner-Up" = 'simon ehne' AND "Prize" = '$100,000'
among patients that were prescribed with nystatin oral suspension, what are the three most frequently prescribed drugs at the same time, during this year.
CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid number,intime time,outtime time)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum ...
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 = 'nystatin oral suspension' AND DATETIME(prescriptions.startdate, '...
Which name had 6 goals?
CREATE TABLE table_51575 ("Nat." text,"Name" text,"Since" text,"Goals" real,"Transfer fee" text)
SELECT "Name" FROM table_51575 WHERE "Goals" = '6'
Average number of posts created within two days of user creation date in 2019.
CREATE TABLE PostHistoryTypes (Id number,Name text)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 Badges (Id n...
SELECT COUNT(Posts.Id) FROM Posts INNER JOIN Users ON Posts.OwnerUserId = Users.Id WHERE Posts.CreationDate < DATEADD(Day, 2, Users.CreationDate) AND YEAR(Users.CreationDate) = 2019 GROUP BY Users.Id
What date did Jatin Shah and Shalini Chandran perform?
CREATE TABLE table_18278508_2 (date_performed VARCHAR,main_contestant VARCHAR,co_contestant__yaar_vs_pyaar_ VARCHAR)
SELECT date_performed FROM table_18278508_2 WHERE main_contestant = "Jatin Shah" AND co_contestant__yaar_vs_pyaar_ = "Shalini Chandran"
Which Call sign has an ERP W of 75?
CREATE TABLE table_name_23 (call_sign VARCHAR,erp_w VARCHAR)
SELECT call_sign FROM table_name_23 WHERE erp_w = 75
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, return a bar chart about the distribution of hire_date and the sum of manager_id bin hire_date by time, and order by the total number in desc.
CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE countries (COU...
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY SUM(MANAGER_ID) DESC
what event is listed previous to the pole vault ?
CREATE TABLE table_204_766 (id number,"event" text,"meeting gaz de france\nparis" text,"golden gala\nrome" text,"bislett games\noslo" text,"weltklasse zurich" text,"memorial van damme\nbrussels" text,"istaf\nberlin" text)
SELECT "event" FROM table_204_766 WHERE id = (SELECT id FROM table_204_766 WHERE "event" = 'pole vault') - 1
what is the english version that is buena vista edition is daisuke gouri?
CREATE TABLE table_25173505_13 (english_version VARCHAR,buena_vista_edition VARCHAR)
SELECT english_version FROM table_25173505_13 WHERE buena_vista_edition = "Daisuke Gouri"
Which rapid has a distance in km smaller than 14.2, and a Station of k my ji?
CREATE TABLE table_name_91 (rapid VARCHAR,distance__km_ VARCHAR,station VARCHAR)
SELECT rapid FROM table_name_91 WHERE distance__km_ < 14.2 AND station = "kōmyōji"
When Aalborg BK is Team 1, what is the 1st leg?
CREATE TABLE table_name_32 (team_1 VARCHAR)
SELECT 1 AS st_leg FROM table_name_32 WHERE team_1 = "aalborg bk"
What percentage did kennedy win while coakly won 37.9%
CREATE TABLE table_24115349_4 (kennedy__percentage VARCHAR,coakley__percentage VARCHAR)
SELECT kennedy__percentage FROM table_24115349_4 WHERE coakley__percentage = "37.9%"
Where is the Eastern Nazarene College located?
CREATE TABLE table_2113 ("Institution" text,"Location" text,"Founded" real,"Type" text,"Enrollment" real,"Nickname" text,"Joined" real)
SELECT "Location" FROM table_2113 WHERE "Institution" = 'Eastern Nazarene College'
A bar chart about what are the ids and names of the medicine that can interact with two or more enzymes?, could you order by the X in ascending?
CREATE TABLE medicine (id int,name text,Trade_Name text,FDA_approved text)CREATE TABLE enzyme (id int,name text,Location text,Product text,Chromosome text,OMIM int,Porphyria text)CREATE TABLE medicine_enzyme_interaction (enzyme_id int,medicine_id int,interaction_type text)
SELECT name, id FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id ORDER BY name
How many Lost have Points larger than 40, and a Position of 11, and a Played smaller than 38?
CREATE TABLE table_36754 ("Position" real,"Team" text,"Points" real,"Played" real,"Drawn" real,"Lost" real,"Against" real,"Difference" text)
SELECT SUM("Lost") FROM table_36754 WHERE "Points" > '40' AND "Position" = '11' AND "Played" < '38'
For those records from the products and each product's manufacturer, draw a scatter chart about the correlation between price and manufacturer , and group by attribute founder.
CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)
SELECT Price, Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder
How many students are from each city, and which cities have more than one cities Plot them as bar chart, and display by the the total number in desc.
CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTEGER,city_code VARCHAR(3))CREATE TABLE Dorm_amenity (amenid INTEGER,amenity_name VARCHAR(25))CREATE TABLE Has_amenity (dormid INTEGER,amenid INTEGER)CREATE TABLE Dorm (dormid INTEGER,dorm_name VAR...
SELECT city_code, COUNT(*) FROM Student GROUP BY city_code ORDER BY COUNT(*) DESC
What was the highest lap for Luigi Piotti with more than 13 grid and a time/retired engine?
CREATE TABLE table_name_19 (laps INTEGER,driver VARCHAR,grid VARCHAR,time_retired VARCHAR)
SELECT MAX(laps) FROM table_name_19 WHERE grid > 13 AND time_retired = "engine" AND driver = "luigi piotti"
For those employees who was hired before 2002-06-21, for employee_id, hire_date, visualize the trend.
CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE countries (...
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE HIRE_DATE < '2002-06-21'
What is the name of team with Palmeiras 4-2 portuguesa as the last match?
CREATE TABLE table_name_47 (team VARCHAR,last_match VARCHAR)
SELECT team FROM table_name_47 WHERE last_match = "palmeiras 4-2 portuguesa"
How many times was the background self-employed - media agency?
CREATE TABLE table_26263322_1 (candidate VARCHAR,background VARCHAR)
SELECT COUNT(candidate) FROM table_26263322_1 WHERE background = "Self-employed - media agency"
When was the film directed by Pen-Ek Ratanaruang released?
CREATE TABLE table_41061 ("Date" text,"Title" text,"Director" text,"Production Cost" text,"Singapore Gross" text)
SELECT "Date" FROM table_41061 WHERE "Director" = 'pen-ek ratanaruang'
When did the first payment happen?
CREATE TABLE payment (payment_date VARCHAR)
SELECT payment_date FROM payment ORDER BY payment_date LIMIT 1
What is Part 1, when Part 2 is 'fraus'?
CREATE TABLE table_name_99 (part_1 VARCHAR,part_2 VARCHAR)
SELECT part_1 FROM table_name_99 WHERE part_2 = "fraus"
Show the product type codes that have at least two products.
CREATE TABLE Products (Product_Type_Code VARCHAR)
SELECT Product_Type_Code FROM Products GROUP BY Product_Type_Code HAVING COUNT(*) >= 2
List all the locations with a RBMK-1000 reactor.
CREATE TABLE table_213088_1 (location_chernobyl_1_chernobyl_2_chernobyl_3_chernobyl_4_chernobyl_5_ignalina_1_ignalina_2_ignalina_3_kursk_1_kursk_2_kursk_3_kursk_4_kursk_5_kursk_6_leningrad_1_leningrad_2_leningrad_3_leningrad_4_smolensk_1_smolensk_2_smolensk_3_smolensk_4_directorate_for_construction_of_kostoma_npp__for_...
SELECT location_chernobyl_1_chernobyl_2_chernobyl_3_chernobyl_4_chernobyl_5_ignalina_1_ignalina_2_ignalina_3_kursk_1_kursk_2_kursk_3_kursk_4_kursk_5_kursk_6_leningrad_1_leningrad_2_leningrad_3_leningrad_4_smolensk_1_smolensk_2_smolensk_3_smolensk_4_directorate_for_construction_of_kostoma_npp__for_kostroma_1_and_2__tabl...
Which Game has a Home Team of san francisco, and a Date of april 22?
CREATE TABLE table_name_80 (game VARCHAR,home_team VARCHAR,date VARCHAR)
SELECT game FROM table_name_80 WHERE home_team = "san francisco" AND date = "april 22"
List the name of artworks whose type is not 'Program Talent Show'.
CREATE TABLE artwork (Name VARCHAR,TYPE VARCHAR)
SELECT Name FROM artwork WHERE TYPE <> "Program Talent Show"
What is the number for march 27-29 whern november 3 is 153?
CREATE TABLE table_73772 ("June 10-11" text,"March 27-29" text,"January 15-16" text,"November 3" text,"August 21-22" text)
SELECT "March 27-29" FROM table_73772 WHERE "November 3" = '153'
Who was the lowest division in the 7th season?
CREATE TABLE table_name_11 (division INTEGER,reg_season VARCHAR)
SELECT MIN(division) FROM table_name_11 WHERE reg_season = "7th"
what is the highest top-5 when wins is more than 1?
CREATE TABLE table_63962 ("Tournament" text,"Wins" real,"Top-5" real,"Top-10" real,"Top-25" real,"Events" real,"Cuts made" real)
SELECT MAX("Top-5") FROM table_63962 WHERE "Wins" > '1'
What was Essendon's opponents away score?
CREATE TABLE table_name_40 (away_team VARCHAR,home_team VARCHAR)
SELECT away_team AS score FROM table_name_40 WHERE home_team = "essendon"
had docusate sodium, potassium chloride or spironolactone been prescribed the last year to patient 61527?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title 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 diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime t...
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 61527) AND prescriptions.drug IN ('docusate sodium', 'potassium chloride', 'spironolactone') AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 's...
What is the place and when was the year when the women's doubles womens were Bai yang Niu Jianfeng?
CREATE TABLE table_28138035_33 (year_location VARCHAR,womens_doubles VARCHAR)
SELECT year_location FROM table_28138035_33 WHERE womens_doubles = "Bai Yang Niu Jianfeng"
What 12 -credit courses are available ?
CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE gsi (course_offering_id int,student_id int)CREATE TABLE course (course_id int,name varchar,department varchar,numbe...
SELECT DISTINCT name, number FROM course WHERE credits = 12 AND department = 'EECS'
what is the date of vacancy when the position in table is 10th and the team is balboa?
CREATE TABLE table_64527 ("Team" text,"Outgoing manager" text,"Manner of departure" text,"Date of vacancy" text,"Replaced by" text,"Date of appointment" text,"Position in table" text)
SELECT "Date of vacancy" FROM table_64527 WHERE "Position in table" = '10th' AND "Team" = 'balboa'
Show the race class and number of races in each class.
CREATE TABLE race (Race_ID int,Name text,Class text,Date text,Track_ID text)CREATE TABLE track (Track_ID int,Name text,Location text,Seating real,Year_Opened real)
SELECT Class, COUNT(*) FROM race GROUP BY Class
who was the last player who went to indiana to win an award ?
CREATE TABLE table_204_585 (id number,"year" text,"player" text,"high school" text,"college" text,"nba/aba draft" text)
SELECT "player" FROM table_204_585 WHERE "college" = 'indiana' ORDER BY "year" DESC LIMIT 1
What is the match report from the game played on 25 april 2009?
CREATE TABLE table_64805 ("Date" text,"Venue" text,"Opponents" text,"Competition" text,"Match Report" text)
SELECT "Match Report" FROM table_64805 WHERE "Date" = '25 april 2009'
What was the score of the game that had a loss of Cerutti (0-1)?
CREATE TABLE table_71857 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text)
SELECT "Score" FROM table_71857 WHERE "Loss" = 'cerutti (0-1)'
Which Time/Retired has a Rider of daijiro kato?
CREATE TABLE table_49830 ("Rider" text,"Manufacturer" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Time/Retired" FROM table_49830 WHERE "Rider" = 'daijiro kato'
what is the minimum hospital cost when it involves lung abscess in 2100?
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 MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'lung abscess')) AND STRFTIME('%y', cost.char...
what are the three frequent diagnoses until 2 years ago?
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 t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-2 year') GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 3
Find the name and city of the airport which is the source for the most number of flight routes.
CREATE TABLE airports (name VARCHAR,city VARCHAR,apid VARCHAR)CREATE TABLE routes (src_apid VARCHAR)
SELECT T1.name, T1.city, T2.src_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid GROUP BY T2.src_apid ORDER BY COUNT(*) DESC LIMIT 1
What was the result of the election when Tic Forrester ran as an incumbent?
CREATE TABLE table_18502 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "Result" FROM table_18502 WHERE "Incumbent" = 'Tic Forrester'
What is the Club, when the value for Lost is 9, and when the value for Tries is 55?
CREATE TABLE table_name_8 (club VARCHAR,lost VARCHAR,tries_for VARCHAR)
SELECT club FROM table_name_8 WHERE lost = "9" AND tries_for = "55"
how many total non fatal attacks by wolves have been recorded ?
CREATE TABLE table_204_708 (id number,"victim(s)" text,"age" number,"gender" text,"date" text,"type of attack" text,"location" text,"details" text,"source(s)" text)
SELECT COUNT(*) FROM table_204_708
Where did the team play when the home team score was 12.9 (81)?
CREATE TABLE table_1445 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Ground" text,"Crowd" real,"Date" text)
SELECT "Ground" FROM table_1445 WHERE "Home team score" = '12.9 (81)'
What are the most Points with an Assist of 46?
CREATE TABLE table_name_53 (points INTEGER,assists VARCHAR)
SELECT MAX(points) FROM table_name_53 WHERE assists = 46
Which championship has Roger Federer as an opponent on a clay surface in a year earlier than 2007?
CREATE TABLE table_38066 ("Outcome" text,"Year" real,"Championship" text,"Surface" text,"Opponent" text,"Score" text)
SELECT "Championship" FROM table_38066 WHERE "Opponent" = 'roger federer' AND "Surface" = 'clay' AND "Year" < '2007'
What is the Country of the T8 Place Player with a Score of 70-67-71=208?
CREATE TABLE table_13218 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Country" FROM table_13218 WHERE "Place" = 't8' AND "Score" = '70-67-71=208'
What percent did GR NE get in the state where FRITZ got 1.3%?
CREATE TABLE table_60668 ("State" text,"GR\u00dcNE" text,"FRITZ" text,"RETT\u00d6" text,"LINKE" text,"STARK" text)
SELECT "GR\u00dcNE" FROM table_60668 WHERE "FRITZ" = '1.3%'
What is the Time/Retired for brabham - climax, on Grid of 10?
CREATE TABLE table_name_89 (time_retired VARCHAR,constructor VARCHAR,grid VARCHAR)
SELECT time_retired FROM table_name_89 WHERE constructor = "brabham - climax" AND grid = 10
count the number of patients whose primary disease is st elevated myocardial infarction/cardiac ccath and procedure icd9 code is 9465.
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND procedures.icd9_code = "9465"
Compute the average price of all the products.
CREATE TABLE manufacturers (code number,name text,headquarter text,founder text,revenue number)CREATE TABLE products (code number,name text,price number,manufacturer number)
SELECT AVG(price) FROM products
did there exist any organism found in the first peripheral blood lymphocytes microbiology test of patient 2957 during this 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 microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2957 AND admissions.dischtime IS NULL) AND microbiologyevents.spec_type_desc = 'peripheral blood lymphocytes' AND NOT microbiologyevents.org_name IS NULL ORDER BY micr...
Count the number of patients discharged to a skilled nursing facility who had procedure icd9 code 3491.
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "REHAB/DISTINCT PART HOSP" AND procedures.icd9_code = "3491"
What was the Air Force - Navy score in the 1983 season?
CREATE TABLE table_22386 ("Season" real,"Trophy Winner" text,"Air Force \u2013 Navy score" text,"Air Force \u2013 Army score" text,"Army \u2013 Navy score" text)
SELECT "Air Force \u2013 Navy score" FROM table_22386 WHERE "Season" = '1983'
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_name_21 (ship_types_delivered VARCHAR,total_vessels_built_for_usmc VARCHAR)
SELECT ship_types_delivered FROM table_name_21 WHERE total_vessels_built_for_usmc = "13 ships for usmc (plus 37 more for usn)"
What is the second qualifying time for the dale coyne racing team with a first qualifying time of 1:00.081?
CREATE TABLE table_name_31 (qual_2 VARCHAR,team VARCHAR,qual_1 VARCHAR)
SELECT qual_2 FROM table_name_31 WHERE team = "dale coyne racing" AND qual_1 = "1:00.081"
Which Prohibition ticket has a Socialist Labor ticket of joseph smith?
CREATE TABLE table_40138 ("Office" text,"Republican ticket" text,"Democratic ticket" text,"Socialist Labor ticket" text,"Prohibition ticket" text,"Independent Citizens' ticket" text)
SELECT "Prohibition ticket" FROM table_40138 WHERE "Socialist Labor ticket" = 'joseph smith'
What is the average base price of different bed type? List bed type and average base price. Visualize by pie chart.
CREATE TABLE Reservations (Code INTEGER,Room TEXT,CheckIn TEXT,CheckOut TEXT,Rate REAL,LastName TEXT,FirstName TEXT,Adults INTEGER,Kids INTEGER)CREATE TABLE Rooms (RoomId TEXT,roomName TEXT,beds INTEGER,bedType TEXT,maxOccupancy INTEGER,basePrice INTEGER,decor TEXT)
SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType
after the 1928-29 championship , how many times was the panellinios basket named champions of the panhellenic championship ?
CREATE TABLE table_203_391 (id number,"season" text,"greek league" text,"greek cup" text,"europe" text,"coach" text,"roster" text)
SELECT COUNT(*) FROM table_203_391 WHERE "season" > '1928-29' AND "greek league" = 'champion'
what is maximum age of patients whose marital status is married and admission year is greater than or equal to 2190?
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 MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.admityear >= "2190"
What is every value for Croats if the value of Roma is 3.1%?
CREATE TABLE table_2374338_2 (croats VARCHAR,roma VARCHAR)
SELECT croats FROM table_2374338_2 WHERE roma = "3.1%"
Which airport is in Tokyo and has an ICAO of rjtt?
CREATE TABLE table_14651 ("City" text,"Province/Region" text,"Country" text,"IATA" text,"ICAO" text,"Airport" text)
SELECT "Airport" FROM table_14651 WHERE "City" = 'tokyo' AND "ICAO" = 'rjtt'
What is Neighborhood, when Branch is Hollywood Library?
CREATE TABLE table_41563 ("Branch" text,"Address" text,"Neighborhood" text,"First branch opened" real,"Current branch opened" real)
SELECT "Neighborhood" FROM table_41563 WHERE "Branch" = 'hollywood library'
What are the names of all employees who have a salary higher than average?
CREATE TABLE aircraft (aid number,name text,distance number)CREATE TABLE employee (eid number,name text,salary number)CREATE TABLE flight (flno number,origin text,destination text,distance number,departure_date time,arrival_date time,price number,aid number)CREATE TABLE certificate (eid number,aid number)
SELECT name FROM employee WHERE salary > (SELECT AVG(salary) FROM employee)
what is maximum age of patients whose marital status is single and admission type is elective?
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 demographic (subject_id text,hadm_id text,name text,marital...
SELECT MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.admission_type = "ELECTIVE"
Name the driver for Laps less than 9 and a grid of 13
CREATE TABLE table_name_60 (driver VARCHAR,laps VARCHAR,grid VARCHAR)
SELECT driver FROM table_name_60 WHERE laps < 9 AND grid = 13
What is the height of the mountain climbined by the climbing who had the most points?
CREATE TABLE climber (climber_id number,name text,country text,time text,points number,mountain_id number)CREATE TABLE mountain (mountain_id number,name text,height number,prominence number,range text,country text)
SELECT T2.height FROM climber AS T1 JOIN mountain AS T2 ON T1.mountain_id = T2.mountain_id ORDER BY T1.points DESC LIMIT 1
what is the number of elective type hospital admission patients who have asian ethnic background?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,sho...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.ethnicity = "ASIAN"
what team lost on july 30
CREATE TABLE table_37357 ("Date" text,"Time" text,"Opponent" text,"Score" text,"Loss" text,"Record" text)
SELECT "Loss" FROM table_37357 WHERE "Date" = 'july 30'
Show the carriers of devices in stock at more than one shop.
CREATE TABLE stock (Device_ID VARCHAR)CREATE TABLE device (Carrier VARCHAR,Device_ID VARCHAR)
SELECT T2.Carrier FROM stock AS T1 JOIN device AS T2 ON T1.Device_ID = T2.Device_ID GROUP BY T1.Device_ID HAVING COUNT(*) > 1
What did the home team score in the game where the away team scored 8.14 (62)?
CREATE TABLE table_52835 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Home team score" FROM table_52835 WHERE "Away team score" = '8.14 (62)'
What are the names and locations of festivals?
CREATE TABLE festival_detail (Festival_Name VARCHAR,LOCATION VARCHAR)
SELECT Festival_Name, LOCATION FROM festival_detail
On what days of the week are the SWC 300 classes ?
CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time,monday varchar,tuesday varchar,wednesday varchar,thursday varchar,friday varchar,saturday varchar,sunday varchar,has_final_project varchar,has_final_exam varchar,textbook varchar,class_address varch...
SELECT DISTINCT course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_i...
List the state names and the number of customers living in each state with a bar chart.
CREATE TABLE Customer_Addresses (customer_id INTEGER,address_id INTEGER,date_from DATETIME,address_type VARCHAR(10),date_to DATETIME)CREATE TABLE Delivery_Route_Locations (location_code VARCHAR(10),route_id INTEGER,location_address_id INTEGER,location_name VARCHAR(50))CREATE TABLE Order_Deliveries (location_code VARCHA...
SELECT state_province_county, COUNT(*) FROM Customer_Addresses AS t1 JOIN Addresses AS t2 ON t1.address_id = t2.address_id GROUP BY t2.state_province_county
how many of the patients treated with theophylline sr were aged below 67?
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 text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marita...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "67" AND prescriptions.drug = "Theophylline SR"