sentence
stringlengths
3
347
sql
stringlengths
18
804
Show all ages and corresponding number of students.
SELECT age , count(*) FROM Student GROUP BY age
Return the categories of music festivals that have the result "Awarded".
SELECT Category FROM music_festival WHERE RESULT = "Awarded"
What are the full names of faculty members who are a part of department 520?
SELECT T1.Fname , T1.Lname FROM FACULTY AS T1 JOIN MEMBER_OF AS T2 ON T1.FacID = T2.FacID WHERE T2.DNO = 520
What are the naems of all the projects, and how many scientists were assigned to each of them?
SELECT count(*) , T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project GROUP BY T1.name
What is the average Season for coach Fisher, and an actual adjusted record of 0–11?
SELECT AVG(season) FROM table_name_45 WHERE coach = "fisher" AND actual_adjusted_record = "0–11"
Show all storm names except for those with at least two affected regions.
SELECT name FROM storm EXCEPT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING count(*) >= 2;
Find the name of the ships that have more than one captain.
SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id GROUP BY t2.ship_id HAVING count(*) > 1
How many businesses operating in the shopping business have opening times before 8AM?
SELECT COUNT(T3.business_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T4.opening_time < '8AM' AND T1.category_name LIKE 'Shopping'
What is the FIS Nordic World Ski Championships when holmenkollen is 1976?
SELECT fis_nordic_world_ski_championships FROM table_174491_2 WHERE holmenkollen = "1976"
Find the cities which have exactly two airports.
SELECT city FROM airports GROUP BY city HAVING count(*) = 2
Which Away has a Home of 2–2?
SELECT away FROM table_name_84 WHERE home = "2–2"
How many of the unemployed students are disabled?
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name
Which round has more than 79 overall and a position of QB?
SELECT round FROM table_name_60 WHERE position = "qb" AND overall > 79
How many architects haven't built a mill before year 1850?
SELECT count(*) FROM architect WHERE id NOT IN ( SELECT architect_id FROM mill WHERE built_year < 1850 );
What was the average bronze when gold was larger than 1 and silver was larger than 2?
SELECT AVG(bronze) FROM table_name_42 WHERE gold > 1 AND silver > 2
Which country's IATA is ika?
SELECT country FROM table_name_72 WHERE iata = "ika"
What was rickie winslow's number?
SELECT MAX(_number) FROM table_22496374_1 WHERE name = "Rickie Winslow"
Find the first name and country code of the player who did the most number of tours.
SELECT T1.country_code, T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id ORDER BY T2.tours DESC LIMIT 1
Calculate the average age of clients from the Midwest region.
SELECT CAST(SUM(T1.age) AS REAL) / COUNT(T3.Region) AS average FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id INNER JOIN state AS T3 ON T2.state_abbrev = T3.StateCode WHERE T3.Region = 'Midwest'
What was the Attendance on September 26, 1971?
SELECT AVG(attendance) FROM table_name_86 WHERE date = "september 26, 1971"
What is the year First elected when the Member is John Armitage?
SELECT first_elected FROM table_name_6 WHERE member = "john armitage"
Show the number of buildings with a height above the average or a number of floors above the average.
SELECT count(*) FROM building WHERE height_feet > (SELECT avg(height_feet) FROM building) OR floors > (SELECT avg(floors) FROM building)
What is the sum of Year, when Rank is less than 19?
SELECT SUM(year) FROM table_name_4 WHERE rank < 19
Who are the employees working for publisher not located in USA? State the employee's name and publisher name.
SELECT T1.fname, T1.lname, T2.pub_name FROM employee AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.country != 'USA'
In March 2014, which weather stations recorded the highest number of days whose temperature is below the 30-year normal?
SELECT station_nbr FROM weather WHERE SUBSTR(`date`, 1, 4) = '2014' AND SUBSTR(`date`, 6, 2) = '03' AND depart < 0 GROUP BY station_nbr HAVING COUNT(DISTINCT `date`) = ( SELECT COUNT(DISTINCT `date`) FROM weather WHERE SUBSTR(`date`, 1, 4) = '2014' AND SUBSTR(`date`, 6, 2) = '03' AND depart < 0 GROUP BY station_nbr ORDER BY COUNT(`date`) DESC LIMIT 1 )
How many stations have been owned since wfts-tv?
SELECT owned_since FROM table_1847523_2 WHERE station = "WFTS-TV"
Show me the ids and names of these stations.
SELECT start_station_id , start_station_name FROM trip GROUP BY start_station_name HAVING COUNT ( * ) > = 200
How many players have the bowling skill greater than 2?
SELECT COUNT(Player_Name) FROM Player WHERE Bowling_skill > 2
What's the average survived with a to Iran less than 1, more than 1 destroyed, and a brazil tucano aircraft?
SELECT AVG(survived) FROM table_name_53 WHERE to_iran < 1 AND aircraft = "brazil tucano" AND destroyed > 1
Show the delegate and committee information of elections.
SELECT Delegate , Committee FROM election
display the first and last name, department, city, and state province for each employee.
SELECT T1.first_name , T1.last_name , T2.department_name , T3.city , T3.state_province FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id
what is the pick for alfred morris when the overall is less than 217, and the round is smaller than 6?
SELECT MAX(pick) FROM table_name_49 WHERE overall < 217 AND name = "alfred morris" AND round < 6
Name the number of points defending for 1075
SELECT COUNT(points) AS defending FROM table_23501776_16 WHERE new_points = 1075
Which movies have received the greatest ratings from female users whose occupations fall within the category of 3?
SELECT T2.movieid FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T1.u_gender = 'F' AND T1.occupation = 3 AND T2.rating = 5
Name the mixed doubles for zhu lin
SELECT mixed_doubles FROM table_14496232_2 WHERE womens_singles = "Zhu Lin"
What is the average number of votes of representatives from party "Republican"?
SELECT avg(T1.Votes) FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE T2.Party = "Republican"
Wow ! What was his account type?
SELECT acc_type FROM customer ORDER BY credit_score LIMIT 1
Find the name of airline which runs the most number of routes.
SELECT T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.name ORDER BY count(*) DESC LIMIT 1
What are the description and credit of the course which the student whose last name is Smithson took?
SELECT T4.crs_description , T4.crs_credit FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num JOIN course AS T4 ON T4.crs_code = T1.crs_code WHERE T3.stu_lname = 'Smithson'
The community station broadcasting at frequency 0 96.9 is in what band?
SELECT band FROM table_name_87 WHERE purpose = "community" AND frequency = "0 96.9"
Who's the shooter with a total of 25?
SELECT shooter FROM table_name_57 WHERE total = "25"
What is Set 2, when Date is May 31?
SELECT set_2 FROM table_name_67 WHERE date = "may 31"
Which average overall has a Round of 1, and a Position of center?
SELECT AVG(overall) FROM table_name_80 WHERE round = 1 AND position = "center"
What is the administrative division that has an area of 30 km^2?
SELECT administrative_division FROM table_171666_1 WHERE area__km²_ = 30
Calculate the average population per city in Karnataka district.
SELECT AVG(Population) FROM City WHERE District = 'Karnataka' GROUP BY ID
Show me the name of players?
SELECT name_first, name_last, name_given FROM player
Can you add host names to that table?
SELECT T2.name, T1.party_id , T1.host_id, T3.party_theme FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID
Find the last names of the members of the club "Bootup Baltimore".
SELECT t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore"
How many restaurants were inspected on 2015/5/8?
SELECT COUNT(T2.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.inspection_date = '2015-05-08' AND T1.facility_type = 'Restaurant'
What was the result under interim head coach, Gary Darnell?
SELECT result FROM table_name_62 WHERE interim_head_coach = "gary darnell"
Among the solutions that contain files within the repository followed by over 1000 people, how many of them can be implemented without needs of compilation?
SELECT COUNT(T2.RepoId) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Forks > 1000 AND T2.WasCompiled = 1
How many restaurants have more than 4 star reviews?
SELECT COUNT(id_restaurant) AS cnt FROM generalinfo WHERE review > 4
What is the highest taijijian with a 9.87 taijiquan and a total less than 19.77?
SELECT MAX(taijijian) FROM table_name_20 WHERE taijiquan = 9.87 AND total < 19.77
What are all of their professor high degree?
SELECT prof_high_degree from professor
Name the club for quevedo
SELECT club FROM table_2454589_1 WHERE home_city = "Quevedo"
What are the companies of entrepreneurs, ordered descending by amount of money requested?
SELECT Company FROM entrepreneur ORDER BY Money_Requested DESC
What state or district has a charter date of april 17, 2011?
SELECT us_state_district FROM table_name_51 WHERE charter_date = "april 17, 2011"
How many employees who are living in Australia and have the credit limit under 200000? State their email address and countries where they are working.
SELECT T2.email, T3.country FROM customers AS T1 INNER JOIN employees AS T2 ON T1.salesRepEmployeeNumber = T2.employeeNumber INNER JOIN offices AS T3 ON T2.officeCode = T3.officeCode WHERE T3.country = 'Australia' AND T1.creditLimit < 200000 AND T2.jobTitle = 'Sales Rep'
Find the number of songs in all the studio albums.
SELECT count(DISTINCT T3.title) FROM albums AS T1 JOIN tracklists AS T2 ON T1.aid = T2.albumid JOIN songs AS T3 ON T2.songid = T3.songid WHERE t1.type = "Studio"
What is the format for UK catalog S 63795?
SELECT format FROM table_name_90 WHERE country = "uk" AND catalog = "s 63795"
What is the 3 most common cloud cover rates in the region of zip code 94107?
SELECT cloud_cover FROM weather WHERE zip_code = 94107 GROUP BY cloud_cover ORDER BY COUNT (*) DESC LIMIT 3
Who is the Opponent in the game with a Record of 1–3–0?
SELECT opponent FROM table_name_26 WHERE record = "1–3–0"
What is the name, type, and flag of the ship that was built in the most recent year?
SELECT name , TYPE , flag FROM ship ORDER BY built_year DESC LIMIT 1
Which Venue has Against smaller than 6?
SELECT venue FROM table_name_82 WHERE against < 6
Nam ethe enlisted for troop carrier group
SELECT enlisted FROM table_23508196_5 WHERE type_of_unit = "Troop carrier group"
When did the web accelerator 'CACHEbox' and browser 'Internet Explorer' become compatible?
SELECT T1.compatible_since_year FROM accelerator_compatible_browser AS T1 JOIN browser AS T2 ON T1.browser_id = T2.id JOIN web_client_accelerator AS T3 ON T1.accelerator_id = T3.id WHERE T3.name = 'CACHEbox' AND T2.name = 'Internet Explorer'
What was the home team's score at the game attended by more than 24,637?
SELECT home_team AS score FROM table_name_81 WHERE crowd > 24 OFFSET 637
In the film with an inventory ID between 20 to 60, how many of the films have a G rating?
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.inventory_id BETWEEN 20 AND 60 AND T1.rating = 'G'
Name the points against for november 14
SELECT points_against FROM table_15607589_2 WHERE date = "November 14"
What is the number of households in the "FL-10" district?
SELECT SUM(CASE WHEN T2.district = 'FL-10' THEN 1 ELSE 0 END) FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code
What Elimination Move is listed against Wrestler Henry, Eliminated by Batista?
SELECT elimination AS Move FROM table_name_35 WHERE eliminated_by = "batista" AND wrestler = "henry"
Which province had a liberal party member on December 31, 2006?
SELECT province FROM table_name_38 WHERE party = "liberal" AND date = "december 31, 2006"
Show the name of each party and the corresponding number of delegates from that party.
SELECT T2.Party , COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party
What are the notes of the number 1 rank?
SELECT notes FROM table_name_52 WHERE rank = 1
How many students play Works of Widenius?
SELECT count ( distinct t1.StuID ) FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid where t2.GName = "Works of Widenius"
Can you list the details of all the customers please?
SELECT customer_details FROM customers
Who was in Lane 5?
SELECT name FROM table_name_84 WHERE lane = 5
What school is from 45 Lake county and is located in Merrillville?
SELECT school FROM table_name_32 WHERE county = "45 lake" AND location = "merrillville"
If the spectral type is g1v, what is the constellation?
SELECT constellation FROM table_1820752_1 WHERE spectral_type = "G1V"
What is the id of the longest song?
SELECT f_id FROM files ORDER BY duration DESC LIMIT 1
Show the name of the county with the biggest population.
SELECT County_name FROM county ORDER BY Population DESC LIMIT 1
How much March has Points of 85?
SELECT COUNT(march) FROM table_name_24 WHERE points = 85
How many female employees are in charge of 3 or more territories?
SELECT COUNT(EID) FROM ( SELECT T1.EmployeeID AS EID FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.TitleOfCourtesy IN ('Ms.' OR 'Mrs.') GROUP BY T1.EmployeeID HAVING COUNT(T2.TerritoryID) >= 3 ) T1
What number in the series was episode 2 in the season?
SELECT MAX(no_in_series) FROM table_2468961_3 WHERE no_in_season = 2
Which Away team is associated with the Richmond Home team?
SELECT away_team FROM table_name_13 WHERE home_team = "richmond"
Give the average number of working horses on farms with more than 5000 total horses.
SELECT avg(Working_Horses) FROM farm WHERE Total_Horses > 5000
Find the name and city of the airport which is the destination of the most number of routes.
SELECT T1.name , T1.city , T2.dst_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid GROUP BY T2.dst_apid ORDER BY count(*) DESC LIMIT 1
Can you tell me the sum of 100s that has the Team of deccan chargers, and the Match of 8, and the Average larger than 35.57?
SELECT SUM(100 AS s) FROM table_name_41 WHERE team = "deccan chargers" AND matches = 8 AND average > 35.57
Which customers have used the service named "Close a policy" or "Upgrade a policy"? Give me the customer names.
SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = "Close a policy" OR t3.service_name = "Upgrade a policy"
Could you add the total number of games played to that table please?
SELECT StuID , count ( * ) , sum ( gamesplayed ) FROM Sportsinfo GROUP BY StuID
Which Department has the most number of employee? tell me the rank and creation year.
SELECT ranking, creation from department where num_employees = ( select max ( num_employees ) from department )
How many venues had a race called the Australia Stakes?
SELECT COUNT(venue) FROM table_14981555_3 WHERE race = "Australia Stakes"
List all country and league names.
SELECT T1.name, T2.name FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id
hi I was wondering how many counties you have information for?
SELECT count ( DISTINCT T1.county ) FROM campuses AS T1 JOIN degrees AS T2 ON T1.id = T2.campus
what is the dept-code of student number 324257
SELECT DEPT_CODE from student where STU_NUM = 324257
how many employees are there?
SELECT count ( * ) FROM Employees
List out students that enrolled in occ school and enlisted in a fire department.
SELECT T1.name FROM enlist AS T1 INNER JOIN enrolled AS T2 ON T2.name = T1.name WHERE T2.school = 'occ' AND T1.organ = 'fire_department'
What is the official language spoken in the country whose head of state is Beatrix?
SELECT T2.Language FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.HeadOfState = "Beatrix" AND T2.IsOfficial = "T"
What is the sum of gold medals won by teams that won 5 total medals and fewer than 2 bronze medals?
SELECT SUM(gold) FROM table_name_23 WHERE total = 5 AND bronze < 2
Among the tweets posted from Santa Fe state in Argentina, how many of them were posted on 31st?
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.Day = 31 AND T2.State = 'Santa' AND T2.Country = 'Argentina'