Question:
Find the name of the products that have the color description 'red' and have the characteristic name 'fast'.
Additional table information: table: products_gen_characteristics

Answer: SELECT product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = 'red' AND t3.characteristic_name = 'fast'


Question:
Please list the location and the winning aircraft name.
Additional table information: table: aircraft

Answer: SELECT T2.Location, T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft


Question:
What are the guest first name, start date, and end date of each apartment booking?
Additional table information: table: apartment_rentals

Answer: SELECT T2.guest_first_name, T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id


Question:
What are the different names for each station that has ever had 7 bikes available?
Additional table information: table: bike_1

Answer: SELECT DISTINCT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available = 7


Question:
List the names of all the distinct product names in alphabetical order?
Additional table information: table: tracking_software_problems

Answer: SELECT DISTINCT product_name FROM product ORDER BY product_name NULLS FIRST


Question:
What are the start date and end date of the booking that has booked the product named 'Book collection A'?
Additional table information: table: products_for_hire

Answer: SELECT T3.booking_start_date, T3.booking_end_date FROM Products_for_hire AS T1 JOIN products_booked AS T2 ON T1.product_id = T2.product_id JOIN bookings AS T3 ON T2.booking_id = T3.booking_id WHERE T1.product_name = 'Book collection A'


Question:
What are the names of all stations that have more than 10 bikes available and are not located in San Jose?
Additional table information: table: bike_1

Answer: SELECT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING AVG(bikes_available) > 10 EXCEPT SELECT name FROM station WHERE city = 'San Jose'


Question:
What are project ids of projects that have 2 or more corresponding documents?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT project_id FROM Documents GROUP BY project_id HAVING COUNT(*) >= 2


Question:
What is the description of document status code 'working'?
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT document_status_description FROM Ref_Document_Status WHERE document_status_code = 'working'


Question:
Which department has the most professors with a Ph.D.?
Additional table information: table: college_1

Answer: SELECT T2.dept_name, T1.dept_code FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.prof_high_degree = 'Ph.D.' GROUP BY T1.dept_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the name, city, and country of the airport with the highest elevation?
Additional table information: table: flight_4

Answer: SELECT name, city, country FROM airports ORDER BY elevation DESC LIMIT 1


Question:
Show year where a track with a seating at least 5000 opened and a track with seating no more than 4000 opened.
Additional table information: table: race_track

Answer: SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000


Question:
Find the average age of all students living in the each city.
Additional table information: table: dorm_1

Answer: SELECT AVG(age), city_code FROM student GROUP BY city_code


Question:
In which state is the college that Charles attends?
Additional table information: table: soccer_2

Answer: SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName JOIN player AS T3 ON T2.pID = T3.pID WHERE T3.pName = 'Charles'


Question:
What are the details of all organizations that are described as Sponsors and sort the results in ascending order?
Additional table information: table: tracking_grants_for_research

Answer: SELECT organisation_details FROM Organisations AS T1 JOIN organisation_Types AS T2 ON T1.organisation_type = T2.organisation_type WHERE T2.organisation_type_description = 'Sponsor' ORDER BY organisation_details NULLS FIRST


Question:
What are the details and ways to get to tourist attractions related to royal family?
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Royal_Family_Details, T2.How_to_Get_There FROM ROYAL_FAMILY AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Royal_Family_ID = T2.Tourist_Attraction_ID


Question:
Find the name of persons who are friends with Bob.
Additional table information: table: network_2

Answer: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Bob'


Question:
Count the number of farms.
Additional table information: table: farm

Answer: SELECT COUNT(*) FROM farm


Question:
What is the highest elevation of an airport in the country of Iceland?
Additional table information: table: flight_4

Answer: SELECT MAX(elevation) FROM airports WHERE country = 'Iceland'


Question:
Find the names of all directors whose movies are rated by Sarah Martinez.
Additional table information: table: movie_1

Answer: SELECT DISTINCT T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Sarah Martinez'


Question:
What are the different dorm amenity names in alphabetical order?
Additional table information: table: dorm_1

Answer: SELECT amenity_name FROM dorm_amenity ORDER BY amenity_name NULLS FIRST


Question:
How many different position for players are listed?
Additional table information: table: sports_competition

Answer: SELECT COUNT(DISTINCT POSITION) FROM player


Question:
List all customer status codes and the number of customers having each status code.
Additional table information: table: driving_school

Answer: SELECT customer_status_code, COUNT(*) FROM Customers GROUP BY customer_status_code


Question:
Find the names and descriptions of courses that belong to the subject named 'Computer Science'.
Additional table information: table: e_learning

Answer: SELECT T1.course_name, T1.course_description FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = 'Computer Science'


Question:
For each course id, how many students are registered and what are the course names?
Additional table information: table: student_assessment

Answer: SELECT T3.course_name, COUNT(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id


Question:
What is the average number of gold medals for a club?
Additional table information: table: sports_competition

Answer: SELECT AVG(Gold) FROM club_rank


Question:
Find the payment method code used by more than 3 parties.
Additional table information: table: e_government

Answer: SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING COUNT(*) > 3


Question:
Show the denomination shared by more than one school.
Additional table information: table: school_player

Answer: SELECT Denomination FROM school GROUP BY Denomination HAVING COUNT(*) > 1


Question:
What are the codes, names, and descriptions of the different document types?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code, document_type_name, document_type_description FROM Ref_document_types


Question:
How many lessons did the customer with the first name Ray take?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Ray'


Question:
Find the team of the player of the highest age.
Additional table information: table: school_player

Answer: SELECT Team FROM player ORDER BY Age DESC LIMIT 1


Question:
Find the full name of employee who supported the most number of customers.
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id = T2.support_rep_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show first name and last name for all the students advised by Michael Goodrich.
Additional table information: table: activity_1

Answer: SELECT T2.fname, T2.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.fname = 'Michael' AND T1.lname = 'Goodrich'


Question:
List the hardware model name for the phones that were produced by 'Nokia Corporation' or whose screen mode type is 'Graphics.'
Additional table information: table: phone_1

Answer: SELECT DISTINCT T2.Hardware_Model_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = 'Graphics' OR t2.Company_name = 'Nokia Corporation'


Question:
How many models do not have the wifi function?
Additional table information: table: phone_1

Answer: SELECT COUNT(*) FROM chip_model WHERE wifi = 'No'


Question:
Show all company names and headquarters in the descending order of market value.
Additional table information: table: gas_company

Answer: SELECT company, headquarters FROM company ORDER BY market_value DESC


Question:
Find the number of vocal types used in song 'Le Pop'
Additional table information: table: music_2

Answer: SELECT COUNT(*) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE title = 'Le Pop'


Question:
How many papers are published in total?
Additional table information: table: icfp_1

Answer: SELECT COUNT(*) FROM papers


Question:
What are the first names of the people in alphabetical order?
Additional table information: table: student_assessment

Answer: SELECT first_name FROM people ORDER BY first_name NULLS FIRST


Question:
Show names of shops that have more than one kind of device in stock.
Additional table information: table: device

Answer: SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T1.Shop_ID HAVING COUNT(*) > 1


Question:
What are the first names, office locations, and departments of all instructors, and also what are the descriptions of the courses they teach?
Additional table information: table: college_1

Answer: SELECT T2.emp_fname, T4.prof_office, T3.crs_description, T5.dept_name 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 JOIN department AS T5 ON T4.dept_code = T5.dept_code


Question:
What are the lot details of lots associated with transactions whose share count is bigger than 100 and whose type code is 'PUR'?
Additional table information: table: tracking_share_transactions

Answer: SELECT T1.lot_details FROM LOTS AS T1 JOIN TRANSACTIONS_LOTS AS T2 ON T1.lot_id = T2.transaction_id JOIN TRANSACTIONS AS T3 ON T2.transaction_id = T3.transaction_id WHERE T3.share_count > 100 AND T3.transaction_type_code = 'PUR'


Question:
Tell me the types of the policy used by the customer named 'Dayana Robel'.
Additional table information: table: insurance_fnol

Answer: SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = 'Dayana Robel'


Question:
What are the title and rental rate of the film with the highest rental rate?
Additional table information: table: sakila_1

Answer: SELECT title, rental_rate FROM film ORDER BY rental_rate DESC LIMIT 1


Question:
Find the name of route that has the highest number of deliveries.
Additional table information: table: customer_deliveries

Answer: SELECT t1.route_name FROM Delivery_Routes AS t1 JOIN Delivery_Route_Locations AS t2 ON t1.route_id = t2.route_id GROUP BY t1.route_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
find the number of different programs that are broadcast during night time.
Additional table information: table: program_share

Answer: SELECT COUNT(DISTINCT program_id) FROM broadcast WHERE time_of_day = 'Night'


Question:
For the airline ids with the top 10 most routes operated, what are their names?
Additional table information: table: flight_4

Answer: SELECT T1.name, T2.alid FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T2.alid ORDER BY COUNT(*) DESC LIMIT 10


Question:
Count the number of programs.
Additional table information: table: program_share

Answer: SELECT COUNT(*) FROM program


Question:
What are the date and venue of each debate?
Additional table information: table: debate

Answer: SELECT Date, Venue FROM debate


Question:
Which three cities have the largest regional population?
Additional table information: table: city_record

Answer: SELECT city FROM city ORDER BY regional_population DESC LIMIT 3


Question:
What are the names of the songs without a lead vocal?
Additional table information: table: music_2

Answer: SELECT DISTINCT title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid = t2.songid EXCEPT SELECT t2.title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid = t2.songid WHERE TYPE = 'lead'


Question:
What are the rank, first name, and last name of the faculty members?
Additional table information: table: activity_1

Answer: SELECT rank, Fname, Lname FROM Faculty


Question:
What is the id and name of the browser that is compatible with the most web accelerators?
Additional table information: table: browser_web

Answer: SELECT T1.id, T1.name FROM browser AS T1 JOIN accelerator_compatible_browser AS T2 ON T1.id = T2.browser_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the title and id of the film which has a rental rate of 0.99 and an inventory of below 3?
Additional table information: table: sakila_1

Answer: SELECT title, film_id FROM film WHERE rental_rate = 0.99 INTERSECT SELECT T1.title, T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id HAVING COUNT(*) < 3


Question:
What is the name and id of the staff who recorded the fault log but has not contacted any visiting engineers?
Additional table information: table: assets_maintenance

Answer: SELECT T1.staff_name, T1.staff_id FROM Staff AS T1 JOIN Fault_Log AS T2 ON T1.staff_id = T2.recorded_by_staff_id EXCEPT SELECT T3.staff_name, T3.staff_id FROM Staff AS T3 JOIN Engineer_Visits AS T4 ON T3.staff_id = T4.contact_staff_id


Question:
Find the name of the user who tweeted more than once, and number of tweets tweeted by them.
Additional table information: table: twitter_1

Answer: SELECT T1.name, COUNT(*) FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid HAVING COUNT(*) > 1


Question:
Find the first names and offices of all instructors who have taught some course and also find the course description.
Additional table information: table: college_1

Answer: SELECT T2.emp_fname, T4.prof_office, T3.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


Question:
Return the categories of music festivals that have the result 'Awarded'.
Additional table information: table: music_4

Answer: SELECT Category FROM music_festival WHERE RESULT = 'Awarded'


Question:
Show minimum, maximum, and average market value for all companies.
Additional table information: table: gas_company

Answer: SELECT MIN(market_value), MAX(market_value), AVG(market_value) FROM company


Question:
List every album whose title starts with A in alphabetical order.
Additional table information: table: store_1

Answer: SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title NULLS FIRST


Question:
Give the neames of wines with prices below 50 and with appelations in Monterey county.
Additional table information: table: wine_1

Answer: SELECT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Monterey' AND T2.price < 50


Question:
Find the total number of rooms in the apartments that have facility code 'Gym'.
Additional table information: table: apartment_rentals

Answer: SELECT SUM(T2.room_count) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.facility_code = 'Gym'


Question:
Find the campus fee of 'San Jose State University' in year 2000.
Additional table information: table: csu_1

Answer: SELECT t1.campusfee FROM csu_fees AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t2.campus = 'San Jose State University' AND t1.year = 2000


Question:
Return the average price for each product type.
Additional table information: table: department_store

Answer: SELECT product_type_code, AVG(product_price) FROM products GROUP BY product_type_code


Question:
Find the number of students for each department.
Additional table information: table: college_1

Answer: SELECT COUNT(*), dept_code FROM student GROUP BY dept_code


Question:
Find the parties associated with the delegates from district 1. Who served as governors of the parties?
Additional table information: table: election

Answer: SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1


Question:
Find the last name of students who is either female (sex is F) and living in the city of code BAL or male (sex is M) and in age of below 20.
Additional table information: table: dorm_1

Answer: SELECT lname FROM student WHERE sex = 'F' AND city_code = 'BAL' UNION SELECT lname FROM student WHERE sex = 'M' AND age < 20


Question:
What is the name of the browser that became compatible with the accelerator 'CProxy' after year 1998 ?
Additional table information: table: browser_web

Answer: SELECT T1.name FROM browser AS T1 JOIN accelerator_compatible_browser AS T2 ON T1.id = T2.browser_id JOIN web_client_accelerator AS T3 ON T2.accelerator_id = T3.id WHERE T3.name = 'CProxy' AND T2.compatible_since_year > 1998


Question:
How many distinct companies are there?
Additional table information: table: entrepreneur

Answer: SELECT COUNT(DISTINCT Company) FROM entrepreneur


Question:
On which day has it neither been foggy nor rained in the zip code of 94107?
Additional table information: table: bike_1

Answer: SELECT date FROM weather WHERE zip_code = 94107 AND EVENTS <> 'Fog' AND EVENTS <> 'Rain'


Question:
Show the carriers of devices in stock at more than one shop.
Additional table information: table: device

Answer: 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


Question:
Count the number of films.
Additional table information: table: film_rank

Answer: SELECT COUNT(*) FROM film


Question:
What are the ids of products from the supplier with id 2, which are more expensive than the average price across all products?
Additional table information: table: department_store

Answer: SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 2 AND T2.product_price > (SELECT AVG(product_price) FROM products)


Question:
Show the locations that have at least two performances.
Additional table information: table: performance_attendance

Answer: SELECT LOCATION FROM performance GROUP BY LOCATION HAVING COUNT(*) >= 2


Question:
Find the id and number of shops for the company that produces the most expensive furniture.
Additional table information: table: manufacturer

Answer: SELECT t1.manufacturer_id, t1.num_of_shops FROM manufacturer AS t1 JOIN furniture_manufacte AS t2 ON t1.manufacturer_id = t2.manufacturer_id ORDER BY t2.Price_in_Dollar DESC LIMIT 1


Question:
What are the names of all tracks that are on playlists titled Movies?
Additional table information: table: store_1

Answer: SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T3.id = T2.playlist_id WHERE T3.name = 'Movies'


Question:
What are the distinct names of wines with prices higher than any wine from John Anthony winery.
Additional table information: table: wine_1

Answer: SELECT DISTINCT Name FROM WINE WHERE Price > (SELECT MIN(Price) FROM wine WHERE Winery = 'John Anthony')


Question:
Show names for artists without any exhibition.
Additional table information: table: theme_gallery

Answer: SELECT name FROM artist WHERE NOT artist_id IN (SELECT artist_id FROM exhibition)


Question:
What is the id, genre, and name of the artist for every English song ordered by ascending rating?
Additional table information: table: music_1

Answer: SELECT f_id, genre_is, artist_name FROM song WHERE languages = 'english' ORDER BY rating NULLS FIRST


Question:
Who are the nominees who have been nominated more than two times?
Additional table information: table: musical

Answer: SELECT Nominee FROM musical GROUP BY Nominee HAVING COUNT(*) > 2


Question:
Show names of climbers and the names of mountains they climb.
Additional table information: table: climbing

Answer: SELECT T1.Name, T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID


Question:
Show the type of school and the number of buses for each type.
Additional table information: table: school_bus

Answer: SELECT T2.type, COUNT(*) FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id GROUP BY T2.type


Question:
What are the log id and entry description of each problem?
Additional table information: table: tracking_software_problems

Answer: SELECT problem_log_id, log_entry_description FROM problem_log


Question:
Find the subject ID, name of subject and the corresponding number of courses for each subject, and sort by the course count in ascending order.
Additional table information: table: e_learning

Answer: SELECT T1.subject_id, T2.subject_name, COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT(*) ASC NULLS FIRST


Question:
Give me the number of faculty members who participate in an activity
Additional table information: table: activity_1

Answer: SELECT COUNT(DISTINCT FacID) FROM Faculty_participates_in


Question:
display all the information about the department Marketing.
Additional table information: table: hr_1

Answer: SELECT * FROM departments WHERE department_name = 'Marketing'


Question:
Give the title of the course offered in Chandler during the Fall of 2010.
Additional table information: table: college_2

Answer: SELECT T1.title FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE building = 'Chandler' AND semester = 'Fall' AND YEAR = 2010


Question:
Show the distinct apartment numbers of the apartments that have bookings with status code 'Confirmed'.
Additional table information: table: apartment_rentals

Answer: SELECT DISTINCT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = 'Confirmed'


Question:
Show the protein name and the institution name.
Additional table information: table: protein_institute

Answer: SELECT T2.protein_name, T1.institution FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id


Question:
Find the names of customers who ordered both products Latte and Americano.
Additional table information: table: customers_and_addresses

Answer: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Latte' INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Americano'


Question:
Show the enrollment and primary_conference of the oldest college.
Additional table information: table: university_basketball

Answer: SELECT enrollment, primary_conference FROM university ORDER BY founded NULLS FIRST LIMIT 1


Question:
What are the task details, task ids, and project ids for the progrects that are detailed as 'omnis' or have at least 3 outcomes?
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.task_details, T1.task_id, T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id WHERE T2.project_details = 'omnis' UNION SELECT T1.task_details, T1.task_id, T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id JOIN Project_outcomes AS T3 ON T2.project_id = T3.project_id GROUP BY T2.project_id HAVING COUNT(*) > 2


Question:
What is the name of the customer who has the most policies listed?
Additional table information: table: insurance_fnol

Answer: SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
What amenities does Smith Hall have in alphabetical order?
Additional table information: table: dorm_1

Answer: SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' ORDER BY T3.amenity_name NULLS FIRST


Question:
What is the customer id of the customer with the most accounts, and how many accounts does this person have?
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Give the average number of cities within markets that had a low market estimation larger than 10000?
Additional table information: table: film_rank

Answer: SELECT AVG(T2.Number_cities) FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID WHERE T1.Low_Estimate > 10000


Question:
Which country does customer with first name as Carole and last name as Bernhard lived in?
Additional table information: table: driving_school

Answer: SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = 'Carole' AND T1.last_name = 'Bernhard'


Question:
What are the last names of the teachers who teach the student called GELL TAMI?
Additional table information: table: student_1

Answer: SELECT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = 'GELL' AND T1.lastname = 'TAMI'


Question:
Return the type name, type description, and date of creation for each document.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.document_type_name, T1.document_type_description, T2.Document_date FROM Ref_document_types AS T1 JOIN Documents AS T2 ON T1.document_type_code = T2.document_type_code


Question:
Count the number of distinct channel owners.
Additional table information: table: program_share

Answer: SELECT COUNT(DISTINCT OWNER) FROM channel


Question:
Show all opening years and the number of churches that opened in that year.
Additional table information: table: wedding

Answer: SELECT open_date, COUNT(*) FROM church GROUP BY open_date


Question:
Please give me a list of cities whose regional population is over 8000000 or under 5000000.
Additional table information: table: city_record

Answer: SELECT city FROM city WHERE regional_population > 10000000 UNION SELECT city FROM city WHERE regional_population < 5000000


Question:
Find the name of bank branches that provided some loans.
Additional table information: table: loan_1

Answer: SELECT DISTINCT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id


Question:
Show the album names and ids for albums that contain tracks with unit price bigger than 1.
Additional table information: table: chinook_1

Answer: 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


Question:
What are the names and average prices of products for manufacturers whose products cost on average 150 or more?
Additional table information: table: manufactory_1

Answer: SELECT AVG(T1.Price), T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name HAVING AVG(T1.price) >= 150


Question:
Count the number of artists.
Additional table information: table: theme_gallery

Answer: SELECT COUNT(*) FROM artist


Question:
Give me a list of cities whose temperature in Mar is lower than that in Dec and which have never been host cities.
Additional table information: table: city_record

Answer: SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Dec EXCEPT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city


Question:
Find the first names of teachers whose email address contains the word 'man'.
Additional table information: table: behavior_monitoring

Answer: SELECT first_name FROM Teachers WHERE email_address LIKE '%man%'


Question:
What are the names of all people who are friends with Alice for the shortest amount of time?
Additional table information: table: network_2

Answer: SELECT name FROM PersonFriend WHERE friend = 'Alice' AND YEAR = (SELECT MIN(YEAR) FROM PersonFriend WHERE friend = 'Alice')


Question:
Find all the building full names containing the word 'court'.
Additional table information: table: apartment_rentals

Answer: SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE '%court%'


Question:
Find the names of customers who are not living in the state of California.
Additional table information: table: customer_deliveries

Answer: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = 'California'


Question:
Show all countries and the number of people from each country.
Additional table information: table: wedding

Answer: SELECT country, COUNT(*) FROM people GROUP BY country


Question:
Please list the name and id of all artists that have at least 3 albums in alphabetical order.
Additional table information: table: chinook_1

Answer: SELECT T2.Name, T1.ArtistId FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistID GROUP BY T1.ArtistId HAVING COUNT(*) >= 3 ORDER BY T2.Name NULLS FIRST


Question:
What is the name of the artist with the greatest number of albums?
Additional table information: table: chinook_1

Answer: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC LIMIT 1


Question:
display the employee ID and job name for all those jobs in department 80.
Additional table information: table: hr_1

Answer: SELECT T1.employee_id, T2.job_title FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.department_id = 80


Question:
Return the names of gymnasts who did not grow up in Santo Domingo.
Additional table information: table: gymnast

Answer: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE T2.Hometown <> 'Santo Domingo'


Question:
What is the first and last name of the artist who performed back stage for the song 'Der Kapitan'?
Additional table information: table: music_2

Answer: SELECT T2.firstname, T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T3.Title = 'Der Kapitan' AND T1.StagePosition = 'back'


Question:
Find the first name of the band mate that has performed in most songs.
Additional table information: table: music_2

Answer: 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


Question:
List the hardware model name for the phones that have screen mode type 'Text' or RAM size greater than 32.
Additional table information: table: phone_1

Answer: SELECT T2.Hardware_Model_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model JOIN screen_mode AS T3 ON T2.screen_mode = T3.Graphics_mode WHERE T3.Type = 'Text' OR T1.RAM_MiB > 32


Question:
Find all the songs that do not have a back vocal.
Additional table information: table: music_2

Answer: SELECT DISTINCT title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid = t2.songid EXCEPT SELECT t2.title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid = t2.songid WHERE TYPE = 'back'


Question:
Show the tourist attractions visited by the tourist whose detail is 'Vincent'.
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID JOIN VISITORS AS T3 ON T2.Tourist_ID = T3.Tourist_ID WHERE T3.Tourist_Details = 'Vincent'


Question:
Show the names of people, and dates and venues of debates they are on the negative side, ordered in ascending alphabetical order of name.
Additional table information: table: debate

Answer: SELECT T3.Name, T2.Date, T2.Venue FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Negative = T3.People_ID ORDER BY T3.Name ASC NULLS FIRST


Question:
Find the name of companies whose revenue is smaller than the revenue of all companies based in Austin.
Additional table information: table: manufactory_1

Answer: SELECT name FROM manufacturers WHERE revenue < (SELECT MIN(revenue) FROM manufacturers WHERE headquarter = 'Austin')


Question:
Give me the times and numbers of all trains that go to Chennai, ordered by time.
Additional table information: table: station_weather

Answer: SELECT TIME, train_number FROM train WHERE destination = 'Chennai' ORDER BY TIME NULLS FIRST


Question:
What are the names of all tracks that belong to the Rock genre and whose media type is MPEG?
Additional table information: table: store_1

Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = 'Rock' OR T3.name = 'MPEG audio file'


Question:
Which month has the most happy hours?
Additional table information: table: coffee_shop

Answer: SELECT MONTH FROM happy_hour GROUP BY MONTH ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the mission codes, fates, and names of the ships involved?
Additional table information: table: ship_mission

Answer: SELECT T1.Code, T1.Fate, T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID


Question:
How many Patent outcomes are generated from all the projects?
Additional table information: table: tracking_grants_for_research

Answer: SELECT COUNT(*) FROM Project_outcomes WHERE outcome_code = 'Patent'


Question:
List the document ids for any documents with the status code done and the type code paper.
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT document_id FROM Documents WHERE document_status_code = 'done' AND document_type_code = 'Paper'


Question:
What is the detail of each visitor?
Additional table information: table: cre_Theme_park

Answer: SELECT Tourist_Details FROM VISITORS


Question:
Return the minimum and maximum crime rates across all counties.
Additional table information: table: county_public_safety

Answer: SELECT MIN(Crime_rate), MAX(Crime_rate) FROM county_public_safety


Question:
What is first names of the top 5 staff who have handled the greatest number of complaints?
Additional table information: table: customer_complaints

Answer: SELECT t1.first_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id GROUP BY t2.staff_id ORDER BY COUNT(*) NULLS FIRST LIMIT 5


Question:
What are the names of all the customers in alphabetical order?
Additional table information: table: small_bank_1

Answer: SELECT name FROM accounts ORDER BY name NULLS FIRST


Question:
List the id of students who attended  statistics courses in the order of attendance date.
Additional table information: table: student_assessment

Answer: SELECT T2.student_id FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'statistics' ORDER BY T2.date_of_attendance NULLS FIRST


Question:
Tell me the total quantity of products bought by the customer called 'Rodrick Heaney'.
Additional table information: table: customers_and_addresses

Answer: SELECT SUM(t3.order_quantity) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = 'Rodrick Heaney'


Question:
What are the full names and salaries for any employees earning less than 6000?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary FROM employees WHERE salary < 6000


Question:
What is the first name of the students who are in age 20 to 25 and living in PHL city?
Additional table information: table: dorm_1

Answer: SELECT fname FROM student WHERE city_code = 'PHL' AND age BETWEEN 20 AND 25


Question:
What are the names of all instructors with names that include 'dar'?
Additional table information: table: college_2

Answer: SELECT name FROM instructor WHERE name LIKE '%dar%'


Question:
Return the investors who have invested in two or more entrepreneurs.
Additional table information: table: entrepreneur

Answer: SELECT Investor FROM entrepreneur GROUP BY Investor HAVING COUNT(*) >= 2


Question:
Show the nations that have both journalists with more than 10 years of working and journalists with less than 3 years of working.
Additional table information: table: news_report

Answer: SELECT Nationality FROM journalist WHERE Years_working > 10 INTERSECT SELECT Nationality FROM journalist WHERE Years_working < 3


Question:
What is the total amount of grant money given to each organization and what is its id?
Additional table information: table: tracking_grants_for_research

Answer: SELECT SUM(grant_amount), organisation_id FROM Grants GROUP BY organisation_id


Question:
What are the payment date of the payment with amount paid higher than 300 or with payment type is 'Check'
Additional table information: table: products_for_hire

Answer: SELECT payment_date FROM payments WHERE amount_paid > 300 OR payment_type_code = 'Check'


Question:
What are the names of all the stores located in Khanewal District?
Additional table information: table: store_product

Answer: SELECT t1.store_name FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id WHERE t3.district_name = 'Khanewal District'


Question:
What is the ship with the largest amount of tonnage called?
Additional table information: table: ship_mission

Answer: SELECT Name FROM ship ORDER BY Tonnage DESC LIMIT 1


Question:
What are the names of the courses taught by the tutor whose personal name is 'Julio'?
Additional table information: table: e_learning

Answer: SELECT T2.course_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T1.personal_name = 'Julio'


Question:
Give the names of the courses with at least five enrollments.
Additional table information: table: college_3

Answer: SELECT T1.CName FROM COURSE AS T1 JOIN ENROLLED_IN AS T2 ON T1.CID = T2.CID GROUP BY T2.CID HAVING COUNT(*) >= 5


Question:
What are the full names and department ids for the lowest paid employees across all departments.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, department_id FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id)


Question:
List the clubs having 'Davis Steven' as a member.
Additional table information: table: club_1

Answer: SELECT DISTINCT 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.fname = 'Davis' AND t3.lname = 'Steven'


Question:
What is the maximum length in meters for the bridges and what are the architects' names?
Additional table information: table: architecture

Answer: SELECT MAX(T1.length_meters), T2.name FROM bridge AS T1 JOIN architect AS T2 ON T1.architect_id = T2.id


Question:
Among those engineers who have visited, which engineer makes the least number of visits? List the engineer id, first name and last name.
Additional table information: table: assets_maintenance

Answer: SELECT T1.engineer_id, T1.first_name, T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 ON T1.engineer_id = T2.engineer_id GROUP BY T1.engineer_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Show the top 3 most common colleges of players in match seasons.
Additional table information: table: match_season

Answer: SELECT College FROM match_season GROUP BY College ORDER BY COUNT(*) DESC LIMIT 3


Question:
Show me the departure date and arrival date for all flights from Los Angeles to Honolulu.
Additional table information: table: flight_1

Answer: SELECT departure_date, arrival_date FROM Flight WHERE origin = 'Los Angeles' AND destination = 'Honolulu'


Question:
Show the customer id and number of accounts with most accounts.
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of artists who have not released any albums?
Additional table information: table: chinook_1

Answer: SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId


Question:
How many courses do the student whose id is 171 attend?
Additional table information: table: student_assessment

Answer: SELECT COUNT(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T2.student_id = 171


Question:
For each file format, return the number of artists who released songs in that format.
Additional table information: table: music_1

Answer: SELECT COUNT(*), formats FROM files GROUP BY formats


Question:
Show the name, phone, and payment method code for all customers in descending order of customer number.
Additional table information: table: customers_and_products_contacts

Answer: SELECT customer_name, customer_phone, payment_method_code FROM customers ORDER BY customer_number DESC


Question:
Which model has the least amount of RAM? List the model name and the amount of RAM.
Additional table information: table: phone_1

Answer: SELECT Model_name, RAM_MiB FROM chip_model ORDER BY RAM_MiB ASC NULLS FIRST LIMIT 1


Question:
What are the dates in which the mean sea level pressure was between 30.3 and 31?
Additional table information: table: bike_1

Answer: SELECT date FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31


Question:
What are the dates and locations of performances?
Additional table information: table: performance_attendance

Answer: SELECT Date, LOCATION FROM performance


Question:
Show the working years of managers in descending order of their level.
Additional table information: table: railway

Answer: SELECT Working_year_starts FROM manager ORDER BY LEVEL DESC


Question:
For each account type, find the average account balance of customers with credit score lower than 50.
Additional table information: table: loan_1

Answer: SELECT AVG(acc_bal), acc_type FROM customer WHERE credit_score < 50 GROUP BY acc_type


Question:
which poll source does the highest oppose rate come from?
Additional table information: table: candidate_poll

Answer: SELECT poll_source FROM candidate ORDER BY oppose_rate DESC LIMIT 1


Question:
Find the distinct Advisor of students who have treasurer votes in the spring election cycle.
Additional table information: table: voter_2

Answer: SELECT DISTINCT T1.Advisor FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote WHERE T2.Election_Cycle = 'Spring'


Question:
Which song has the most vocals?
Additional table information: table: music_2

Answer: SELECT title FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid GROUP BY T1.songid ORDER BY COUNT(*) DESC LIMIT 1


Question:
When did the staff member with first name as Janessa and last name as Sawayn leave the company?
Additional table information: table: driving_school

Answer: SELECT date_left_staff FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'


Question:
What is the name of the most expensive product?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Product_Name FROM PRODUCTS ORDER BY Product_Price DESC LIMIT 1


Question:
Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order of year.
Additional table information: table: movie_1

Answer: SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year NULLS FIRST


Question:
Show the names of pilots and models of aircrafts they have flied with.
Additional table information: table: pilot_record

Answer: SELECT T3.Pilot_name, T2.Model FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID


Question:
Return the founded year for the school with the largest enrollment.
Additional table information: table: university_basketball

Answer: SELECT founded FROM university ORDER BY enrollment DESC LIMIT 1


Question:
In which year were most of ships built?
Additional table information: table: ship_1

Answer: SELECT built_year FROM ship GROUP BY built_year ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the account name, id and the number of transactions for each account.
Additional table information: table: customers_and_invoices

Answer: SELECT T2.account_name, T1.account_id, COUNT(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id


Question:
What are the codes of types of documents of which there are for or more?
Additional table information: table: document_management

Answer: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING COUNT(*) > 4


Question:
List all characteristics of product named 'sesame' with type code 'Grade'.
Additional table information: table: products_gen_characteristics

Answer: SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = 'sesame' AND t3.characteristic_type_code = 'Grade'


Question:
Which institution has the most papers? Find the name of the institution.
Additional table information: table: icfp_1

Answer: SELECT t1.name FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.name ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many cities are there that have more than 3 airports?
Additional table information: table: flight_4

Answer: SELECT COUNT(*) FROM (SELECT city FROM airports GROUP BY city HAVING COUNT(*) > 3)


Question:
What is the name of the marketing region that the store Rob Dinning belongs to?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.Marketing_Region_Name FROM Marketing_Regions AS T1 JOIN Stores AS T2 ON T1.Marketing_Region_Code = T2.Marketing_Region_Code WHERE T2.Store_Name = 'Rob Dinning'


Question:
What are the titles of all the albums alphabetically ascending?
Additional table information: table: store_1

Answer: SELECT title FROM albums ORDER BY title NULLS FIRST


Question:
Show all student IDs with more than total 10 hours per week on all sports played.
Additional table information: table: game_1

Answer: SELECT StuID FROM Sportsinfo GROUP BY StuID HAVING SUM(hoursperweek) > 10


Question:
Find the name of the airports located in Cuba or Argentina.
Additional table information: table: flight_4

Answer: SELECT name FROM airports WHERE country = 'Cuba' OR country = 'Argentina'


Question:
Where is the headquarter of the company founded by James?
Additional table information: table: manufactory_1

Answer: SELECT headquarter FROM manufacturers WHERE founder = 'James'


Question:
Find the names and opening hours of the tourist attractions that we get to by bus or walk.
Additional table information: table: cre_Theme_park

Answer: SELECT Name, Opening_Hours FROM TOURIST_ATTRACTIONS WHERE How_to_Get_There = 'bus' OR How_to_Get_There = 'walk'


Question:
What is the name and opening year for the branch that registered the most members in 2016?
Additional table information: table: shop_membership

Answer: SELECT T2.name, T2.open_year FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year = 2016 GROUP BY T2.branch_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names, dates active, and number of deaths for storms that had 1 or more death?
Additional table information: table: storm_record

Answer: SELECT name, dates_active, number_deaths FROM storm WHERE number_deaths >= 1


Question:
What are the start date and end date of each apartment booking?
Additional table information: table: apartment_rentals

Answer: SELECT booking_start_date, booking_end_date FROM Apartment_Bookings


Question:
Show the guest first names, start dates, and end dates of all the apartment bookings.
Additional table information: table: apartment_rentals

Answer: SELECT T2.guest_first_name, T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id


Question:
Find the number of investors in total.
Additional table information: table: tracking_share_transactions

Answer: SELECT COUNT(*) FROM INVESTORS


Question:
How many department stores does the store chain South have?
Additional table information: table: department_store

Answer: SELECT COUNT(*) FROM department_stores AS T1 JOIN department_store_chain AS T2 ON T1.dept_store_chain_id = T2.dept_store_chain_id WHERE T2.dept_store_chain_name = 'South'


Question:
What are the ids of the top three products that were purchased in the largest amount?
Additional table information: table: department_store

Answer: SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3


Question:
How long is the total lesson time took by the customer named Rylan Goodwin?
Additional table information: table: driving_school

Answer: SELECT SUM(T1.lesson_time) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Rylan' AND T2.last_name = 'Goodwin'


Question:
How many events are there?
Additional table information: table: swimming

Answer: SELECT COUNT(*) FROM event


Question:
Show the shop addresses ordered by their opening year.
Additional table information: table: coffee_shop

Answer: SELECT address FROM shop ORDER BY open_year NULLS FIRST


Question:
List the names of climbers in descending order of points.
Additional table information: table: climbing

Answer: SELECT Name FROM climber ORDER BY Points DESC


Question:
What is the total number of all football games played by scholarship students?
Additional table information: table: game_1

Answer: SELECT SUM(gamesplayed) FROM Sportsinfo WHERE sportname = 'Football' AND onscholarship = 'Y'


Question:
What are the names of buildings sorted in descending order of building height?
Additional table information: table: company_office

Answer: SELECT name FROM buildings ORDER BY Height DESC


Question:
What are the names of projects that have not been assigned?
Additional table information: table: scientist_1

Answer: SELECT Name FROM Projects WHERE NOT Code IN (SELECT Project FROM AssignedTo)


Question:
What are the distinct names of customers who have purchased at least three different products?
Additional table information: table: department_store

Answer: SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.customer_id HAVING COUNT(DISTINCT T3.product_id) >= 3


Question:
What are the addresses of customers living in Germany who have had an invoice?
Additional table information: table: chinook_1

Answer: SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = 'Germany'


Question:
Find the names of the products with length smaller than 3 or height greater than 5.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents WHERE LENGTH < 3 OR width > 5


Question:
How many routes does American Airlines operate?
Additional table information: table: flight_4

Answer: SELECT COUNT(*) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid WHERE T1.name = 'American Airlines'


Question:
Find the number of students whose age is older than the average age for each gender.
Additional table information: table: dorm_1

Answer: SELECT COUNT(*), sex FROM student WHERE age > (SELECT AVG(age) FROM student) GROUP BY sex


Question:
What are the names and headquarters of all manufacturers, ordered by revenue descending?
Additional table information: table: manufactory_1

Answer: SELECT name, headquarter FROM manufacturers ORDER BY revenue DESC


Question:
Show the names of journalists that have reported more than one event.
Additional table information: table: news_report

Answer: SELECT T3.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name HAVING COUNT(*) > 1


Question:
What are the employee ids, full names, and job ids for employees who make more than the highest earning employee with title PU_MAN?
Additional table information: table: hr_1

Answer: SELECT employee_id, first_name, last_name, job_id FROM employees WHERE salary > (SELECT MAX(salary) FROM employees WHERE job_id = 'PU_MAN')


Question:
What are the forenames and surnames of all unique drivers who had a lap time of less than 93000 milliseconds?
Additional table information: table: formula_1

Answer: SELECT DISTINCT T1.forename, T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE T2.milliseconds < 93000


Question:
What are the first names and last names of the students who are 18 years old and have vice president votes.
Additional table information: table: voter_2

Answer: SELECT DISTINCT T1.Fname, T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_President_VOTE WHERE T1.age = 18


Question:
What are the first names and ages of all students who are playing both Football and Lacrosse?
Additional table information: table: game_1

Answer: SELECT fname, age FROM Student WHERE StuID IN (SELECT StuID FROM Sportsinfo WHERE SportName = 'Football' INTERSECT SELECT StuID FROM Sportsinfo WHERE SportName = 'Lacrosse')


Question:
What is the most common maximum page size?
Additional table information: table: store_product

Answer: SELECT max_page_size FROM product GROUP BY max_page_size ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many customers are from California?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM customers WHERE state = 'CA'


Question:
Find the last name of the staff whose email address contains 'wrau'.
Additional table information: table: customer_complaints

Answer: SELECT last_name FROM staff WHERE email_address LIKE '%wrau%'


Question:
How many different students are involved in sports?
Additional table information: table: game_1

Answer: SELECT COUNT(DISTINCT StuID) FROM Sportsinfo


Question:
What are the names of all songs that are in mp3 format and have a resolution lower than 1000?
Additional table information: table: music_1

Answer: SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = 'mp3' INTERSECT SELECT song_name FROM song WHERE resolution < 1000


Question:
What is the average price for a lesson taught by Janessa Sawayn?
Additional table information: table: driving_school

Answer: SELECT AVG(price) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
What are the names of all aircrafts that John Williams have certificates to be able to fly?
Additional table information: table: flight_1

Answer: SELECT T3.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T1.name = 'John Williams'


Question:
Find the busiest source airport that runs most number of routes in China.
Additional table information: table: flight_4

Answer: SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid WHERE T1.country = 'China' GROUP BY T1.name ORDER BY COUNT(*) DESC LIMIT 1


Question:
When did Linda Smith visit Subway?
Additional table information: table: restaurant_1

Answer: SELECT TIME FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = 'Linda' AND Student.Lname = 'Smith' AND Restaurant.ResName = 'Subway'


Question:
How many schools are there in the department?
Additional table information: table: college_1

Answer: SELECT COUNT(DISTINCT school_code) FROM department


Question:
What are the names and headquarters of all companies ordered by descending market value?
Additional table information: table: gas_company

Answer: SELECT company, headquarters FROM company ORDER BY market_value DESC


Question:
How many musicals has each nominee been nominated for?
Additional table information: table: musical

Answer: SELECT Nominee, COUNT(*) FROM musical GROUP BY Nominee


Question:
How many employees do we have?
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT COUNT(*) FROM Employees


Question:
Show names of shops and the carriers of devices they have in stock.
Additional table information: table: device

Answer: SELECT T3.Shop_Name, T2.Carrier FROM stock AS T1 JOIN device AS T2 ON T1.Device_ID = T2.Device_ID JOIN shop AS T3 ON T1.Shop_ID = T3.Shop_ID


Question:
Which product has the most problems? Give me the number of problems and the product name.
Additional table information: table: tracking_software_problems

Answer: SELECT COUNT(*), T1.product_name FROM product AS T1 JOIN problems AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the count of the songs that last approximately 4 minutes?
Additional table information: table: music_1

Answer: SELECT COUNT(*) FROM files WHERE duration LIKE '4:%'


Question:
List the distinct hometowns that are not associated with any gymnast.
Additional table information: table: gymnast

Answer: SELECT DISTINCT Hometown FROM people EXCEPT SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID


Question:
What is the average number of international passengers for an airport?
Additional table information: table: aircraft

Answer: SELECT AVG(International_Passengers) FROM airport


Question:
Which country and state does staff with first name as Janessa and last name as Sawayn lived?
Additional table information: table: driving_school

Answer: SELECT T1.country, T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
What is the number of different class sections offered in the course ACCT-211?
Additional table information: table: college_1

Answer: SELECT COUNT(DISTINCT class_section) FROM CLASS WHERE crs_code = 'ACCT-211'


Question:
Show the ids and names of festivals that have at least two nominations for artworks.
Additional table information: table: entertainment_awards

Answer: SELECT T1.Festival_ID, T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID GROUP BY T1.Festival_ID HAVING COUNT(*) >= 2


Question:
Count the number of accounts corresponding to each customer id.
Additional table information: table: customers_and_invoices

Answer: SELECT COUNT(*), customer_id FROM Accounts GROUP BY customer_id


Question:
Find the names of the artists who are from UK and have produced English songs.
Additional table information: table: music_1

Answer: SELECT artist_name FROM artist WHERE country = 'UK' INTERSECT SELECT artist_name FROM song WHERE languages = 'english'


Question:
Show the average share count of transactions each each investor, ordered by average share count.
Additional table information: table: tracking_share_transactions

Answer: SELECT investor_id, AVG(share_count) FROM TRANSACTIONS GROUP BY investor_id ORDER BY AVG(share_count) NULLS FIRST


Question:
Show all video game types and the number of video games in each type.
Additional table information: table: game_1

Answer: SELECT gtype, COUNT(*) FROM Video_games GROUP BY gtype


Question:
Find the number of accounts with a savings balance that is higher than the average savings balance.
Additional table information: table: small_bank_1

Answer: SELECT COUNT(*) FROM savings WHERE balance > (SELECT AVG(balance) FROM savings)


Question:
What is all the information about all people?
Additional table information: table: candidate_poll

Answer: SELECT * FROM people


Question:
Sort the information about course authors and tutors in alphabetical order of the personal name.
Additional table information: table: e_learning

Answer: SELECT * FROM Course_Authors_and_Tutors ORDER BY personal_name NULLS FIRST


Question:
Find the city the store named 'FJA Filming' is in.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.City_Town FROM Addresses AS T1 JOIN Stores AS T2 ON T1.Address_ID = T2.Address_ID WHERE T2.Store_Name = 'FJA Filming'


Question:
What is the unit price of the tune 'Fast As a Shark'?
Additional table information: table: store_1

Answer: SELECT unit_price FROM tracks WHERE name = 'Fast As a Shark'


Question:
Find the total number of hours have done for all students in each department.
Additional table information: table: college_1

Answer: SELECT SUM(stu_hrs), dept_code FROM student GROUP BY dept_code


Question:
What are the titles and directors of the movies whose star is greater than the average stars of the movies directed by James Cameron?
Additional table information: table: movie_1

Answer: SELECT T2.title, T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars > (SELECT AVG(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.director = 'James Cameron')


Question:
What are the maximum price and score of wines in each year?
Additional table information: table: wine_1

Answer: SELECT MAX(Price), MAX(Score), YEAR FROM WINE GROUP BY YEAR


Question:
What document types do have more than 10000 total access number.
Additional table information: table: document_management

Answer: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING SUM(access_count) > 10000


Question:
What are the names of festivals held in year 2007?
Additional table information: table: entertainment_awards

Answer: SELECT Festival_Name FROM festival_detail WHERE YEAR = 2007


Question:
Find the name of each user and number of tweets tweeted by each of them.
Additional table information: table: twitter_1

Answer: SELECT T1.name, COUNT(*) FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid


Question:
What are the start date and end date of the apartment bookings made by female guests (gender code 'Female')?
Additional table information: table: apartment_rentals

Answer: SELECT T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = 'Female'


Question:
What is the total kills of the perpetrators with height more than 1.84.
Additional table information: table: perpetrator

Answer: SELECT SUM(T2.Killed) FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Height > 1.84


Question:
Find the balance of the checking account belonging to an owner whose name contains 'ee'.
Additional table information: table: small_bank_1

Answer: SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T1.name LIKE '%ee%'


Question:
What are the first name and last name of Linda Smith's advisor?
Additional table information: table: activity_1

Answer: SELECT T1.fname, T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T2.fname = 'Linda' AND T2.lname = 'Smith'


Question:
Which school has the fewest professors?
Additional table information: table: college_1

Answer: SELECT T1.school_code FROM department AS T1 JOIN professor AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.school_code ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
Return the description of the budget type that has the code ORG.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT budget_type_description FROM Ref_budget_codes WHERE budget_type_code = 'ORG'


Question:
Who is the author of the paper titled 'Binders Unbound'? Give me the last name.
Additional table information: table: icfp_1

Answer: SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = 'Binders Unbound'


Question:
List the names of editors who are older than 25.
Additional table information: table: journal_committee

Answer: SELECT Name FROM editor WHERE Age > 25


Question:
Count the number of customers who hold an account.
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(DISTINCT customer_id) FROM Accounts


Question:
Show the name, time, and service for all trains.
Additional table information: table: train_station

Answer: SELECT name, TIME, service FROM train


Question:
Show the statement detail and the corresponding document name for the statement with detail 'Private Project'.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.statement_details, T2.document_name FROM Statements AS T1 JOIN Documents AS T2 ON T1.statement_id = T2.document_id WHERE T1.statement_details = 'Private Project'


Question:
What are the lot details of lots associated with transactions with share count smaller than 50?
Additional table information: table: tracking_share_transactions

Answer: SELECT T1.lot_details FROM LOTS AS T1 JOIN TRANSACTIONS_LOTS AS T2 ON T1.lot_id = T2.transaction_id JOIN TRANSACTIONS AS T3 ON T2.transaction_id = T3.transaction_id WHERE T3.share_count < 50


Question:
Find the total account balance of each customer from Utah or Texas.
Additional table information: table: loan_1

Answer: SELECT SUM(acc_bal) FROM customer WHERE state = 'Utah' OR state = 'Texas'


Question:
What are the ids of the students who attended courses in the statistics department in order of attendance date.
Additional table information: table: student_assessment

Answer: SELECT T2.student_id FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'statistics' ORDER BY T2.date_of_attendance NULLS FIRST


Question:
Count the number of courses.
Additional table information: table: college_3

Answer: SELECT COUNT(*) FROM COURSE


Question:
What is the name of the shop that has the most different kinds of devices in stock?
Additional table information: table: device

Answer: SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T1.Shop_ID ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the name of the most popular party form.
Additional table information: table: e_government

Answer: SELECT t1.form_name FROM forms AS t1 JOIN party_forms AS t2 ON t1.form_id = t2.form_id GROUP BY t2.form_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many cinema do we have?
Additional table information: table: cinema

Answer: SELECT COUNT(*) FROM cinema


Question:
What are the average, minimum, and max ages for each of the different majors?
Additional table information: table: game_1

Answer: SELECT major, AVG(age), MIN(age), MAX(age) FROM Student GROUP BY major


Question:
How many documents have document type code CV or BK?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT COUNT(*) FROM All_documents WHERE document_type_code = 'CV' OR document_type_code = 'BK'


Question:
Find the student ID and personal name of the student with at least two enrollments.
Additional table information: table: e_learning

Answer: SELECT T1.student_id, T2.personal_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) >= 2


Question:
Find the cities corresponding to employees who help customers with the postal code 70174.
Additional table information: table: chinook_1

Answer: SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = '70174'


Question:
Find all the payment dates for the payments with an amount larger than 10 and the payments handled by a staff person with the first name Elsa.
Additional table information: table: sakila_1

Answer: SELECT payment_date FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa'


Question:
What is the color of the grape whose wine products has the highest average price?
Additional table information: table: wine_1

Answer: SELECT T1.Color FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape GROUP BY T2.Grape ORDER BY AVG(Price) DESC LIMIT 1


Question:
Show the names of pilots and fleet series of the aircrafts they have flied with in ascending order of the rank of the pilot.
Additional table information: table: pilot_record

Answer: SELECT T3.Pilot_name, T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID ORDER BY T3.Rank NULLS FIRST


Question:
Find the name of the youngest organization.
Additional table information: table: e_government

Answer: SELECT organization_name FROM organizations ORDER BY date_formed DESC LIMIT 1


Question:
Return the maximum enrollment across all schools.
Additional table information: table: university_basketball

Answer: SELECT MAX(Enrollment) FROM university


Question:
What are the names of people in ascending order of weight?
Additional table information: table: entrepreneur

Answer: SELECT Name FROM People ORDER BY Weight ASC NULLS FIRST


Question:
How many students are from each city, and which cities have more than one cities?
Additional table information: table: dorm_1

Answer: SELECT COUNT(*), city_code FROM student GROUP BY city_code HAVING COUNT(*) > 1


Question:
What is the id of the candidate with the lowest oppose rate?
Additional table information: table: candidate_poll

Answer: SELECT Candidate_ID FROM candidate ORDER BY oppose_rate NULLS FIRST LIMIT 1


Question:
What is the average fastest lap speed for the Monaco Grand Prix in 2008?
Additional table information: table: formula_1

Answer: SELECT AVG(T2.fastestlapspeed) FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year = 2008 AND T1.name = 'Monaco Grand Prix'


Question:
Find the names of the campus which has more faculties in 2002 than every campus in Orange county.
Additional table information: table: csu_1

Answer: SELECT T1.campus FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2002 AND faculty > (SELECT MAX(faculty) FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2002 AND T1.county = 'Orange')


Question:
Show the distinct venues of debates
Additional table information: table: debate

Answer: SELECT DISTINCT Venue FROM debate


Question:
How many orders does Lucas Mancini has?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = 'Lucas' AND T1.last_name = 'Mancini'


Question:
What are the names of all the games that have been played for at least 1000 hours?
Additional table information: table: game_1

Answer: SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid HAVING SUM(hours_played) >= 1000


Question:
Find the name of students who took any class in the years of 2009 and 2010.
Additional table information: table: college_2

Answer: SELECT DISTINCT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE YEAR = 2009 OR YEAR = 2010


Question:
What are the names of instructors who advise more than one student?
Additional table information: table: college_2

Answer: SELECT T1.name FROM instructor AS T1 JOIN advisor AS T2 ON T1.id = T2.i_id GROUP BY T2.i_id HAVING COUNT(*) > 1


Question:
Count the number of customers.
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers


Question:
Show origin and destination for flights with price higher than 300.
Additional table information: table: flight_1

Answer: SELECT origin, destination FROM Flight WHERE price > 300


Question:
Show all account ids and account details.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT account_id, account_details FROM Accounts


Question:
What is the effective date of the claim that has the largest amount of total settlement?
Additional table information: table: insurance_fnol

Answer: SELECT t1.Effective_Date FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id ORDER BY SUM(t2.settlement_amount) DESC LIMIT 1


Question:
Find the name and gender of the candidate who got the highest support rate.
Additional table information: table: candidate_poll

Answer: SELECT t1.name, t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id ORDER BY t2.support_rate DESC LIMIT 1


Question:
Return each apartment type code with the number of apartments having that apartment type, in ascending order of the number of apartments.
Additional table information: table: apartment_rentals

Answer: SELECT apt_type_code, COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) ASC NULLS FIRST


Question:
Find the id and location of circuits that belong to France or Belgium?
Additional table information: table: formula_1

Answer: SELECT circuitid, LOCATION FROM circuits WHERE country = 'France' OR country = 'Belgium'


Question:
How many times has the student Linda Smith visited Subway?
Additional table information: table: restaurant_1

Answer: SELECT COUNT(*) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = 'Linda' AND Student.Lname = 'Smith' AND Restaurant.ResName = 'Subway'


Question:
Which student visited restaurant most often? List student's first name and last name.
Additional table information: table: restaurant_1

Answer: SELECT Student.Fname, Student.Lname FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID GROUP BY Student.StuID ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the titles and directors of the films were never presented in China?
Additional table information: table: film_rank

Answer: SELECT title, director FROM film WHERE NOT film_id IN (SELECT film_id FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.market_id = T2.Market_ID WHERE country = 'China')


Question:
Return the types of film market estimations in 1995.
Additional table information: table: film_rank

Answer: SELECT TYPE FROM film_market_estimation WHERE YEAR = 1995


Question:
Find the states of the colleges that have students in the tryout who played in striker position.
Additional table information: table: soccer_2

Answer: SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'striker'


Question:
How many farms are there?
Additional table information: table: farm

Answer: SELECT COUNT(*) FROM farm


Question:
How many wines are produced at Robert Biale winery?
Additional table information: table: wine_1

Answer: SELECT COUNT(*) FROM WINE WHERE Winery = 'Robert Biale'


Question:
In which locations are there more than one movie theater with capacity above 300?
Additional table information: table: cinema

Answer: SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING COUNT(*) > 1


Question:
Give the name of the lowest earning instructor in the Statistics department.
Additional table information: table: college_2

Answer: SELECT name FROM instructor WHERE dept_name = 'Statistics' ORDER BY salary NULLS FIRST LIMIT 1


Question:
Which apartments have bookings with both status codes 'Provisional' and 'Confirmed'? Give me the apartment numbers.
Additional table information: table: apartment_rentals

Answer: SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = 'Confirmed' INTERSECT SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = 'Provisional'


Question:
Find the average age of the students who have allergies with food and animal types.
Additional table information: table: allergy_1

Answer: SELECT AVG(age) FROM Student WHERE StuID IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = 'food' INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = 'animal')


Question:
What are the names and descriptions of the all courses under the 'Computer Science' subject?
Additional table information: table: e_learning

Answer: SELECT T1.course_name, T1.course_description FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = 'Computer Science'


Question:
What are the names of the branches that have some members with a hometown in Louisville, Kentucky and also those from Hiram, Goergia?
Additional table information: table: shop_membership

Answer: SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.Hometown = 'Louisville ,  Kentucky' INTERSECT SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.Hometown = 'Hiram ,  Georgia'


Question:
Find the name of all the clubs at 'AKW'.
Additional table information: table: club_1

Answer: SELECT clubname FROM club WHERE clublocation = 'AKW'


Question:
Find the first names and offices of all professors sorted by alphabetical order of their first name.
Additional table information: table: college_1

Answer: SELECT T2.emp_fname, T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname NULLS FIRST


Question:
Show the countries that have both perpetrators with injures more than 50 and perpetrators with injures smaller than 20.
Additional table information: table: perpetrator

Answer: SELECT Country FROM perpetrator WHERE Injured > 50 INTERSECT SELECT Country FROM perpetrator WHERE Injured < 20


Question:
Find the name of the department which has the highest average salary of professors.
Additional table information: table: college_2

Answer: SELECT dept_name FROM instructor GROUP BY dept_name ORDER BY AVG(salary) DESC LIMIT 1


Question:
What are the famous titles and ages of each artist, listed in descending order by age?
Additional table information: table: music_4

Answer: SELECT Famous_Title, Age FROM artist ORDER BY Age DESC


Question:
List the area and county of all appelations.
Additional table information: table: wine_1

Answer: SELECT Area, County FROM APPELLATIONS


Question:
List the names of all the physicians who prescribe Thesisin as medication.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.name = 'Thesisin'


Question:
Show the ids of the faculty who don't participate in any activity.
Additional table information: table: activity_1

Answer: SELECT FacID FROM Faculty EXCEPT SELECT FacID FROM Faculty_participates_in


Question:
Count the number of Annual Meeting events that took place in the region of the United Kingdom.
Additional table information: table: party_people

Answer: SELECT COUNT(*) FROM region AS t1 JOIN party AS t2 ON t1.region_id = t2.region_id JOIN party_events AS t3 ON t2.party_id = t3.party_id WHERE t1.region_name = 'United Kingdom' AND t3.Event_Name = 'Annaual Meeting'


Question:
What are the names of customers who do not have any policies?
Additional table information: table: insurance_and_eClaims

Answer: SELECT customer_details FROM customers EXCEPT SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id


Question:
What are the first names and office locations for all professors sorted alphabetically by first name?
Additional table information: table: college_1

Answer: SELECT T2.emp_fname, T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname NULLS FIRST


Question:
How many types of products have Rodrick Heaney bought in total?
Additional table information: table: customers_and_addresses

Answer: SELECT COUNT(DISTINCT t3.product_id) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = 'Rodrick Heaney'


Question:
What is the id and trade name of the medicines can interact with at least 3 enzymes?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT T1.id, T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 3


Question:
What college has a student who successfully made the team in the role of a goalie?
Additional table information: table: soccer_2

Answer: SELECT cName FROM tryout WHERE decision = 'yes' AND pPos = 'goalie'


Question:
Find the year which offers the largest number of courses.
Additional table information: table: college_2

Answer: SELECT YEAR FROM SECTION GROUP BY YEAR ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the id of the customers who have order status both 'On Road' and 'Shipped'.
Additional table information: table: tracking_orders

Answer: SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'On Road' INTERSECT SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'Shipped'


Question:
What is the total number of rooms available in this inn?
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM Rooms


Question:
What is the most common birth place of people?
Additional table information: table: body_builder

Answer: SELECT Birth_Place FROM people GROUP BY Birth_Place ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of all aicrafts that have never won any match?
Additional table information: table: aircraft

Answer: SELECT Aircraft FROM aircraft WHERE NOT Aircraft_ID IN (SELECT Winning_Aircraft FROM MATCH)


Question:
What are the heights of perpetrators in descending order of the number of people they injured?
Additional table information: table: perpetrator

Answer: SELECT T1.Height FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Injured DESC


Question:
Who are the nominees who have been nominated for both a Tony Award and a Drama Desk Award?
Additional table information: table: musical

Answer: SELECT Nominee FROM musical WHERE Award = 'Tony Award' INTERSECT SELECT Nominee FROM musical WHERE Award = 'Drama Desk Award'


Question:
What is the average quantity of stocks?
Additional table information: table: device

Answer: SELECT AVG(Quantity) FROM stock


Question:
Which movies have 'Deleted Scenes' as a substring in the special feature?
Additional table information: table: sakila_1

Answer: SELECT title FROM film WHERE special_features LIKE '%Deleted Scenes%'


Question:
Find the list of documents that are both in the most three popular type and have the most three popular structure.
Additional table information: table: document_management

Answer: SELECT document_name FROM documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 3 INTERSECT SELECT document_name FROM documents GROUP BY document_structure_code ORDER BY COUNT(*) DESC LIMIT 3


Question:
What are the issue dates of volumes associated with the artist 'Gorgoroth'?
Additional table information: table: music_4

Answer: SELECT T2.Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Artist = 'Gorgoroth'


Question:
In which season and which stadium did any player have an injury of 'Foot injury' or 'Knee problem'?
Additional table information: table: game_injury

Answer: SELECT T1.season, T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.injury = 'Foot injury' OR T3.injury = 'Knee problem'


Question:
Find the number of different products that are produced by companies at different headquarter cities.
Additional table information: table: manufactory_1

Answer: SELECT COUNT(DISTINCT T1.name), T2.Headquarter FROM products AS T1 JOIN manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.Headquarter


Question:
What is the name of the shipping agent of the document with id 2?
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT Ref_Shipping_Agents.shipping_agent_name FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Documents.document_id = 2


Question:
What is the name of the bank branch that has lent the greatest amount?
Additional table information: table: loan_1

Answer: SELECT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname ORDER BY SUM(T2.amount) DESC LIMIT 1


Question:
Find the average and oldest age for students with different sex.
Additional table information: table: dorm_1

Answer: SELECT AVG(age), MAX(age), sex FROM student GROUP BY sex


Question:
What is the name and building of the departments whose budget is more than the average budget?
Additional table information: table: college_2

Answer: SELECT dept_name, building FROM department WHERE budget > (SELECT AVG(budget) FROM department)


Question:
For each party, return its theme and the name of its host.
Additional table information: table: party_host

Answer: SELECT T3.Party_Theme, T2.Name 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


Question:
What are the three products that have the most problems?s
Additional table information: table: tracking_software_problems

Answer: SELECT T2.product_name FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name ORDER BY COUNT(*) DESC LIMIT 3


Question:
Give the product id for the product that was ordered most frequently.
Additional table information: table: department_store

Answer: SELECT product_id FROM order_items GROUP BY product_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which store has most the customers?
Additional table information: table: sakila_1

Answer: SELECT store_id FROM customer GROUP BY store_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
For each building, show the name of the building and the number of institutions in it.
Additional table information: table: protein_institute

Answer: SELECT T1.name, COUNT(*) FROM building AS T1 JOIN institution AS T2 ON T1.building_id = T2.building_id GROUP BY T1.building_id


Question:
What is the average number of rooms of apartments with type code 'Studio'?
Additional table information: table: apartment_rentals

Answer: SELECT AVG(room_count) FROM Apartments WHERE apt_type_code = 'Studio'


Question:
Which players are from Indonesia?
Additional table information: table: match_season

Answer: SELECT T2.Player FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T1.Country_name = 'Indonesia'


Question:
Show the most common apartment type code among apartments with more than 1 bathroom.
Additional table information: table: apartment_rentals

Answer: SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the first name, last name, and phone number for all female faculty members.
Additional table information: table: activity_1

Answer: SELECT Fname, Lname, phone FROM Faculty WHERE Sex = 'F'


Question:
What are the ids of all vehicles?
Additional table information: table: driving_school

Answer: SELECT vehicle_id FROM Vehicles


Question:
Find the name of companies whose revenue is between 100 and 150.
Additional table information: table: manufactory_1

Answer: SELECT name FROM manufacturers WHERE revenue BETWEEN 100 AND 150


Question:
Show the details of the top 3 most expensive hotels.
Additional table information: table: cre_Theme_park

Answer: SELECT other_hotel_details FROM HOTELS ORDER BY price_range DESC LIMIT 3


Question:
What are the first names of all students who are older than 20?
Additional table information: table: dorm_1

Answer: SELECT fname FROM student WHERE age > 20


Question:
What are the name and id of the team offering the lowest average salary?
Additional table information: table: baseball_1

Answer: SELECT T1.name, T1.team_id FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id ORDER BY AVG(T2.salary) ASC NULLS FIRST LIMIT 1


Question:
Which product's detail contains the word 'Latte' or 'Americano'? Return the full detail.
Additional table information: table: customers_and_addresses

Answer: SELECT product_details FROM products WHERE product_details LIKE '%Latte%' OR product_details LIKE '%Americano%'


Question:
How many total pounds were purchased in the year 2018 at all London branches?
Additional table information: table: shop_membership

Answer: SELECT SUM(total_pounds) FROM purchase AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T2.city = 'London' AND T1.year = 2018


Question:
Show the names of countries and the average speed of roller coasters from each country.
Additional table information: table: roller_coaster

Answer: 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


Question:
Give the distinct names of wines made before 2000 or after 2010.
Additional table information: table: wine_1

Answer: SELECT DISTINCT Name FROM WINE WHERE YEAR < 2000 OR YEAR > 2010


Question:
What is the name of the person who is the oldest?
Additional table information: table: network_2

Answer: SELECT name FROM Person WHERE age = (SELECT MAX(age) FROM person)


Question:
What are the names and genders of all artists who released songs in the month of March?
Additional table information: table: music_1

Answer: SELECT T1.artist_name, T1.gender FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.releasedate LIKE '%Mar%'


Question:
Select the project names which are not assigned yet.
Additional table information: table: scientist_1

Answer: SELECT Name FROM Projects WHERE NOT Code IN (SELECT Project FROM AssignedTo)


Question:
What is the maximum enrollment across all schools?
Additional table information: table: university_basketball

Answer: SELECT MAX(Enrollment) FROM university


Question:
What are the names of all the video games and their types in alphabetical order?
Additional table information: table: game_1

Answer: SELECT gname, gtype FROM Video_games ORDER BY gname NULLS FIRST


Question:
How old is the youngest winning pilot and what is their name?
Additional table information: table: aircraft

Answer: SELECT t1.name, t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id = t2.winning_pilot ORDER BY t1.age NULLS FIRST LIMIT 1


Question:
Count the number of different scientists assigned to any project.
Additional table information: table: scientist_1

Answer: SELECT COUNT(DISTINCT scientist) FROM assignedto


Question:
How many students live in HKG or CHI?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Student WHERE city_code = 'HKG' OR city_code = 'CHI'


Question:
What are the details for all projects that did not hire any staff in a research role?
Additional table information: table: tracking_grants_for_research

Answer: SELECT project_details FROM Projects WHERE NOT project_id IN (SELECT project_id FROM Project_Staff WHERE role_code = 'researcher')


Question:
Give the maximum price and score for wines produced in the appelation St. Helena.
Additional table information: table: wine_1

Answer: SELECT MAX(Price), MAX(Score) FROM WINE WHERE Appelation = 'St. Helena'


Question:
Find the names of courses that have either 3 credits or 1 credit but 4 hours.
Additional table information: table: college_3

Answer: SELECT CName FROM COURSE WHERE Credits = 3 UNION SELECT CName FROM COURSE WHERE Credits = 1 AND Hours = 4


Question:
What are the maximum and minumum grade points?
Additional table information: table: college_3

Answer: SELECT MAX(gradepoint), MIN(gradepoint) FROM GRADECONVERSION


Question:
How many faculty members do we have for each faculty rank?
Additional table information: table: activity_1

Answer: SELECT rank, COUNT(*) FROM Faculty GROUP BY rank


Question:
Count the number of wrestlers.
Additional table information: table: wrestler

Answer: SELECT COUNT(*) FROM wrestler


Question:
How many stations does Mountain View city has?
Additional table information: table: bike_1

Answer: SELECT COUNT(*) FROM station WHERE city = 'Mountain View'


Question:
What are the birthdays of people in ascending order of height?
Additional table information: table: body_builder

Answer: SELECT Birth_Date FROM People ORDER BY Height ASC NULLS FIRST


Question:
Give me the dates when the max temperature was higher than 85.
Additional table information: table: bike_1

Answer: SELECT date FROM weather WHERE max_temperature_f > 85


Question:
For each team, return the team name, id and the maximum salary among the team.
Additional table information: table: baseball_1

Answer: SELECT T1.name, T1.team_id, MAX(T2.salary) FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id


Question:
Show ids for all students who have advisor 1121.
Additional table information: table: game_1

Answer: SELECT StuID FROM Student WHERE Advisor = 1121


Question:
Find the total number of students in each department.
Additional table information: table: college_2

Answer: SELECT COUNT(*), dept_name FROM student GROUP BY dept_name


Question:
Find the name and email for the users who have more than one follower.
Additional table information: table: twitter_1

Answer: SELECT T1.name, T1.email FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f1 GROUP BY T2.f1 HAVING COUNT(*) > 1


Question:
What is the first name and last name of the student who have most number of sports?
Additional table information: table: game_1

Answer: SELECT T2.Fname, T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the emails of customers who have filed complaints on the product which has had the greatest number of complaints?
Additional table information: table: customer_complaints

Answer: SELECT t1.email_address FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What are the ids, scores, and dates of the games which caused at least two injury accidents?
Additional table information: table: game_injury

Answer: SELECT T1.id, T1.score, T1.date FROM game AS T1 JOIN injury_accident AS T2 ON T2.game_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 2


Question:
What types of ships have both ships that have Panama Flags and Malta flags?
Additional table information: table: ship_1

Answer: SELECT TYPE FROM ship WHERE flag = 'Panama' INTERSECT SELECT TYPE FROM ship WHERE flag = 'Malta'


Question:
What are the first name and last name of all the teachers?
Additional table information: table: student_1

Answer: SELECT DISTINCT firstname, lastname FROM teachers


Question:
How many different kinds of clients are supported by the web clients accelerators?
Additional table information: table: browser_web

Answer: SELECT COUNT(DISTINCT client) FROM web_client_accelerator


Question:
What are the states, account types, and credit scores for customers who have 0 loans?
Additional table information: table: loan_1

Answer: SELECT state, acc_type, credit_score FROM customer WHERE no_of_loans = 0


Question:
List first name and last name of customers lived in city Lockmanfurt.
Additional table information: table: driving_school

Answer: SELECT T1.first_name, T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = 'Lockmanfurt'


Question:
Return all the committees that have delegates from Democratic party.
Additional table information: table: election

Answer: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = 'Democratic'


Question:
Find all information of all the products with a price between $60 and $120.
Additional table information: table: manufactory_1

Answer: SELECT * FROM products WHERE price BETWEEN 60 AND 120


Question:
Show the names of members and the location of the performances they attended.
Additional table information: table: performance_attendance

Answer: SELECT T2.Name, T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID


Question:
Find the total number of king beds available.
Additional table information: table: inn_1

Answer: SELECT SUM(beds) FROM Rooms WHERE bedtype = 'King'


Question:
Show the apartment numbers, start dates, and end dates of all the apartment bookings.
Additional table information: table: apartment_rentals

Answer: SELECT T2.apt_number, T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id


Question:
What are the department names and how many employees work in each of them?
Additional table information: table: hr_1

Answer: SELECT department_name, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY department_name