question
stringlengths
63
269
answer
stringlengths
18
557
Show the name of colleges that have at least two players in descending alphabetical order. Additional table information: table: match_season
SELECT College FROM match_season GROUP BY College HAVING COUNT(*) >= 2 ORDER BY College DESC
Show the names of customers who have the most mailshots. Additional table information: table: customers_campaigns_ecommerce
SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC LIMIT 1
What is the average rating and resolution of all bangla songs? Additional table information: table: music_1
SELECT AVG(rating), AVG(resolution) FROM song WHERE languages = 'bangla'
Who directed Avatar? Additional table information: table: movie_1
SELECT director FROM Movie WHERE title = 'Avatar'
What are the names of all cities with more than one airport and how many airports do they have? Additional table information: table: flight_4
SELECT city, COUNT(*) FROM airports GROUP BY city HAVING COUNT(*) > 1
What are the names of tourist attractions that can be reached by walk or is at address 660 Shea Crescent? Additional table information: table: cre_Theme_park
SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = '660 Shea Crescent' OR T2.How_to_Get_There = 'walk'
What is the number of aircraft? Additional table information: table: aircraft
SELECT COUNT(*) FROM aircraft
Find the names of all the catalog entries. Additional table information: table: product_catalog
SELECT DISTINCT (catalog_entry_name) FROM catalog_contents
Find the average unit price for a track. Additional table information: table: chinook_1
SELECT AVG(UnitPrice) FROM TRACK
Show all branch names with the number of members in each branch registered after 2015. Additional table information: table: shop_membership
SELECT T2.name, COUNT(*) FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year > 2015 GROUP BY T2.branch_id
What are the different software platforms for devices, and how many devices have each? Additional table information: table: device
SELECT Software_Platform, COUNT(*) FROM device GROUP BY Software_Platform
What are the names of the tourist attractions Vincent and Marcelle visit? Additional table information: table: cre_Theme_park
SELECT T1.Name FROM Tourist_Attractions AS T1, VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = 'Vincent' INTERSECT SELECT T1.Name FROM Tourist_Attractions AS T1, VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = 'Marcelle'
Return the name and max speed of the storm that affected the most regions. Additional table information: table: storm_record
SELECT T1.name, T1.max_speed FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id ORDER BY COUNT(*) DESC LIMIT 1
Return the issue date of the volume that has spent the fewest weeks on top. Additional table information: table: music_4
SELECT Issue_Date FROM volume ORDER BY Weeks_on_Top ASC NULLS FIRST LIMIT 1
Report the distinct registration date and the election cycle. Additional table information: table: voter_2
SELECT DISTINCT Registration_Date, Election_Cycle FROM VOTING_RECORD
List three countries which are the origins of the least players. Additional table information: table: baseball_1
SELECT birth_country FROM player GROUP BY birth_country ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 3
How many games are played for all football games by students on scholarship? Additional table information: table: game_1
SELECT SUM(gamesplayed) FROM Sportsinfo WHERE sportname = 'Football' AND onscholarship = 'Y'
From which hometowns did both people older than 23 and younger than 20 come from? Additional table information: table: gymnast
SELECT Hometown FROM people WHERE Age > 23 INTERSECT SELECT Hometown FROM people WHERE Age < 20
Show the number of locations. Additional table information: table: cre_Doc_Tracking_DB
SELECT COUNT(*) FROM Ref_locations
Find the name of the artist who made the album 'Balls to the Wall'. Additional table information: table: chinook_1
SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = 'Balls to the Wall'
list all the names of programs, ordering by launch time. Additional table information: table: program_share
SELECT name FROM program ORDER BY launch NULLS FIRST
What are the names of ships that are commanded by both captains with the rank of Midshipman and captains with the rank of Lieutenant? Additional table information: table: ship_1
SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Midshipman' INTERSECT SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Lieutenant'
What are the names and ids of documents that have the type code BK? Additional table information: table: cre_Docs_and_Epenses
SELECT document_name, document_id FROM Documents WHERE document_type_code = 'BK'
What are the names of the chairs of festivals, sorted in ascending order of the year held? Additional table information: table: entertainment_awards
SELECT Chair_Name FROM festival_detail ORDER BY YEAR ASC NULLS FIRST
List the first and last name of students who are not living in the city with code HKG, and sorted the results by their ages. Additional table information: table: dorm_1
SELECT fname, lname FROM student WHERE city_code <> 'HKG' ORDER BY age NULLS FIRST
Find the average rating star for each movie that are not reviewed by Brittany Harris. Additional table information: table: movie_1
SELECT mID, AVG(stars) FROM Rating WHERE NOT mID IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = 'Brittany Harris') GROUP BY mID
How many parties do we have? Additional table information: table: party_people
SELECT COUNT(DISTINCT party_name) FROM party
Return the dates of ceremony and the results of all music festivals Additional table information: table: music_4
SELECT Date_of_ceremony, RESULT FROM music_festival
What are the names of all schools that have students trying out for the position of goal and 'mid'-field. Additional table information: table: soccer_2
SELECT cName FROM tryout WHERE pPos = 'goalie' INTERSECT SELECT cName FROM tryout WHERE pPos = 'mid'
What are the phone and email for customer Harold? Additional table information: table: cre_Drama_Workshop_Groups
SELECT Customer_Phone, Customer_Email_Address FROM CUSTOMERS WHERE Customer_Name = 'Harold'
Which themes have had corresponding exhibitions that have had attendance both below 100 and above 500? Additional table information: table: theme_gallery
SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance < 100 INTERSECT SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 500
Show different locations of railways along with the corresponding number of railways at each location. Additional table information: table: railway
SELECT LOCATION, COUNT(*) FROM railway GROUP BY LOCATION
What is the average latitude and longitude in San Jose? Additional table information: table: bike_1
SELECT AVG(lat), AVG(long) FROM station WHERE city = 'San Jose'
List all the characteristic names and data types of product 'cumin'. Additional table information: table: products_gen_characteristics
SELECT t3.characteristic_name, t3.characteristic_data_type 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 WHERE t1.product_name = 'cumin'
Please show the most common type of ships. Additional table information: table: ship_mission
SELECT TYPE FROM ship GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
Find the number and time of the train that goes from Chennai to Guruvayur. Additional table information: table: station_weather
SELECT train_number, TIME FROM train WHERE origin = 'Chennai' AND destination = 'Guruvayur'
What is the name of the movie produced after 2000 and directed by James Cameron? Additional table information: table: movie_1
SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000
How many services has each resident requested? List the resident id, details, and the count in descending order of the count. Additional table information: table: local_govt_and_lot
SELECT T1.resident_id, T1.other_details, COUNT(*) FROM Residents AS T1 JOIN Residents_Services AS T2 ON T1.resident_id = T2.resident_id GROUP BY T1.resident_id ORDER BY COUNT(*) DESC
Show the name, location, and number of platforms for all stations. Additional table information: table: train_station
SELECT name, LOCATION, number_of_platforms FROM station
How many students are enrolled in the class taught by some professor from the accounting department? Additional table information: table: college_1
SELECT COUNT(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN department AS T4 ON T3.dept_code = T4.dept_code WHERE T4.dept_name = 'Accounting'
Who are the friends of Bob? Additional table information: table: network_2
SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Bob'
Find the club which has the largest number of members majoring in '600'. Additional table information: table: club_1
SELECT t1.clubname 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 t3.major = '600' GROUP BY t1.clubname ORDER BY COUNT(*) DESC LIMIT 1
Show the average share count of transactions for different investors. Additional table information: table: tracking_share_transactions
SELECT investor_id, AVG(share_count) FROM TRANSACTIONS GROUP BY investor_id
What is the average duration of songs that have mp3 format and resolution below 800? Additional table information: table: music_1
SELECT AVG(T1.duration) FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = 'mp3' AND T2.resolution < 800
What is the first name of the band mate who perfomed in the most songs? Additional table information: table: music_2
SELECT t2.firstname FROM Performance AS t1 JOIN Band AS t2 ON t1.bandmate = t2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId GROUP BY firstname ORDER BY COUNT(*) DESC LIMIT 1
Find the names of nurses who are nursing an undergoing treatment. Additional table information: table: hospital_1
SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID
Give the names of tracks that do not have a race in the class 'GT'. Additional table information: table: race_track
SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id WHERE T1.class = 'GT'
List the all the assets make, model, details by the disposed date ascendingly. Additional table information: table: assets_maintenance
SELECT asset_make, asset_model, asset_details FROM Assets ORDER BY asset_disposed_date ASC NULLS FIRST
How many members have the black membership card? Additional table information: table: coffee_shop
SELECT COUNT(*) FROM member WHERE Membership_card = 'Black'
List the name of all projects that are operated longer than the average working hours of all projects. Additional table information: table: scientist_1
SELECT name FROM projects WHERE hours > (SELECT AVG(hours) FROM projects)
Find the id and last name of the teacher that has the most detentions with detention type code 'AFTER'? Additional table information: table: behavior_monitoring
SELECT T1.teacher_id, T2.last_name FROM Detention AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T1.detention_type_code = 'AFTER' GROUP BY T1.teacher_id ORDER BY COUNT(*) DESC LIMIT 1
Return the titles of films that include 'Deleted Scenes' in their special feature section. Additional table information: table: sakila_1
SELECT title FROM film WHERE special_features LIKE '%Deleted Scenes%'
What are the names and number of works for all artists who have sung at least one song in English? Additional table information: table: music_1
SELECT T1.artist_name, COUNT(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = 'english' GROUP BY T2.artist_name HAVING COUNT(*) >= 1
What is the location and name of the winning aircraft? Additional table information: table: aircraft
SELECT T2.Location, T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft
What are the names of all movies that were created after the most recent Steven Spielberg film? Additional table information: table: movie_1
SELECT title FROM Movie WHERE YEAR > (SELECT MAX(YEAR) FROM Movie WHERE director = 'Steven Spielberg')
Report the distinct advisors who have more than 2 students. Additional table information: table: voter_2
SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*) > 2
What are the titles and ids for albums containing tracks with unit price greater than 1? Additional table information: table: chinook_1
SELECT T1.Title, T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 GROUP BY T2.AlbumID
What is all the customer information for customers in NY state? Additional table information: table: chinook_1
SELECT * FROM CUSTOMER WHERE State = 'NY'
Show all allergy types. Additional table information: table: allergy_1
SELECT DISTINCT allergytype FROM Allergy_type
What is the id of the problem log that is created most recently? Additional table information: table: tracking_software_problems
SELECT problem_log_id FROM problem_log ORDER BY log_entry_date DESC LIMIT 1
Show the prices of the products named 'Dining' or 'Trading Policy'. Additional table information: table: solvency_ii
SELECT Product_Price FROM Products WHERE Product_Name = 'Dining' OR Product_Name = 'Trading Policy'
Which cities served as a host city after 2010? Additional table information: table: city_record
SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T2.year > 2010
What are the wines that have prices lower than 50 and have appelations in Monterey county? Additional table information: table: wine_1
SELECT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Monterey' AND T2.price < 50
Find the number of distinct bed types available in this inn. Additional table information: table: inn_1
SELECT COUNT(DISTINCT bedType) FROM Rooms
What is the first name, last name, and phone of the customer with card 4560596484842. Additional table information: table: customers_card_transactions
SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = '4560596484842'
Which film has the most number of actors or actresses? List the film name, film id and description. Additional table information: table: sakila_1
SELECT T2.title, T2.film_id, T2.description FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.film_id ORDER BY COUNT(*) DESC LIMIT 1
What is the average price for each type of product? Additional table information: table: department_store
SELECT product_type_code, AVG(product_price) FROM products GROUP BY product_type_code
What are the different types of transactions? Additional table information: table: customers_card_transactions
SELECT DISTINCT transaction_type FROM Financial_Transactions
Find the SSN and name of scientists who are assigned to the project with the longest hours. Additional table information: table: scientist_1
SELECT T3.ssn, T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.hours = (SELECT MAX(hours) FROM projects)
how many airports are there in each country? Additional table information: table: flight_company
SELECT COUNT(*), country FROM airport GROUP BY country
How many schools do not participate in the basketball match? Additional table information: table: university_basketball
SELECT COUNT(*) FROM university WHERE NOT school_id IN (SELECT school_id FROM basketball_match)
What are the types of every competition and in which countries are they located? Additional table information: table: sports_competition
SELECT Competition_type, Country FROM competition
For each country and airline name, how many routes are there? Additional table information: table: flight_4
SELECT T1.country, T1.name, COUNT(*) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.country, T1.name
List the teams of the players with the top 5 largest ages. Additional table information: table: school_player
SELECT Team FROM player ORDER BY Age DESC LIMIT 5
list the names of the companies with more than 200 sales in the descending order of sales and profits. Additional table information: table: company_employee
SELECT name FROM company WHERE Sales_in_Billion > 200 ORDER BY Sales_in_Billion NULLS FIRST, Profits_in_Billion DESC
What are the ids and names of all start stations that were the beginning of at least 200 trips? Additional table information: table: bike_1
SELECT start_station_id, start_station_name FROM trip GROUP BY start_station_name HAVING COUNT(*) >= 200
List the description of all the colors. Additional table information: table: products_gen_characteristics
SELECT color_description FROM ref_colors
What are the first names of all professors who teach more than one class? Additional table information: table: college_1
SELECT T2.emp_fname FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING COUNT(*) > 1
What is the name of the room that can accommodate the most people? Additional table information: table: inn_1
SELECT roomName FROM Rooms ORDER BY maxOccupancy DESC LIMIT 1
How many council taxes are collected for renting arrears ? Additional table information: table: local_govt_mdm
SELECT COUNT(*) FROM rent_arrears
Show name and salary for all employees sorted by salary. Additional table information: table: flight_1
SELECT name, salary FROM Employee ORDER BY salary NULLS FIRST
Find the building, room number, semester and year of all courses offered by Psychology department sorted by course titles. Additional table information: table: college_2
SELECT T2.building, T2.room_number, T2.semester, T2.year FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY T1.title NULLS FIRST
What are the different card type codes? Additional table information: table: customers_card_transactions
SELECT DISTINCT card_type_code FROM Customers_Cards
Show all dates of transactions whose type code is 'SALE'. Additional table information: table: tracking_share_transactions
SELECT date_of_transaction FROM TRANSACTIONS WHERE transaction_type_code = 'SALE'
Find the name, headquarter and founder of the manufacturer that has the highest revenue. Additional table information: table: manufactory_1
SELECT name, headquarter, founder FROM manufacturers ORDER BY revenue DESC LIMIT 1
Which industries have both companies with headquarter in 'USA' and companies with headquarter in 'China'? Additional table information: table: company_office
SELECT Industry FROM Companies WHERE Headquarters = 'USA' INTERSECT SELECT Industry FROM Companies WHERE Headquarters = 'China'
Find the number of albums. Additional table information: table: chinook_1
SELECT COUNT(*) FROM ALBUM
Show the name, location, open year for all tracks with a seating higher than the average. Additional table information: table: race_track
SELECT name, LOCATION, year_opened FROM track WHERE seating > (SELECT AVG(seating) FROM track)
Find the ids of reviewers who didn't only give 4 star. Additional table information: table: movie_1
SELECT rID FROM Rating WHERE stars <> 4
Find the common personal name of course authors and students. Additional table information: table: e_learning
SELECT personal_name FROM Course_Authors_and_Tutors INTERSECT SELECT personal_name FROM Students
What are the highest cost, lowest cost and average cost of procedures? Additional table information: table: hospital_1
SELECT MAX(cost), MIN(cost), AVG(cost) FROM procedures
List names of all pilot in descending order of age. Additional table information: table: aircraft
SELECT Name FROM pilot ORDER BY Age DESC
Show all the buildings that have at least 10 professors. Additional table information: table: activity_1
SELECT building FROM Faculty WHERE rank = 'Professor' GROUP BY building HAVING COUNT(*) >= 10
Find the addresses of the course authors who teach the course with name 'operating system' or 'data structure'. Additional table information: table: e_learning
SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = 'operating system' OR T2.course_name = 'data structure'
Tell me the the claim date and settlement date for each settlement case. Additional table information: table: insurance_policies
SELECT Date_Claim_Made, Date_Claim_Settled FROM Settlements
For each tourist attraction, return its name and the date when the tourists named Vincent or Vivian visited there. Additional table information: table: cre_Theme_park
SELECT T1.Name, T3.Visit_Date FROM Tourist_Attractions AS T1, VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = 'Vincent' OR T2.Tourist_Details = 'Vivian'
What are the department names, cities, and state provinces for each department? Additional table information: table: hr_1
SELECT T1.department_name, T2.city, T2.state_province FROM departments AS T1 JOIN locations AS T2 ON T2.location_id = T1.location_id
Find the name of department has the highest amount of students? Additional table information: table: college_2
SELECT dept_name FROM student GROUP BY dept_name ORDER BY COUNT(*) DESC LIMIT 1
Find all the product whose name contains the word 'Scanner'. Additional table information: table: store_product
SELECT product FROM product WHERE product LIKE '%Scanner%'
Show the game name that has most number of hours played. Additional table information: table: game_1
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid ORDER BY SUM(hours_played) DESC LIMIT 1