instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
how many patients stay in hospital more than 4 days and with drug type base?
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 text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "4" AND prescriptions.drug_type = "BASE"
Who was the writer for episode 3?
CREATE TABLE table_29039942_1 (writer VARCHAR,episode VARCHAR)
SELECT writer FROM table_29039942_1 WHERE episode = 3
Who wrote 'Concordia'?
CREATE TABLE table_27235 ("No." real,"#" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text,"U.S. viewers (million)" text)
SELECT "Written by" FROM table_27235 WHERE "Title" = 'Concordia'
What is the round or race of the winning driver Charles Hollings and what was his pole position?
CREATE TABLE table_name_32 (round___race VARCHAR,winning_driver VARCHAR,pole_position VARCHAR)
SELECT round___race FROM table_name_32 WHERE winning_driver = "charles hollings" AND pole_position = "charles hollings"
What is the highest Pick, when Nationality is 'France', and when Draft is less than 1979?
CREATE TABLE table_12481 ("Draft" real,"Round" real,"Pick" real,"Player" text,"Nationality" text)
SELECT MAX("Pick") FROM table_12481 WHERE "Nationality" = 'france' AND "Draft" < '1979'
what is the difference between the number of goals scored from the highest scoring team and the lowest scoring team ?
CREATE TABLE table_203_67 (id number,"place" number,"team" text,"played" number,"won" number,"draw" number,"lost" number,"goals\nscored" number,"goals\nconceded" number,"+/-" number,"points" number)
SELECT MAX("goals\nscored") - MIN("goals\nscored") FROM table_203_67
What was the earliest year that had more than 105,579 flying hours and a seat factor of 68%?
CREATE TABLE table_name_41 (year INTEGER,seat_factor VARCHAR,flying_hours VARCHAR)
SELECT MIN(year) FROM table_name_41 WHERE seat_factor = "68%" AND flying_hours > 105 OFFSET 579
Who drove grid 5?
CREATE TABLE table_56260 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Driver" FROM table_56260 WHERE "Grid" = '5'
For which production company did Sam Mccarthy produce?
CREATE TABLE table_36841 ("Rank" text,"Film" text,"Director(s)" text,"Producer(s)" text,"Writer(s)" text,"Production Company" text)
SELECT "Production Company" FROM table_36841 WHERE "Producer(s)" = 'sam mccarthy'
What are the first names and ids for customers who have two or more accounts.
CREATE TABLE Financial_Transactions (transaction_id INTEGER,account_id INTEGER,invoice_number INTEGER,transaction_type VARCHAR(15),transaction_date DATETIME,transaction_amount DECIMAL(19,4),transaction_comment VARCHAR(255),other_transaction_details VARCHAR(255))CREATE TABLE Customers (customer_id INTEGER,customer_first...
SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id
What is the earliest year won Paul Azinger had with a to par higher than 5?
CREATE TABLE table_name_12 (year_won INTEGER,player VARCHAR,to_par VARCHAR)
SELECT MIN(year_won) FROM table_name_12 WHERE player = "paul azinger" AND to_par > 5
give me the flights from CHICAGO to SEATTLE on saturday morning
CREATE TABLE compartment_class (compartment varchar,class_type varchar)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE equipment_sequence (aircraft_code_s...
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 = 'SEATTLE' AND date_day.day_number = 26 AND date_day.month_number = 7 AND ...
Which date had Japanese sales of 0.59 million?
CREATE TABLE table_13490 ("Date" text,"Japan" text,"Americas" text,"Other" text,"Total" text)
SELECT "Date" FROM table_13490 WHERE "Japan" = '0.59 million'
Distribution of HNQs based on time until entering - divided by n minutes.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostI...
WITH times_cte AS (SELECT p.Id AS pid, p.CreationDate AS cre, ph.CreationDate AS hot, FLOOR(CAST(CAST((JULIANDAY(CreationDate) - JULIANDAY(p.CreationDate)) * 1440.0 AS INT) AS FLOAT) / '##interval?10##') AS time FROM PostHistory AS ph INNER JOIN Posts AS p ON ph.PostId = p.Id WHERE ph.PostHistoryTypeId = 52) SELECT tim...
Which year has the most released song?
CREATE TABLE torrents (groupname text,totalsnatched number,artist text,groupyear number,releasetype text,groupid number,id number)CREATE TABLE tags (index number,id number,tag text)
SELECT groupyear FROM torrents GROUP BY groupyear ORDER BY COUNT(groupname) DESC LIMIT 1
for how many years did the player who graduated from stanford play for Grizzlies?
CREATE TABLE table_47208 ("Player" text,"Nationality" text,"Position" text,"Years for Grizzlies" text,"School/Club Team" text)
SELECT "Years for Grizzlies" FROM table_47208 WHERE "School/Club Team" = 'stanford'
What is the lowest goals for more than 30 games played?
CREATE TABLE table_name_88 (goals_for INTEGER,played INTEGER)
SELECT MIN(goals_for) FROM table_name_88 WHERE played > 30
What is the total number of Draws with less than 4 matches?
CREATE TABLE table_67919 ("Name" text,"Period" text,"Matches" real,"Wins" real,"Draws" real,"Losses" real,"Efficiency %" text)
SELECT COUNT("Draws") FROM table_67919 WHERE "Matches" < '4'
subjects with fasting triglyceride levels > 250 mg / dl prior to the study ( at sv1
CREATE TABLE table_train_277 ("id" int,"gender" string,"cholesterol" float,"blood_platelet_counts" int,"creatinine_clearance_cl" float,"estimated_glomerular_filtration_rate_egfr" int,"severe_dyslipidemia" bool,"fasting_triglyceride" int,"body_mass_index_bmi" float,"triglyceride_tg" float,"NOUSE" float)
SELECT * FROM table_train_277 WHERE fasting_triglyceride > 250
Who was the partner on May 16, 2004?
CREATE TABLE table_14115 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Partner" text,"Opponents in the final" text,"Score" text)
SELECT "Partner" FROM table_14115 WHERE "Date" = 'may 16, 2004'
What was the stadium in Moorabbin, Victoria built for?
CREATE TABLE table_4136 ("Stadium" text,"Location" text,"Opened" real,"Built for" text,"Capacity at Construction" real)
SELECT "Built for" FROM table_4136 WHERE "Location" = 'Moorabbin, Victoria'
this year what were the three most commonly performed procedures for patients who are 20s?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuo...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age B...
Which event had 25,883 entries?
CREATE TABLE table_22050544_3 (event VARCHAR,entries VARCHAR)
SELECT event FROM table_22050544_3 WHERE entries = "25,883"
which team was larger than the rest ?
CREATE TABLE table_204_162 (id number,"team" text,"constructor" text,"motorcycle" text,"tyres" text,"no" number,"rider" text,"rounds" text)
SELECT "team" FROM table_204_162 GROUP BY "team" ORDER BY COUNT(*) DESC LIMIT 1
What's the score on february 18 when the visitors are the montreal canadiens?
CREATE TABLE table_name_46 (score VARCHAR,visitor VARCHAR,date VARCHAR)
SELECT score FROM table_name_46 WHERE visitor = "montreal canadiens" AND date = "february 18"
Who had the most assists in the game against Atlanta?
CREATE TABLE table_77396 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "High assists" FROM table_77396 WHERE "Team" = 'atlanta'
What is the sum of team impul with the date of 8 july
CREATE TABLE table_34100 ("Round" real,"Track" text,"Date" text,"Pole Position" text,"Fastest Race Lap" text,"Winner" text,"Team" text)
SELECT SUM("Round") FROM table_34100 WHERE "Team" = 'team impul' AND "Date" = '8 july'
What is the record when Tampa Bay is the visitor?
CREATE TABLE table_name_93 (record VARCHAR,visitor VARCHAR)
SELECT record FROM table_name_93 WHERE visitor = "tampa bay"
what is the number of inhabitants living in predeal in 2007 ?
CREATE TABLE table_203_465 (id number,"name" text,"population (2002 census)" number,"population (2007 estimation)" number,"population (2011 census)" number,"area (km2)" number,"density (pop/km2)" number)
SELECT "population (2007 estimation)" FROM table_203_465 WHERE "name" = 'predeal'
What was the score in the game that was won by Sligo Rovers F.C.?
CREATE TABLE table_47614 ("Date" text,"Competition" text,"Winners" text,"Score" text,"Runners-up" text)
SELECT "Score" FROM table_47614 WHERE "Winners" = 'sligo rovers f.c.'
how many patients whose admission type is urgent and year of birth is less than 1821?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.dob_year < "1821"
A bar chart for how many competitions for each country.
CREATE TABLE player (Player_ID int,name text,Position text,Club_ID int,Apps real,Tries real,Goals text,Points real)CREATE TABLE club_rank (Rank real,Club_ID int,Gold real,Silver real,Bronze real,Total real)CREATE TABLE club (Club_ID int,name text,Region text,Start_year text)CREATE TABLE competition_result (Competition_...
SELECT Country, COUNT(Country) FROM competition GROUP BY Country
how many patients have been discharged until 4 years ago?
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 inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE admissions (row_id n...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE NOT admissions.dischtime IS NULL AND DATETIME(admissions.dischtime) <= DATETIME(CURRENT_TIME(), '-4 year')
Who got the decision in the game, when the final score was 1-7?
CREATE TABLE table_29606 ("Game" real,"Date" text,"Opponent" text,"Score" text,"First Star" text,"Decision" text,"Location" text,"Attendance" real,"Record" text,"Points" real)
SELECT "Decision" FROM table_29606 WHERE "Score" = '1-7'
what is the number of patients whose primary disease is rash and drug route is tp?
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.diagnosis = "RASH" AND prescriptions.route = "TP"
Which Attendance has a Score of 4 3, and Points smaller than 5?
CREATE TABLE table_64931 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text,"Arena" text,"Points" real)
SELECT MAX("Attendance") FROM table_64931 WHERE "Score" = '4–3' AND "Points" < '5'
What is the Station Code of the Destination Station Departure?
CREATE TABLE table_5088 ("Station Code" text,"Station Name" text,"Arrival" text,"Departure" text,"Platform" text)
SELECT "Station Code" FROM table_5088 WHERE "Departure" = 'destination station'
when did patient 005-48105 receive the last proventil,ventolin and vancomycin 1 g mini-bag plus (vial mate) prescription at the same time in 12/this year?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,...
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'proventil,ventolin' AND patient.uniquepid = '005-48105' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIM...
When was the most recently named feature named?
CREATE TABLE table_21086 ("Name" text,"Latitude" text,"Longitude" text,"Diameter (km)" text,"Year named" real,"Name origin" text)
SELECT MAX("Year named") FROM table_21086
How many courses for each course description? Show me a stacked bar chart. The x-axis is course description and group by office name.
CREATE TABLE PROFESSOR (EMP_NUM int,DEPT_CODE varchar(10),PROF_OFFICE varchar(50),PROF_EXTENSION varchar(4),PROF_HIGH_DEGREE varchar(5))CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCHOOL_CODE varchar(8),EMP_NUM int,DEPT_ADDRESS varchar(20),DEPT_EXTENSION varchar(4))CREATE TABLE EMPLOYEE (EMP_NU...
SELECT CRS_DESCRIPTION, COUNT(CRS_DESCRIPTION) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY PROF_OFFICE, CRS_DESCRIPTION
What are the different classes of races, and how many races correspond to each Show bar chart, and could you sort by the X-axis from low to high?
CREATE TABLE track (Track_ID int,Name text,Location text,Seating real,Year_Opened real)CREATE TABLE race (Race_ID int,Name text,Class text,Date text,Track_ID text)
SELECT Class, COUNT(*) FROM race GROUP BY Class ORDER BY Class
what is the total number of publications ?
CREATE TABLE table_204_692 (id number,"publication" text,"score" text,"review" text)
SELECT COUNT("publication") FROM table_204_692
Name the total number of original titles written by john sullivan and keith lindsay
CREATE TABLE table_1737 ("Episode" real,"Original title" text,"Directed by" text,"Written by" text,"Original airdate" text,"Duration" text,"Viewership" text)
SELECT COUNT("Original title") FROM table_1737 WHERE "Written by" = 'John Sullivan and Keith Lindsay'
What was the score in the final on 14 august 1994?
CREATE TABLE table_10808 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Partner" text,"Opponents in the final" text,"Score in the final" text)
SELECT "Score in the final" FROM table_10808 WHERE "Date" = '14 august 1994'
Show the names of members whose country is 'United States' or 'Canada'.
CREATE TABLE member (Name VARCHAR,Country VARCHAR)
SELECT Name FROM member WHERE Country = "United States" OR Country = "Canada"
show me the number of patients on base type drug prescription who were younger than 30 years of age.
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "30" AND prescriptions.drug_type = "BASE"
Find the component amounts and names of all furnitures that have more than 10 components.
CREATE TABLE manufacturer (manufacturer_id number,open_year number,name text,num_of_factories number,num_of_shops number)CREATE TABLE furniture_manufacte (manufacturer_id number,furniture_id number,price_in_dollar number)CREATE TABLE furniture (furniture_id number,name text,num_of_component number,market_rate number)
SELECT num_of_component, name FROM furniture WHERE num_of_component > 10
What is the average number of participants in 2012 when there were less than 8 in 2013 and 7 in 2011?
CREATE TABLE table_7825 ("Country" text,"2010" real,"2011" real,"2012" real,"2013" real)
SELECT AVG("2012") FROM table_7825 WHERE "2013" < '8' AND "2011" = '7'
The stenhousemuir team had how many highest attendances?
CREATE TABLE table_150 ("Team" text,"Stadium" text,"Capacity" real,"Highest" real,"Lowest" real,"Average" real)
SELECT COUNT("Highest") FROM table_150 WHERE "Team" = 'Stenhousemuir'
Name the interacting for need of protection
CREATE TABLE table_name_87 (interacting__settings_ VARCHAR,need VARCHAR)
SELECT interacting__settings_ FROM table_name_87 WHERE need = "protection"
Who was the away team when Geelong was the home team?
CREATE TABLE table_10163 ("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_10163 WHERE "Home team" = 'geelong'
how many athlete 's first run was between 51 and 52 seconds ?
CREATE TABLE table_203_358 (id number,"pos." number,"athlete" text,"run 1" number,"run 2" number,"total" text)
SELECT COUNT("athlete") FROM table_203_358 WHERE "run 1" >= 51 AND "run 1" <= 52
What is the total bronze medals when the silver medals is 0, and 1 is the rank, Brazil (BRA) is the nation, and the gold medals is less than 2?
CREATE TABLE table_name_28 (bronze INTEGER,gold VARCHAR,nation VARCHAR,silver VARCHAR,rank VARCHAR)
SELECT SUM(bronze) FROM table_name_28 WHERE silver = 0 AND rank = "1" AND nation = "brazil (bra)" AND gold < 2
What is the enrollment of the university established in or after 2011?
CREATE TABLE table_name_68 (enrollment VARCHAR,established INTEGER)
SELECT enrollment FROM table_name_68 WHERE established > 2011
What is the Date for the City/State of Sydney, New South Wales?
CREATE TABLE table_43174 ("Rd. / Race" text,"Race Title" text,"Circuit" text,"City / State" text,"Date" text,"Winner" text,"Team" text)
SELECT "Date" FROM table_43174 WHERE "City / State" = 'sydney, new south wales'
what is the total when the rank is 7 and gold is more than 0?
CREATE TABLE table_name_41 (total INTEGER,rank VARCHAR,gold VARCHAR)
SELECT AVG(total) FROM table_name_41 WHERE rank = "7" AND gold > 0
What is the theme for the episode selection process?
CREATE TABLE table_453 ("Episode" text,"Theme" text,"Song choice" text,"Original artist" text,"Order #" text,"Result" text)
SELECT "Theme" FROM table_453 WHERE "Episode" = 'Selection Process'
Name the Result of the Lineup of start, an Assist/pass of carli lloyd, and an Competition of 2011 fifa women s world cup group stage?
CREATE TABLE table_79554 ("Date" text,"Location" text,"Lineup" text,"Assist/pass" text,"Score" text,"Result" text,"Competition" text)
SELECT "Result" FROM table_79554 WHERE "Lineup" = 'start' AND "Assist/pass" = 'carli lloyd' AND "Competition" = '2011 fifa women’s world cup – group stage'
since 2104 count the number of patients who were diagnosed with hx-rectal & anal malign and did not come back to the hospital within 2 months.
CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid ...
SELECT (SELECT COUNT(DISTINCT t1.subject_id) 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_diagnoses.short_title = 'hx-rectal ...
What is the top price of $1 with a launch date on February 12, 2008?
CREATE TABLE table_33266 ("Game Name" text,"Price" text,"Top Prize" text,"Launch Date" text,"Odds of Winning" text)
SELECT "Top Prize" FROM table_33266 WHERE "Price" = '$1' AND "Launch Date" = 'february 12, 2008'
How many Lanes have a rank higher than 3 with a time of 2:08.11?
CREATE TABLE table_name_72 (lane VARCHAR,time VARCHAR,rank VARCHAR)
SELECT COUNT(lane) FROM table_name_72 WHERE time = "2:08.11" AND rank > 3
What was the score on April 22?
CREATE TABLE table_name_17 (score VARCHAR,date VARCHAR)
SELECT score FROM table_name_17 WHERE date = "april 22"
What was the winning score on Aug 28, 1983?
CREATE TABLE table_name_89 (winning_score VARCHAR,date VARCHAR)
SELECT winning_score FROM table_name_89 WHERE date = "aug 28, 1983"
What is every affiliation for candidate Daren Ireland?
CREATE TABLE table_25818630_1 (affiliation VARCHAR,candidate VARCHAR)
SELECT affiliation FROM table_25818630_1 WHERE candidate = "Daren Ireland"
Where was the game played where the home team was Collingwood?
CREATE TABLE table_56903 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Venue" FROM table_56903 WHERE "Home team" = 'collingwood'
one way
CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE airport (airport_code varchar,airport_name text,airport_location text,state_code varchar,country_name varchar,time_zone_code varchar,minimum_connect_time int)CREATE TABLE flig...
SELECT DISTINCT flight.departure_time FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CI...
What is the European competition when the tier is more than 2?
CREATE TABLE table_name_33 (european_competitions VARCHAR,tier INTEGER)
SELECT european_competitions FROM table_name_33 WHERE tier > 2
What is the smallest number of cuts when there were more than 0 wins?
CREATE TABLE table_name_59 (cuts_made INTEGER,wins INTEGER)
SELECT MIN(cuts_made) FROM table_name_59 WHERE wins > 0
How many Laps with a Grid smaller than 11 did John Watson have?
CREATE TABLE table_name_71 (laps INTEGER,driver VARCHAR,grid VARCHAR)
SELECT AVG(laps) FROM table_name_71 WHERE driver = "john watson" AND grid < 11
What was the Attendance at Jobing.com Arena?
CREATE TABLE table_name_48 (attendance VARCHAR,arena VARCHAR)
SELECT COUNT(attendance) FROM table_name_48 WHERE arena = "jobing.com arena"
Who's the Republican ticket with a Democratic ticket of matthew j. merritt?
CREATE TABLE table_name_49 (republican_ticket VARCHAR,democratic_ticket VARCHAR)
SELECT republican_ticket FROM table_name_49 WHERE democratic_ticket = "matthew j. merritt"
What is the Date in which the Crowed was over 10,300 and the Home team was Melbourne?
CREATE TABLE table_4571 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Date" FROM table_4571 WHERE "Crowd" > '10,300' AND "Home team" = 'melbourne'
What's the average round number for East Carolina?
CREATE TABLE table_name_2 (round INTEGER,school VARCHAR)
SELECT AVG(round) FROM table_name_2 WHERE school = "east carolina"
Show the name of the building that has the most company offices.
CREATE TABLE Office_locations (building_id VARCHAR,company_id VARCHAR)CREATE TABLE buildings (name VARCHAR,id VARCHAR)CREATE TABLE Companies (id VARCHAR)
SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id GROUP BY T1.building_id ORDER BY COUNT(*) DESC LIMIT 1
Name the sum of silver when total is mor ethan 1, bronze is 1 and gold is les than 0
CREATE TABLE table_name_92 (silver INTEGER,gold VARCHAR,total VARCHAR,bronze VARCHAR)
SELECT SUM(silver) FROM table_name_92 WHERE total > 1 AND bronze = 1 AND gold < 0
what is average age of patients whose gender is f and age is greater than or equal to 86?
CREATE TABLE procedures (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 text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do...
SELECT AVG(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.age >= "86"
Return a bar chart on what are the id and name of the mountains that have at least 2 photos?, I want to list by the y-axis from low to high.
CREATE TABLE camera_lens (id int,brand text,name text,focal_length_mm real,max_aperture real)CREATE TABLE photos (id int,camera_lens_id int,mountain_id int,color text,name text)CREATE TABLE mountain (id int,name text,Height real,Prominence real,Range text,Country text)
SELECT T1.name, T1.id FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id ORDER BY T1.id
What's the Bronze that's also got a Godl of Kim Woo-Jin?
CREATE TABLE table_name_75 (bronze VARCHAR,gold VARCHAR)
SELECT bronze FROM table_name_75 WHERE gold = "kim woo-jin"
When the home team scored 11.15 (81), what did the Away team score?
CREATE TABLE table_56911 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Away team score" FROM table_56911 WHERE "Home team score" = '11.15 (81)'
In 2015 , can I take PHYSICS 452 in the Spring ?
CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE jobs (job_id int,job_title varchar,description varchar,r...
SELECT COUNT(*) > 0 FROM (SELECT course_id FROM student_record WHERE earn_credit = 'Y' AND student_id = 1) AS DERIVED_TABLEalias0, course AS COURSEalias0, course_offering AS COURSE_OFFERINGalias0, semester AS SEMESTERalias0 WHERE COURSEalias0.course_id = COURSE_OFFERINGalias0.course_id AND NOT COURSEalias0.course_id IN...
where can we find some restaurants on bethel island rd in bethel island ?
CREATE TABLE restaurant (id int,name varchar,food_type varchar,city_name varchar,rating "decimal)CREATE TABLE geographic (city_name varchar,county varchar,region varchar)CREATE TABLE location (restaurant_id int,house_number int,street_name varchar,city_name varchar)
SELECT location.house_number, restaurant.name FROM location, restaurant WHERE location.city_name = 'bethel island' AND location.street_name = 'bethel island rd' AND restaurant.id = location.restaurant_id
which language has madhurima spoken more often in films : malayalam or telugu ?
CREATE TABLE table_204_57 (id number,"year" number,"film" text,"role" text,"language" text,"notes" text)
SELECT "language" FROM table_204_57 WHERE "language" IN ('malayalam', 'telugu') GROUP BY "language" ORDER BY COUNT("film") DESC LIMIT 1
What years did the player with the jersey number 33 and played position pf play?
CREATE TABLE table_name_4 (years VARCHAR,jersey_number_s_ VARCHAR,position VARCHAR)
SELECT years FROM table_name_4 WHERE jersey_number_s_ = 33 AND position = "pf"
What is the lowest numbered game with an opponent of Minnesota North Stars earlier than February 25?
CREATE TABLE table_48449 ("Game" real,"February" real,"Opponent" text,"Score" text,"Record" text)
SELECT MIN("Game") FROM table_48449 WHERE "Opponent" = 'minnesota north stars' AND "February" < '25'
What was the score when Tore Torgersen played for Team Europe?
CREATE TABLE table_19072602_1 (score VARCHAR,team_europe VARCHAR)
SELECT score FROM table_19072602_1 WHERE team_europe = "Tore Torgersen"
What state had less than 8.874 for swimsuit, less than 9.257 for evening gown, and less than 9.121 for interview?
CREATE TABLE table_name_26 (state VARCHAR,interview VARCHAR,swimsuit VARCHAR,evening_gown VARCHAR)
SELECT state FROM table_name_26 WHERE swimsuit < 8.874 AND evening_gown < 9.257 AND interview < 9.121
What is the lowest rank of a swimmer named Elizabeth Van Welie with a lane larger than 5?
CREATE TABLE table_name_85 (rank INTEGER,lane VARCHAR,name VARCHAR)
SELECT MIN(rank) FROM table_name_85 WHERE lane > 5 AND name = "elizabeth van welie"
What Owner's Trainer is Todd A. Pletcher?
CREATE TABLE table_name_64 (owner VARCHAR,trainer VARCHAR)
SELECT owner FROM table_name_64 WHERE trainer = "todd a. pletcher"
A pie chart for listing the number of the name of physicians who took some appointment.
CREATE TABLE Medication (Code INTEGER,Name VARCHAR(30),Brand VARCHAR(30),Description VARCHAR(30))CREATE TABLE On_Call (Nurse INTEGER,BlockFloor INTEGER,BlockCode INTEGER,OnCallStart DATETIME,OnCallEnd DATETIME)CREATE TABLE Procedures (Code INTEGER,Name VARCHAR(30),Cost REAL)CREATE TABLE Room (RoomNumber INTEGER,RoomTyp...
SELECT Name, COUNT(Name) FROM Appointment AS T1 JOIN Physician AS T2 ON T1.Physician = T2.EmployeeID GROUP BY Name
Number of questions closed by close vote count. Sceptics questions closed, by number of close votes. Useful to identify moderator-closed questions.
CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId numb...
SELECT 'close_votes', COUNT(*) FROM (SELECT COUNT(*) AS "close_votes" FROM Posts INNER JOIN Votes ON Posts.Id = Votes.PostId WHERE Votes.VoteTypeId = 6 AND NOT Posts.ClosedDate IS NULL GROUP BY Posts.Id) AS X GROUP BY 'close_votes'
Who has the high assists when 50-26 is the record?
CREATE TABLE table_23284271_10 (high_assists VARCHAR,record VARCHAR)
SELECT high_assists FROM table_23284271_10 WHERE record = "50-26"
what is the name of the episode whose writer is philippe browning?
CREATE TABLE table_2791668_1 (title VARCHAR,written_by VARCHAR)
SELECT title FROM table_2791668_1 WHERE written_by = "Philippe Browning"
When 7.55 is the amount of viewers what is the lowest number?
CREATE TABLE table_27098 ("#" real,"Title" text,"Director" text,"Writer(s)" text,"Viewers" text,"Air date" text,"Production code" real)
SELECT MIN("#") FROM table_27098 WHERE "Viewers" = '7.55'
What was the name of the player that had a vote percentage of 7.85%?
CREATE TABLE table_3123 ("Rank" text,"Player" text,"Nationality" text,"Team" text,"Opponent" text,"Score" text,"Competition" text,"Vote percentage" text)
SELECT "Player" FROM table_3123 WHERE "Vote percentage" = '7.85%'
Return a bar chart about the distribution of meter_200 and the average of ID , and group by attribute meter_200, sort Y-axis in asc order please.
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 text)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE stadiu...
SELECT meter_200, AVG(ID) FROM swimmer GROUP BY meter_200 ORDER BY AVG(ID)
Who was the Away team at Hawthorn?
CREATE TABLE table_11203 ("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_11203 WHERE "Away team" = 'hawthorn'
What is the record of the cubs on July 19?
CREATE TABLE table_name_41 (record VARCHAR,date VARCHAR)
SELECT record FROM table_name_41 WHERE date = "july 19"
Which school did the player then go to Auburn?
CREATE TABLE table_314 ("Player" text,"Position" text,"School" text,"Hometown" text,"College" text)
SELECT "School" FROM table_314 WHERE "College" = 'Auburn'
What is the number of deputies with 94.2% of the votes?
CREATE TABLE table_6217 ("Election date" real,"Party leader" text,"Number of votes received" text,"Percentage of votes" text,"Number of deputies" real)
SELECT SUM("Number of deputies") FROM table_6217 WHERE "Percentage of votes" = '94.2%'
What course requirements does REES 395 have ?
CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time,monday varchar,tuesday...
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT...