Question:
What are the names of climbers who are not from the country of Switzerland?
Additional table information: table: climbing

Answer: SELECT Name FROM climber WHERE Country <> 'Switzerland'


Question:
Show the ids of all employees who don't destroy any document.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT employee_id FROM Employees EXCEPT SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed


Question:
What is the total amount of products purchased before 2018-03-17 07:13:53?
Additional table information: table: customers_and_addresses

Answer: SELECT SUM(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_date < '2018-03-17 07:13:53'


Question:
How many female Professors do we have?
Additional table information: table: activity_1

Answer: SELECT COUNT(*) FROM Faculty WHERE Sex = 'F' AND Rank = 'Professor'


Question:
What are the ids of all reviewers who did not give 4 stars?
Additional table information: table: movie_1

Answer: SELECT rID FROM Rating EXCEPT SELECT rID FROM Rating WHERE stars = 4


Question:
Show the names of phones and the districts of markets they are on, in ascending order of the ranking of the market.
Additional table information: table: phone_market

Answer: SELECT T3.Name, T2.District FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID ORDER BY T2.Ranking NULLS FIRST


Question:
What are the last names of students in room 111?
Additional table information: table: student_1

Answer: SELECT lastname FROM list WHERE classroom = 111


Question:
What are the names of everybody sorted by age in descending order?
Additional table information: table: network_2

Answer: SELECT name FROM Person ORDER BY age DESC


Question:
Which problems are reported by the staff with last name 'Bosco'? Show the ids of the problems.
Additional table information: table: tracking_software_problems

Answer: SELECT T1.problem_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_last_name = 'Bosco'


Question:
Find the top 3 wineries with the greatest number of wines made of white color grapes.
Additional table information: table: wine_1

Answer: SELECT T2.Winery FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.GRAPE = T2.GRAPE WHERE T1.Color = 'White' GROUP BY T2.Winery ORDER BY COUNT(*) DESC LIMIT 3


Question:
Find the full names of faculties who are members of department with department number 520.
Additional table information: table: college_3

Answer: SELECT T1.Fname, T1.Lname FROM FACULTY AS T1 JOIN MEMBER_OF AS T2 ON T1.FacID = T2.FacID WHERE T2.DNO = 520


Question:
Find the maximum and minimum millisecond lengths of pop tracks.
Additional table information: table: chinook_1

Answer: SELECT MAX(Milliseconds), MIN(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Pop'


Question:
A list of the top 5 countries by number of invoices. List country name and number of invoices.
Additional table information: table: store_1

Answer: SELECT billing_country, COUNT(*) FROM invoices GROUP BY billing_country ORDER BY COUNT(*) DESC LIMIT 5


Question:
Which parties have delegates in both the 'Appropriations' committee and the 'Economic Matters' committee?
Additional table information: table: election

Answer: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = 'Appropriations' INTERSECT SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = 'Economic Matters'


Question:
What is the average speed of roller coasters?
Additional table information: table: roller_coaster

Answer: SELECT AVG(Speed) FROM roller_coaster


Question:
List the campuses in Los Angeles county.
Additional table information: table: csu_1

Answer: SELECT campus FROM campuses WHERE county = 'Los Angeles'


Question:
Show the date valid from and the date valid to for the card with card number '4560596484842'.
Additional table information: table: customers_card_transactions

Answer: SELECT date_valid_from, date_valid_to FROM Customers_cards WHERE card_number = '4560596484842'


Question:
What are the distinct details of invoices created before 1989-09-03 or after 2007-12-25?
Additional table information: table: tracking_orders

Answer: SELECT DISTINCT invoice_details FROM invoices WHERE invoice_date < '1989-09-03' OR invoice_date > '2007-12-25'


Question:
Please show the software platforms of devices in descending order of the count.
Additional table information: table: device

Answer: SELECT Software_Platform FROM device GROUP BY Software_Platform ORDER BY COUNT(*) DESC


Question:
What is the number of professors for different school?
Additional table information: table: college_1

Answer: SELECT COUNT(*), T1.school_code FROM department AS T1 JOIN professor AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.school_code


Question:
What are the first and last names of all students who are not living in the city HKG and order the results by age?
Additional table information: table: dorm_1

Answer: SELECT fname, lname FROM student WHERE city_code <> 'HKG' ORDER BY age NULLS FIRST


Question:
List the titles of the papers whose authors are from the institution 'Indiana University'.
Additional table information: table: icfp_1

Answer: SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = 'Indiana University'


Question:
What is the name of the customer who has made the minimum amount of payment in one claim?
Additional table information: table: insurance_and_eClaims

Answer: SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_piad = (SELECT MIN(amount_piad) FROM claim_headers)


Question:
List the publisher of the publication with the highest price.
Additional table information: table: book_2

Answer: SELECT Publisher FROM publication ORDER BY Price DESC LIMIT 1


Question:
What are the names of people who have a height greater than 200 or less than 190?
Additional table information: table: candidate_poll

Answer: SELECT name FROM people WHERE height > 200 OR height < 190


Question:
What are the name and level of catalog structure with level number between 5 and 10
Additional table information: table: product_catalog

Answer: SELECT catalog_level_name, catalog_level_number FROM Catalog_Structure WHERE catalog_level_number BETWEEN 5 AND 10


Question:
What is the count of enzymes without any interactions?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT COUNT(*) FROM enzyme WHERE NOT id IN (SELECT enzyme_id FROM medicine_enzyme_interaction)


Question:
Show the names of employees that work for companies with sales bigger than 200.
Additional table information: table: company_employee

Answer: SELECT T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID WHERE T3.Sales_in_Billion > 200


Question:
Where us the club named 'Tennis Club' located?
Additional table information: table: club_1

Answer: SELECT clublocation FROM club WHERE clubname = 'Tennis Club'


Question:
What are the names of all songs that are approximately 4 minutes long or are in English?
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.duration LIKE '4:%' UNION SELECT song_name FROM song WHERE languages = 'english'


Question:
How many engineer visits are required at most for a single fault log? List the number and the log entry id.
Additional table information: table: assets_maintenance

Answer: SELECT COUNT(*), T1.fault_log_entry_id FROM Fault_Log AS T1 JOIN Engineer_Visits AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the number of routes operated by the airline American Airlines whose destinations are in Italy?
Additional table information: table: flight_4

Answer: SELECT COUNT(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid JOIN airlines AS T3 ON T1.alid = T3.alid WHERE T2.country = 'Italy' AND T3.name = 'American Airlines'


Question:
What are the dates of ceremony and results for each music festival?
Additional table information: table: music_4

Answer: SELECT Date_of_ceremony, RESULT FROM music_festival


Question:
What are the first name and department name of all employees?
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id


Question:
How many albums has Billy Cobam released?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = 'Billy Cobham'


Question:
How many draft copies does the document with id 2 have?
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT COUNT(*) FROM Draft_Copies WHERE document_id = 2


Question:
List the name of the shop with the latest open year.
Additional table information: table: device

Answer: SELECT Shop_Name FROM shop ORDER BY Open_Year DESC LIMIT 1


Question:
Find the id of instructors who taught a class in Fall 2009 but not in Spring 2010.
Additional table information: table: college_2

Answer: SELECT id FROM teaches WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT id FROM teaches WHERE semester = 'Spring' AND YEAR = 2010


Question:
What are the maximum and minimum sales of the companies whose industries are not 'Banking'.
Additional table information: table: company_office

Answer: SELECT MAX(Sales_billion), MIN(Sales_billion) FROM Companies WHERE Industry <> 'Banking'


Question:
Report the name of all campuses in Los Angeles county.
Additional table information: table: csu_1

Answer: SELECT campus FROM campuses WHERE county = 'Los Angeles'


Question:
What are the distinct reigns of wrestlers whose location is not 'Tokyo,Japan' ?
Additional table information: table: wrestler

Answer: SELECT DISTINCT Reign FROM wrestler WHERE LOCATION <> 'Tokyo , Japan'


Question:
What is the total number of residents for the districts with the 3 largest areas?
Additional table information: table: store_product

Answer: SELECT SUM(city_population) FROM district ORDER BY city_area DESC LIMIT 3


Question:
What are the document ids for the budget type code 'SF'?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_id FROM Documents_with_expenses WHERE budget_type_code = 'SF'


Question:
Find the ids of all the order items whose product id is 11.
Additional table information: table: tracking_orders

Answer: SELECT order_item_id FROM order_items WHERE product_id = 11


Question:
Give the name of the department with the lowest budget.
Additional table information: table: college_2

Answer: SELECT dept_name FROM department ORDER BY budget NULLS FIRST LIMIT 1


Question:
What are the top 3 artists with the largest number of songs in the language Bangla?
Additional table information: table: music_1

Answer: SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = 'bangla' GROUP BY T2.artist_name ORDER BY COUNT(*) DESC LIMIT 3


Question:
What is the color description of the product with name 'catnip'?
Additional table information: table: products_gen_characteristics

Answer: SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = 'catnip'


Question:
Return the different classes of races.
Additional table information: table: race_track

Answer: SELECT DISTINCT CLASS FROM race


Question:
What are the maximum and minimum number of cows across all farms.
Additional table information: table: farm

Answer: SELECT MAX(Cows), MIN(Cows) FROM farm


Question:
Return the average, maximum, and total revenues across all manufacturers.
Additional table information: table: manufactory_1

Answer: SELECT AVG(revenue), MAX(revenue), SUM(revenue) FROM manufacturers


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

Answer: SELECT COUNT(*) FROM Customers


Question:
Show names for all employees with salary more than the average.
Additional table information: table: flight_1

Answer: SELECT name FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee)


Question:
What are the maximum and minimum number of silver medals for clubs.
Additional table information: table: sports_competition

Answer: SELECT MAX(Silver), MIN(Silver) FROM club_rank


Question:
Return the id of the staff whose Staff Department Assignment was earlier than that of any Clerical Staff.
Additional table information: table: department_store

Answer: SELECT staff_id FROM Staff_Department_Assignments WHERE date_assigned_to < (SELECT MAX(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code = 'Clerical Staff')


Question:
What are the job titles, and range of salaries for jobs with maximum salary between 12000 and 18000?
Additional table information: table: hr_1

Answer: SELECT job_title, max_salary - min_salary FROM jobs WHERE max_salary BETWEEN 12000 AND 18000


Question:
For each policy type, return its type code and its count in the record.
Additional table information: table: insurance_and_eClaims

Answer: SELECT policy_type_code, COUNT(*) FROM policies GROUP BY policy_type_code


Question:
List the writers who have written more than one book.
Additional table information: table: book_2

Answer: SELECT Writer FROM book GROUP BY Writer HAVING COUNT(*) > 1


Question:
Give me the temperature of Shanghai in January.
Additional table information: table: city_record

Answer: SELECT T2.Jan FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T1.city = 'Shanghai'


Question:
How many faculty lines are there in the university that conferred the most number of degrees in year 2002?
Additional table information: table: csu_1

Answer: SELECT T2.faculty FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = t2.campus JOIN degrees AS T3 ON T1.id = t3.campus AND t2.year = t3.year WHERE t2.year = 2002 ORDER BY t3.degrees DESC LIMIT 1


Question:
How long does student Linda Smith spend on the restaurant in total?
Additional table information: table: restaurant_1

Answer: SELECT SUM(Spent) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID WHERE Student.Fname = 'Linda' AND Student.Lname = 'Smith'


Question:
List the names of members in ascending alphabetical order.
Additional table information: table: decoration_competition

Answer: SELECT Name FROM member ORDER BY Name ASC NULLS FIRST


Question:
What are all the characteristic names of product 'sesame'?
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'


Question:
What are the roles with three or more employees? Give me the role codes.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT role_code FROM Employees GROUP BY role_code HAVING COUNT(*) >= 3


Question:
What is the employee id of the head whose department has the least number of employees?
Additional table information: table: hospital_1

Answer: SELECT head FROM department GROUP BY departmentID ORDER BY COUNT(departmentID) NULLS FIRST LIMIT 1


Question:
Please show the themes of competitions with host cities having populations larger than 1000.
Additional table information: table: farm

Answer: SELECT T2.Theme FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID WHERE T1.Population > 1000


Question:
Return the publisher that has published the most books.
Additional table information: table: culture_company

Answer: SELECT publisher FROM book_club GROUP BY publisher ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the names of the swimmers who have both 'win' and 'loss' results in the record.
Additional table information: table: swimming

Answer: SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win' INTERSECT SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Loss'


Question:
what are the names of people who did not participate in the candidate election.
Additional table information: table: candidate_poll

Answer: SELECT name FROM people WHERE NOT people_id IN (SELECT people_id FROM candidate)


Question:
Show the name of the county with the biggest population.
Additional table information: table: election

Answer: SELECT County_name FROM county ORDER BY Population DESC LIMIT 1


Question:
How many stations are in Mountain View?
Additional table information: table: bike_1

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


Question:
Cound the number of artists who have not released an album.
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM ARTIST WHERE NOT artistid IN (SELECT artistid FROM ALBUM)


Question:
Count the number of patients who stayed in room 112.
Additional table information: table: hospital_1

Answer: SELECT COUNT(patient) FROM stay WHERE room = 112


Question:
Which allergy is the most common?
Additional table information: table: allergy_1

Answer: SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of wrestlers days held less than 100?
Additional table information: table: wrestler

Answer: SELECT Name FROM wrestler WHERE Days_held < 100


Question:
What is the description for the CIS-220 and how many credits does it have?
Additional table information: table: college_1

Answer: SELECT crs_credit, crs_description FROM course WHERE crs_code = 'CIS-220'


Question:
Find the number of complaints with Product Failure type for each complaint status.
Additional table information: table: customer_complaints

Answer: SELECT complaint_status_code, COUNT(*) FROM complaints WHERE complaint_type_code = 'Product Failure' GROUP BY complaint_status_code


Question:
What are the names of members who are not in charge of any events?
Additional table information: table: party_people

Answer: SELECT member_name FROM member EXCEPT SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id


Question:
Show all product sizes.
Additional table information: table: customers_and_invoices

Answer: SELECT DISTINCT product_size FROM Products


Question:
Which department has the highest average instructor salary?
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 is the name and capacity of the dorm with the fewest amount of amenities?
Additional table information: table: dorm_1

Answer: SELECT T1.dorm_name, T1.student_capacity FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid GROUP BY T2.dormid ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
Find the names of the chip models that are not used by any phone with full accreditation type.
Additional table information: table: phone_1

Answer: SELECT model_name FROM chip_model EXCEPT SELECT chip_model FROM phone WHERE Accreditation_type = 'Full'


Question:
Return the decor of the room named 'Recluse and defiance'.
Additional table information: table: inn_1

Answer: SELECT decor FROM Rooms WHERE roomName = 'Recluse and defiance'


Question:
Show the name and phone of the customer without any mailshot.
Additional table information: table: customers_campaigns_ecommerce

Answer: SELECT customer_name, customer_phone FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM mailshot_customers)


Question:
Give the total money requested by entrepreneurs who are taller than 1.85.
Additional table information: table: entrepreneur

Answer: SELECT SUM(T1.Money_Requested) FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Height > 1.85


Question:
Find the distinct last names of all the students who have president votes and whose advisor is 8741.
Additional table information: table: voter_2

Answer: SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = '8741'


Question:
How many train stations are there?
Additional table information: table: train_station

Answer: SELECT COUNT(*) FROM station


Question:
Find the title of all the albums of the artist 'AC/DC'.
Additional table information: table: chinook_1

Answer: SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = 'AC/DC'


Question:
Show student ids for all male students.
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student WHERE Sex = 'M'


Question:
List countries that have more than one swimmer.
Additional table information: table: swimming

Answer: SELECT nationality, COUNT(*) FROM swimmer GROUP BY nationality HAVING COUNT(*) > 1


Question:
How many participants belong to the type 'Organizer'?
Additional table information: table: local_govt_in_alabama

Answer: SELECT COUNT(*) FROM participants WHERE participant_type_code = 'Organizer'


Question:
Give me the name and year of opening of the manufacturers that have either less than 10 factories or more than 10 shops.
Additional table information: table: manufacturer

Answer: SELECT name, open_year FROM manufacturer WHERE num_of_shops > 10 OR Num_of_Factories < 10


Question:
What are all the distinct payment types?
Additional table information: table: products_for_hire

Answer: SELECT DISTINCT payment_type_code FROM payments


Question:
What is the name and open year for the branch with most number of memberships registered 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 of all departments in alphabetical order?
Additional table information: table: college_1

Answer: SELECT dept_name FROM department ORDER BY dept_name NULLS FIRST


Question:
Show the most common country across members.
Additional table information: table: decoration_competition

Answer: SELECT Country FROM member GROUP BY Country ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the names of countries that have players that play the Forward position, as well as players who play the Defender position.
Additional table information: table: match_season

Answer: SELECT T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.Position = 'Forward' INTERSECT SELECT T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.Position = 'Defender'


Question:
What is the sum of budgets of the Marketing and Finance departments?
Additional table information: table: college_2

Answer: SELECT SUM(budget) FROM department WHERE dept_name = 'Marketing' OR dept_name = 'Finance'


Question:
Show names of musicals and the number of actors who have appeared in the musicals.
Additional table information: table: musical

Answer: SELECT T2.Name, COUNT(*) FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID


Question:
What are the student ids of students who don't have any allergies?
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy


Question:
Tell me the booking status code for the apartment with number 'Suite 634'.
Additional table information: table: apartment_rentals

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


Question:
What are the names of the states that have some college students playing in the positions of goalie and mid-field?
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 = 'goalie' INTERSECT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'mid'


Question:
What is the cmi cross reference id that is related to at least one council tax entry? List the cross reference id and source system code.
Additional table information: table: local_govt_mdm

Answer: SELECT T1.cmi_cross_ref_id, T1.source_system_code FROM CMI_Cross_References AS T1 JOIN Council_Tax AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id GROUP BY T1.cmi_cross_ref_id HAVING COUNT(*) >= 1


Question:
List all every engineer's first name, last name, details and coresponding skill description.
Additional table information: table: assets_maintenance

Answer: SELECT T1.first_name, T1.last_name, T1.other_details, T3.skill_description FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id


Question:
Count the number of documents with expenses.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Documents_with_expenses


Question:
Return the description and unit of measurement for products in the 'Herbs' category.
Additional table information: table: products_gen_characteristics

Answer: SELECT product_category_description, unit_of_measure FROM ref_product_categories WHERE product_category_code = 'Herbs'


Question:
What are the names of all products?
Additional table information: table: manufactory_1

Answer: SELECT Name FROM Products


Question:
What is the average horizontal bar points for all gymnasts?
Additional table information: table: gymnast

Answer: SELECT AVG(Horizontal_Bar_Points) FROM gymnast


Question:
List the names of clubs that do not have any players.
Additional table information: table: sports_competition

Answer: SELECT name FROM CLub WHERE NOT Club_ID IN (SELECT Club_ID FROM player)


Question:
Find the first names and last names of teachers in alphabetical order of last name.
Additional table information: table: behavior_monitoring

Answer: SELECT first_name, last_name FROM Teachers ORDER BY last_name NULLS FIRST


Question:
Find how many school locations have the word 'NY'.
Additional table information: table: university_basketball

Answer: SELECT COUNT(*) FROM university WHERE LOCATION LIKE '%NY%'


Question:
What is the latitude, longitude, city of the station from which the shortest trip started?
Additional table information: table: bike_1

Answer: SELECT T1.lat, T1.long, T1.city FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id ORDER BY T2.duration NULLS FIRST LIMIT 1


Question:
Show the name of aircrafts with top three lowest distances.
Additional table information: table: flight_1

Answer: SELECT name FROM Aircraft ORDER BY distance NULLS FIRST LIMIT 3


Question:
List the names of companies in descending order of market value.
Additional table information: table: company_office

Answer: SELECT name FROM Companies ORDER BY Market_Value_billion DESC


Question:
For each zip code, select all those that have an average mean visiblity below 10.
Additional table information: table: bike_1

Answer: SELECT zip_code FROM weather GROUP BY zip_code HAVING AVG(mean_visibility_miles) < 10


Question:
Find the first names of the faculty members who participate in Canoeing and Kayaking.
Additional table information: table: activity_1

Answer: SELECT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' INTERSECT SELECT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Kayaking'


Question:
Which customer is associated with the latest policy?
Additional table information: table: insurance_and_eClaims

Answer: SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.start_date = (SELECT MAX(start_date) FROM policies)


Question:
Show names of technicians and the number of machines they are assigned to repair.
Additional table information: table: machine_repair

Answer: SELECT T2.Name, COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_ID = T2.technician_ID GROUP BY T2.Name


Question:
Return names of songs in volumes that are by artists that are at least 32 years old.
Additional table information: table: music_4

Answer: SELECT T2.Song FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age >= 32


Question:
Find the id of the order which is shipped most recently.
Additional table information: table: tracking_orders

Answer: SELECT order_id FROM shipments WHERE shipment_date = (SELECT MAX(shipment_date) FROM shipments)


Question:
Count the number of customers that have the customer type that is most common.
Additional table information: table: customer_complaints

Answer: SELECT COUNT(*) FROM customers GROUP BY customer_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
For each staff id, what is the description of the role that is involved with the most number of projects?
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.role_description, T2.staff_id FROM Staff_Roles AS T1 JOIN Project_Staff AS T2 ON T1.role_code = T2.role_code JOIN Project_outcomes AS T3 ON T2.project_id = T3.project_id GROUP BY T2.staff_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of all aircrafts that have won a match at least twice?
Additional table information: table: aircraft

Answer: SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft HAVING COUNT(*) >= 2


Question:
Show id, first name and last name for all customers and the number of accounts.
Additional table information: table: customers_and_invoices

Answer: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id


Question:
List all information about college sorted by enrollment number in the ascending order.
Additional table information: table: soccer_2

Answer: SELECT * FROM College ORDER BY enr NULLS FIRST


Question:
Find the first names of students studying in room 108.
Additional table information: table: student_1

Answer: SELECT firstname FROM list WHERE classroom = 108


Question:
What are the different types of player positions?
Additional table information: table: soccer_2

Answer: SELECT COUNT(DISTINCT pPos) FROM tryout


Question:
Show the different statuses and the numbers of roller coasters for each status.
Additional table information: table: roller_coaster

Answer: SELECT Status, COUNT(*) FROM roller_coaster GROUP BY Status


Question:
How many products have the characteristic named 'hot'?
Additional table information: table: products_gen_characteristics

Answer: SELECT COUNT(*) 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 t3.characteristic_name = 'hot'


Question:
What is the total number of campuses?
Additional table information: table: csu_1

Answer: SELECT COUNT(*) FROM campuses


Question:
What are the maximum and minimum number of cities in all markets.
Additional table information: table: film_rank

Answer: SELECT MAX(Number_cities), MIN(Number_cities) FROM market


Question:
What are the names of the 3 departments with the most courses?
Additional table information: table: college_2

Answer: SELECT dept_name FROM course GROUP BY dept_name ORDER BY COUNT(*) DESC LIMIT 3


Question:
How many different services are provided by all stations?
Additional table information: table: station_weather

Answer: SELECT COUNT(DISTINCT services) FROM station


Question:
List all directors along with the number of films directed by each director.
Additional table information: table: cinema

Answer: SELECT directed_by, COUNT(*) FROM film GROUP BY directed_by


Question:
Which catalog content has the highest height? Give me the catalog entry name.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents ORDER BY height DESC LIMIT 1


Question:
What are the different names and countries of origins for all artists whose song ratings are above 9?
Additional table information: table: music_1

Answer: SELECT DISTINCT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.rating > 9


Question:
List the names of people that are not perpetrators.
Additional table information: table: perpetrator

Answer: SELECT Name FROM people WHERE NOT People_ID IN (SELECT People_ID FROM perpetrator)


Question:
Show the location code of the country 'Canada'.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT location_code FROM Ref_locations WHERE location_name = 'Canada'


Question:
What are the first names of all history professors who do not teach?
Additional table information: table: college_1

Answer: SELECT T1.emp_fname FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History' EXCEPT SELECT T4.emp_fname FROM employee AS T4 JOIN CLASS AS T5 ON T4.emp_num = T5.prof_num


Question:
What are the different product names, and what is the sum of quantity ordered for each product?
Additional table information: table: customers_and_invoices

Answer: SELECT T2.product_name, SUM(T1.product_quantity) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name


Question:
What are the names, headquarters and revenues for manufacturers, sorted by revenue descending?
Additional table information: table: manufactory_1

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


Question:
List document id of documents status is done and document type is Paper and the document is shipped by shipping agent named USPS.
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT document_id FROM Documents WHERE document_status_code = 'done' AND document_type_code = 'Paper' INTERSECT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = 'USPS'


Question:
display the country ID and number of cities for each country.
Additional table information: table: hr_1

Answer: SELECT country_id, COUNT(*) FROM locations GROUP BY country_id


Question:
what is the name of every pilot who is at least 25 years old?
Additional table information: table: aircraft

Answer: SELECT Name FROM pilot WHERE Age >= 25


Question:
Find the total number of students and total number of instructors for each department.
Additional table information: table: college_2

Answer: SELECT COUNT(DISTINCT T2.id), COUNT(DISTINCT T3.id), T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name GROUP BY T3.dept_name


Question:
What are the countries that have at least two perpetrators?
Additional table information: table: perpetrator

Answer: SELECT Country, COUNT(*) FROM perpetrator GROUP BY Country HAVING COUNT(*) >= 2


Question:
What is the first and last name of artist who performed 'Le Pop'?
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 = 'Le Pop'


Question:
Find the last names of all the teachers that teach 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:
List the name of the phone model launched in year 2002 and with the highest RAM size.
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 WHERE T1.Launch_year = 2002 ORDER BY T1.RAM_MiB DESC LIMIT 1


Question:
What is the average gpa of the students enrolled in the course with code ACCT-211?
Additional table information: table: college_1

Answer: SELECT AVG(T2.stu_gpa) FROM enroll AS T1 JOIN student AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T1.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211'


Question:
What is the average and maximum number of total passengers for train stations in London or Glasgow?
Additional table information: table: train_station

Answer: SELECT AVG(total_passengers), MAX(total_passengers) FROM station WHERE LOCATION = 'London' OR LOCATION = 'Glasgow'


Question:
Return the codes of the document types that do not have a total access count of over 10000.
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 is the campus fee of 'San Jose State University' in year 1996?
Additional table information: table: csu_1

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


Question:
Find the name of the program that is broadcast most frequently.
Additional table information: table: program_share

Answer: SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id GROUP BY t2.program_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of all districts with a city area greater than 10 or have more than 100000 people living there?
Additional table information: table: store_product

Answer: SELECT district_name FROM district WHERE city_area > 10 OR City_Population > 100000


Question:
What are the countries of mountains with height bigger than 5000?
Additional table information: table: climbing

Answer: SELECT Country FROM mountain WHERE Height > 5000


Question:
Show all video games with type Collectible card game.
Additional table information: table: game_1

Answer: SELECT gname FROM Video_games WHERE gtype = 'Collectible card game'


Question:
What are the full name (first and last name) and salary for all employees who does not have any value for commission?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary FROM employees WHERE commission_pct = 'null'


Question:
What is the total share of transactions?
Additional table information: table: tracking_share_transactions

Answer: SELECT SUM(share_count) FROM TRANSACTIONS


Question:
What is all the product data, as well as  each product's manufacturer?
Additional table information: table: manufactory_1

Answer: SELECT * FROM products AS T1 JOIN manufacturers AS T2 ON T1.manufacturer = T2.code


Question:
List the names of departments where some physicians are primarily affiliated with.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1


Question:
What are the distinct first names and cities of the students who have allergy either to milk or to cat?
Additional table information: table: allergy_1

Answer: SELECT DISTINCT T1.fname, T1.city_code FROM Student AS T1 JOIN Has_Allergy AS T2 ON T1.stuid = T2.stuid WHERE T2.Allergy = 'Milk' OR T2.Allergy = 'Cat'


Question:
Find the average age of the members in the club 'Bootup Baltimore'.
Additional table information: table: club_1

Answer: SELECT AVG(t3.age) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = 'Bootup Baltimore'


Question:
Find the name, age, and job title of persons who are friends with Alice for the longest years.
Additional table information: table: network_2

Answer: SELECT T1.name, T1.age, T1.job FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice' AND T2.year = (SELECT MAX(YEAR) FROM PersonFriend WHERE friend = 'Alice')


Question:
What is the most frequently ordered product? Tell me the detail of the product
Additional table information: table: customers_and_addresses

Answer: SELECT t2.product_details FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the locations shared by shops with open year later than 2012 and shops with open year before 2008.
Additional table information: table: device

Answer: SELECT LOCATION FROM shop WHERE Open_Year > 2012 INTERSECT SELECT LOCATION FROM shop WHERE Open_Year < 2008


Question:
How many invoices were billed from each state?
Additional table information: table: store_1

Answer: SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = 'USA' GROUP BY billing_state


Question:
Find the total savings balance of all accounts except the account with name ‘Brown’.
Additional table information: table: small_bank_1

Answer: SELECT SUM(T2.balance) FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T1.name <> 'Brown'


Question:
How many perpetrators are there?
Additional table information: table: perpetrator

Answer: SELECT COUNT(*) FROM perpetrator


Question:
How many reviewers are there?
Additional table information: table: movie_1

Answer: SELECT COUNT(*) FROM Reviewer


Question:
How many artists do not have any album?
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM ARTIST WHERE NOT artistid IN (SELECT artistid FROM ALBUM)


Question:
What is the average account balance of customers with credit score below 50 for the different account types?
Additional table information: table: loan_1

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


Question:
Find the list of attribute data types possessed by more than 3 attribute definitions.
Additional table information: table: product_catalog

Answer: SELECT attribute_data_type FROM Attribute_Definitions GROUP BY attribute_data_type HAVING COUNT(*) > 3


Question:
List all budget type codes and descriptions.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT budget_type_code, budget_type_description FROM Ref_budget_codes


Question:
How many animal type allergies exist?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Allergy_type WHERE allergytype = 'animal'


Question:
Tell me the name of the most pricy product.
Additional table information: table: cre_Drama_Workshop_Groups

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


Question:
What is the official name and status of the city with the most residents?
Additional table information: table: farm

Answer: SELECT Official_Name, Status FROM city ORDER BY Population DESC LIMIT 1


Question:
Find the average and maximum rating of all reviews.
Additional table information: table: epinions_1

Answer: SELECT AVG(rating), MAX(rating) FROM review


Question:
Show all cities and corresponding number of students.
Additional table information: table: allergy_1

Answer: SELECT city_code, COUNT(*) FROM Student GROUP BY city_code


Question:
How many captains with younger than 50 are in each rank?
Additional table information: table: ship_1

Answer: SELECT COUNT(*), rank FROM captain WHERE age < 50 GROUP BY rank


Question:
What are all the distinct participant ids who attended any events?
Additional table information: table: local_govt_in_alabama

Answer: SELECT COUNT(DISTINCT participant_id) FROM participants_in_Events


Question:
What are the names of all instructors who have taught a course, as well as the corresponding course id?
Additional table information: table: college_2

Answer: SELECT name, course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID


Question:
Find the title of course whose prerequisite is course Differential Geometry.
Additional table information: table: college_2

Answer: SELECT title FROM course WHERE course_id IN (SELECT T1.course_id FROM prereq AS T1 JOIN course AS T2 ON T1.prereq_id = T2.course_id WHERE T2.title = 'Differential Geometry')


Question:
What are the building, room number, semester and year of courses in the Psychology department, sorted using course title?
Additional table information: table: college_2

Answer: SELECT T2.building, T2.room_number, T2.semester, T2.year FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY T1.title NULLS FIRST


Question:
List the carriers of devices in ascending alphabetical order.
Additional table information: table: device

Answer: SELECT Carrier FROM device ORDER BY Carrier ASC NULLS FIRST


Question:
What are the maximum duration and resolution of songs grouped and ordered by languages?
Additional table information: table: music_1

Answer: SELECT MAX(T1.duration), MAX(T2.resolution), T2.languages FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.languages ORDER BY T2.languages NULLS FIRST


Question:
What are the different main industries for all companies?
Additional table information: table: gas_company

Answer: SELECT DISTINCT main_industry FROM company


Question:
Which policy type has the most records in the database?
Additional table information: table: insurance_fnol

Answer: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which allergy has most number of students affected?
Additional table information: table: allergy_1

Answer: SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the id and name of the enzyme with most number of medicines that can interact as 'activator'?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT T1.id, T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id WHERE T2.interaction_type = 'activitor' GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the papers published under the institution 'Indiana University'?
Additional table information: table: icfp_1

Answer: SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = 'Indiana University'


Question:
Find the county where produces the most number of wines with score higher than 90.
Additional table information: table: wine_1

Answer: SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T2.Score > 90 GROUP BY T1.County ORDER BY COUNT(*) DESC LIMIT 1


Question:
Compute the average active time span of contact channels.
Additional table information: table: customers_and_addresses

Answer: SELECT AVG(active_to_date - active_from_date) FROM customer_contact_channels


Question:
What is the title and id of the film that has the greatest number of copies in inventory?
Additional table information: table: sakila_1

Answer: 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 ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the count of cities with 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:
How many fault status codes are recorded in the fault log parts table?
Additional table information: table: assets_maintenance

Answer: SELECT DISTINCT fault_status FROM Fault_Log_Parts


Question:
What are the cities that have more than 2 airports sorted by number of airports?
Additional table information: table: flight_4

Answer: SELECT city FROM airports GROUP BY city HAVING COUNT(*) > 2 ORDER BY COUNT(*) NULLS FIRST


Question:
What is the id and family name of the driver who has the longest laptime?
Additional table information: table: formula_1

Answer: SELECT T1.driverid, T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid ORDER BY T2.milliseconds DESC LIMIT 1


Question:
What are the employee ids of the employees whose role name is 'Human Resource' or 'Manager'?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT T1.employee_id FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code = T2.role_code WHERE T2.role_name = 'Human Resource' OR T2.role_name = 'Manager'


Question:
Display the first and last name, and salary for those employees whose first name is ending with the letter m.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary FROM employees WHERE first_name LIKE '%m'


Question:
What are the zip codes that have an average mean humidity below 70 and had at least 100 trips come through there?
Additional table information: table: bike_1

Answer: SELECT zip_code FROM weather GROUP BY zip_code HAVING AVG(mean_humidity) < 70 INTERSECT SELECT zip_code FROM trip GROUP BY zip_code HAVING COUNT(*) >= 100


Question:
Find the number of scientists involved for the projects that require more than 300 hours.
Additional table information: table: scientist_1

Answer: SELECT COUNT(*), T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project WHERE T1.hours > 300 GROUP BY T1.name


Question:
What is the film title and inventory id of the item in the inventory which was rented most frequently?
Additional table information: table: sakila_1

Answer: SELECT T1.title, T2.inventory_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T2.inventory_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
With which kind of payment method were the least number of payments processed?
Additional table information: table: insurance_policies

Answer: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Count the number of distinct names associated with the photos.
Additional table information: table: cre_Theme_park

Answer: SELECT COUNT(DISTINCT Name) FROM PHOTOS


Question:
For each injury accident, find the date of the game and the name of the injured player in the game, and sort the results in descending order of game season.
Additional table information: table: game_injury

Answer: SELECT T1.date, T2.player FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id ORDER BY T1.season DESC


Question:
Find the number of customers who live in the city called Lake Geovannyton.
Additional table information: table: customers_and_addresses

Answer: SELECT COUNT(*) 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.city = 'Lake Geovannyton'


Question:
Show all party names and their region names.
Additional table information: table: party_people

Answer: SELECT T1.party_name, T2.region_name FROM party AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id


Question:
What is the most popular first name of the actors?
Additional table information: table: sakila_1

Answer: SELECT first_name FROM actor GROUP BY first_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
show the name of all bridges that was designed by american archtect, and sort the result by the bridge feet length.
Additional table information: table: architecture

Answer: SELECT t1.name FROM bridge AS t1 JOIN architect AS t2 ON t1.architect_id = t2.id WHERE t2.nationality = 'American' ORDER BY t1.length_feet NULLS FIRST


Question:
Show ids for the faculty members who don't advise any student.
Additional table information: table: activity_1

Answer: SELECT FacID FROM Faculty EXCEPT SELECT advisor FROM Student


Question:
How many tasks does each project have? List the task count and the project detail.
Additional table information: table: tracking_grants_for_research

Answer: SELECT COUNT(*), T1.project_details FROM Projects AS T1 JOIN Tasks AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id


Question:
For each dorm, how many amenities does it have?
Additional table information: table: dorm_1

Answer: SELECT COUNT(*), T1.dormid FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid WHERE T1.student_capacity > 100 GROUP BY T1.dormid


Question:
Give the title of the prerequisite to the course International Finance.
Additional table information: table: college_2

Answer: SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.title = 'International Finance')


Question:
What are the full names of actors who had roles in more than 30 films?
Additional table information: table: sakila_1

Answer: SELECT T2.first_name, T2.last_name FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id HAVING COUNT(*) > 30


Question:
What are the names of all aircrafts that are associated with both London Heathrow and Gatwick airports?
Additional table information: table: aircraft

Answer: SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = 'London Heathrow' INTERSECT SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = 'London Gatwick'


Question:
What are the employee ids and job ids for employees who make less than the lowest earning employee with title MK_MAN?
Additional table information: table: hr_1

Answer: SELECT employee_id, job_id FROM employees WHERE salary < (SELECT MIN(salary) FROM employees WHERE job_id = 'MK_MAN')


Question:
Which minister left office the latest?
Additional table information: table: party_people

Answer: SELECT minister FROM party ORDER BY left_office DESC LIMIT 1


Question:
What is the description for the budget type with 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:
Which countries has the most number of airlines whose active status is 'Y'?
Additional table information: table: flight_4

Answer: SELECT country FROM airlines WHERE active = 'Y' GROUP BY country ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is Nancy Edwards's address?
Additional table information: table: store_1

Answer: SELECT address FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'


Question:
How many different kinds of information sources are there for injury accidents?
Additional table information: table: game_injury

Answer: SELECT COUNT(DISTINCT SOURCE) FROM injury_accident


Question:
What are the distinct publishers of publications with price higher than 5000000?
Additional table information: table: book_2

Answer: SELECT DISTINCT Publisher FROM publication WHERE Price > 5000000


Question:
How many aircrafts do we have?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Aircraft


Question:
Show home city where at least two drivers older than 40 are from.
Additional table information: table: school_bus

Answer: SELECT home_city FROM driver WHERE age > 40 GROUP BY home_city HAVING COUNT(*) >= 2


Question:
What are the official native languages that contain the string 'English'.
Additional table information: table: match_season

Answer: SELECT Official_native_language FROM country WHERE Official_native_language LIKE '%English%'


Question:
Which events id does not have any participant with detail 'Kenyatta Kuhn'?
Additional table information: table: local_govt_in_alabama

Answer: SELECT event_id FROM EVENTS EXCEPT SELECT T1.event_id FROM Participants_in_Events AS T1 JOIN Participants AS T2 ON T1.Participant_ID = T2.Participant_ID WHERE Participant_Details = 'Kenyatta Kuhn'


Question:
Show the headquarters that have at least two companies.
Additional table information: table: company_employee

Answer: SELECT Headquarters FROM company GROUP BY Headquarters HAVING COUNT(*) >= 2


Question:
Which student's age is older than 18 and is majoring in 600? List each student's first and last name.
Additional table information: table: restaurant_1

Answer: SELECT Fname, Lname FROM Student WHERE Age > 18 AND Major = 600


Question:
Show the manager name with most number of gas stations opened after 2000.
Additional table information: table: gas_company

Answer: SELECT manager_name FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the category code and typical price of 'cumin'.
Additional table information: table: products_gen_characteristics

Answer: SELECT product_category_code, typical_buying_price FROM products WHERE product_name = 'cumin'


Question:
Find the the date of enrollment of the 'Spanish' course.
Additional table information: table: e_learning

Answer: SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'Spanish'


Question:
Which are the first and last names of the students taught by MARROTTE KIRK?
Additional table information: table: student_1

Answer: SELECT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = 'MARROTTE' AND T2.lastname = 'KIRK'


Question:
What is the headquarter of the company whose founder is James?
Additional table information: table: manufactory_1

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


Question:
What are the id of each employee and the number of document destruction authorised by that employee?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT Destruction_Authorised_by_Employee_ID, COUNT(*) FROM Documents_to_be_destroyed GROUP BY Destruction_Authorised_by_Employee_ID


Question:
What are the total number of students enrolled in ACCT-211?
Additional table information: table: college_1

Answer: SELECT COUNT(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code WHERE T1.crs_code = 'ACCT-211'


Question:
Find the distinct first names of all the students who have vice president votes and whose city code is not PIT.
Additional table information: table: voter_2

Answer: SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code = 'PIT'


Question:
Tell me the price ranges for all the hotels.
Additional table information: table: cre_Theme_park

Answer: SELECT price_range FROM HOTELS


Question:
Find the first names of students with age above 22.
Additional table information: table: voter_2

Answer: SELECT Fname FROM STUDENT WHERE Age > 22


Question:
Show the church names for the weddings of all people older than 30.
Additional table information: table: wedding

Answer: SELECT T4.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id JOIN church AS T4 ON T4.church_id = T1.church_id WHERE T2.age > 30 OR T3.age > 30


Question:
How many friends does Dan have?
Additional table information: table: network_2

Answer: SELECT COUNT(T2.friend) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Dan'


Question:
What are all the different first names of the drivers who are in position as standing and won?
Additional table information: table: formula_1

Answer: SELECT DISTINCT T1.forename FROM drivers AS T1 JOIN driverstandings AS T2 ON T1.driverid = T2.driverid WHERE T2.position = 1 AND T2.wins = 1


Question:
Find the players' first name and last name who won award both in 1960 and in 1961.
Additional table information: table: baseball_1

Answer: SELECT T1.name_first, T1.name_last FROM player AS T1, player_award AS T2 WHERE T2.year = 1960 INTERSECT SELECT T1.name_first, T1.name_last FROM player AS T1, player_award AS T2 WHERE T2.year = 1961


Question:
Return the cities with more than 3 airports in the United States.
Additional table information: table: flight_4

Answer: SELECT city FROM airports WHERE country = 'United States' GROUP BY city HAVING COUNT(*) > 3


Question:
Return the title of the film with the highest high estimate?
Additional table information: table: film_rank

Answer: SELECT t1.title FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID ORDER BY high_estimate DESC LIMIT 1


Question:
List the name of artworks that are not nominated.
Additional table information: table: entertainment_awards

Answer: SELECT Name FROM Artwork WHERE NOT Artwork_ID IN (SELECT Artwork_ID FROM nomination)


Question:
Find all the distinct id and nationality of drivers who have had laptime more than 100000 milliseconds?
Additional table information: table: formula_1

Answer: SELECT DISTINCT T1.driverid, T1.nationality FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE T2.milliseconds > 100000


Question:
How many accelerators are not compatible with the browsers listed ?
Additional table information: table: browser_web

Answer: SELECT COUNT(*) FROM web_client_accelerator WHERE NOT id IN (SELECT accelerator_id FROM accelerator_compatible_browser)


Question:
Find the the name of the customers who have a loan with amount more than 3000.
Additional table information: table: loan_1

Answer: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE amount > 3000


Question:
What are the names of all the physicians who took appointments.
Additional table information: table: hospital_1

Answer: SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID


Question:
What is the number of departments in Division 'AS'?
Additional table information: table: college_3

Answer: SELECT COUNT(*) FROM DEPARTMENT WHERE Division = 'AS'


Question:
List the venues of debates in ascending order of the number of audience.
Additional table information: table: debate

Answer: SELECT Venue FROM debate ORDER BY Num_of_Audience ASC NULLS FIRST


Question:
Find all the vocal types.
Additional table information: table: music_2

Answer: SELECT DISTINCT TYPE FROM vocals


Question:
List the hardware model name for the phons that were produced by 'Nokia Corporation' but whose screen mode type is not Text.
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 t2.Company_name = 'Nokia Corporation' AND T1.Type <> 'Text'


Question:
Give me a list of cities whose temperature in Feb is higher than that in Jun or cities that were once 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.Feb > T2.Jun UNION SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city


Question:
Return the names of wrestlers with fewer than 100 days held.
Additional table information: table: wrestler

Answer: SELECT Name FROM wrestler WHERE Days_held < 100


Question:
What is the total number of hours per work and number of games played by David Shieber?
Additional table information: table: game_1

Answer: SELECT SUM(hoursperweek), SUM(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Fname = 'David' AND T2.Lname = 'Shieber'


Question:
List the titles of books that are not published.
Additional table information: table: book_2

Answer: SELECT Title FROM book WHERE NOT Book_ID IN (SELECT Book_ID FROM publication)


Question:
What is the invoice number and invoice date for the invoice with most number of transactions?
Additional table information: table: customers_and_invoices

Answer: SELECT T2.invoice_number, T2.invoice_date FROM Financial_transactions AS T1 JOIN Invoices AS T2 ON T1.invoice_number = T2.invoice_number GROUP BY T1.invoice_number ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the id and last name of the driver who participated in the most races after 2010?
Additional table information: table: formula_1

Answer: SELECT T1.driverid, T1.surname FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid WHERE T3.year > 2010 GROUP BY T1.driverid ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the bed type and name of all the rooms with traditional decor?
Additional table information: table: inn_1

Answer: SELECT roomName, bedType FROM Rooms WHERE decor = 'traditional'


Question:
What are the student IDs for everybody who worked for more than 10 hours per week on all sports?
Additional table information: table: game_1

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


Question:
Show the name and population of the country that has the highest roller coaster.
Additional table information: table: roller_coaster

Answer: SELECT T1.Name, T1.population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID ORDER BY T2.Height DESC LIMIT 1


Question:
Which complaint status has more than 3 records on file?
Additional table information: table: customer_complaints

Answer: SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING COUNT(*) > 3


Question:
Show all distinct publishers for books.
Additional table information: table: culture_company

Answer: SELECT DISTINCT publisher FROM book_club


Question:
What is the total number of people who has no friend living in the city of Austin.
Additional table information: table: network_2

Answer: SELECT COUNT(DISTINCT name) FROM PersonFriend WHERE NOT friend IN (SELECT name FROM person WHERE city = 'Austin')


Question:
What are the names of parties that do not have delegates in election?
Additional table information: table: election

Answer: SELECT Party FROM party WHERE NOT Party_ID IN (SELECT Party FROM election)


Question:
How many Professors are in building NEB?
Additional table information: table: activity_1

Answer: SELECT COUNT(*) FROM Faculty WHERE Rank = 'Professor' AND building = 'NEB'


Question:
What are the first and last names of the top 10 longest-serving employees?
Additional table information: table: store_1

Answer: SELECT first_name, last_name FROM employees ORDER BY hire_date ASC NULLS FIRST LIMIT 10


Question:
Count the number of cinemas.
Additional table information: table: cinema

Answer: SELECT COUNT(*) FROM cinema


Question:
What is the count of states with college students playing in the mid position but not as goalies?
Additional table information: table: soccer_2

Answer: SELECT COUNT(*) FROM (SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'mid' EXCEPT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'goalie')


Question:
What are the times used by climbers who climbed mountains in the country of Uganda?
Additional table information: table: climbing

Answer: SELECT T1.Time FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T2.Country = 'Uganda'


Question:
Show different types of ships and the number of ships of each type.
Additional table information: table: ship_mission

Answer: SELECT TYPE, COUNT(*) FROM ship GROUP BY TYPE


Question:
Show the names of the three most recent festivals.
Additional table information: table: entertainment_awards

Answer: SELECT Festival_Name FROM festival_detail ORDER BY YEAR DESC LIMIT 3


Question:
What is the average distance and average price for flights from Los Angeles.
Additional table information: table: flight_1

Answer: SELECT AVG(distance), AVG(price) FROM Flight WHERE origin = 'Los Angeles'


Question:
What are the names of perpetrators in country 'China' or 'Japan'?
Additional table information: table: perpetrator

Answer: SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Country = 'China' OR T2.Country = 'Japan'


Question:
Count the number of different affiliation types.
Additional table information: table: university_basketball

Answer: SELECT COUNT(DISTINCT affiliation) FROM university


Question:
Return the apartment numbers of the apartments with type code 'Flat'.
Additional table information: table: apartment_rentals

Answer: SELECT apt_number FROM Apartments WHERE apt_type_code = 'Flat'


Question:
List the names of aircrafts and the number of times it won matches.
Additional table information: table: aircraft

Answer: SELECT T1.Aircraft, COUNT(*) FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft


Question:
Show the card type codes and the number of transactions.
Additional table information: table: customers_card_transactions

Answer: SELECT T2.card_type_code, COUNT(*) FROM Financial_transactions AS T1 JOIN Customers_cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code


Question:
Show the types of ships that have both ships with tonnage larger than 6000 and ships with tonnage smaller than 4000.
Additional table information: table: ship_mission

Answer: SELECT TYPE FROM ship WHERE Tonnage > 6000 INTERSECT SELECT TYPE FROM ship WHERE Tonnage < 4000


Question:
What are the names of the instructors in the Comp. Sci. department who earn more than 80000?
Additional table information: table: college_2

Answer: SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' AND salary > 80000


Question:
Find the name of the user who gave the highest rating.
Additional table information: table: epinions_1

Answer: SELECT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id ORDER BY T2.rating DESC LIMIT 1


Question:
What is the total number of people who have no friends living in Austin?
Additional table information: table: network_2

Answer: SELECT COUNT(DISTINCT name) FROM PersonFriend WHERE NOT friend IN (SELECT name FROM person WHERE city = 'Austin')


Question:
What are the different states that have students trying out?
Additional table information: table: soccer_2

Answer: SELECT DISTINCT state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName


Question:
What are the names of the amenities that Smith Hall has?
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'


Question:
Show the maximum share count of transactions where the amount is smaller than 10000
Additional table information: table: tracking_share_transactions

Answer: SELECT MAX(share_count) FROM TRANSACTIONS WHERE amount_of_transaction < 10000


Question:
How many video game types exist?
Additional table information: table: game_1

Answer: SELECT COUNT(DISTINCT gtype) FROM Video_games


Question:
What is the average age for each dorm and what are the names of each dorm?
Additional table information: table: dorm_1

Answer: SELECT AVG(T1.age), T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name


Question:
What is the average, maximum, and minimum for the number of hours spent training?
Additional table information: table: soccer_2

Answer: SELECT AVG(HS), MAX(HS), MIN(HS) FROM Player


Question:
How many songs have a lead vocal?
Additional table information: table: music_2

Answer: SELECT COUNT(DISTINCT title) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE TYPE = 'lead'


Question:
What are the names of tourist attraction that Alison visited but Rosalind did not visit?
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Name FROM Tourist_Attractions AS T1, VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = 'Alison' EXCEPT SELECT T1.Name FROM Tourist_Attractions AS T1, VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = 'Rosalind'


Question:
What are the songs in volumes associated with the artist aged 32 or older?
Additional table information: table: music_4

Answer: SELECT T2.Song FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age >= 32


Question:
What are the minimum and maximum crime rate of counties?
Additional table information: table: county_public_safety

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


Question:
What is total amount claimed summed across all the claims?
Additional table information: table: insurance_policies

Answer: SELECT SUM(Amount_Claimed) FROM Claims


Question:
How many tracks are in each genre?
Additional table information: table: store_1

Answer: SELECT COUNT(*), T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name


Question:
What is the name of the student who has the highest total credits in the History department.
Additional table information: table: college_2

Answer: SELECT name FROM student WHERE dept_name = 'History' ORDER BY tot_cred DESC LIMIT 1


Question:
Return the id of the customer who has the most cards, as well as the number of cards.
Additional table information: table: customers_card_transactions

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


Question:
What is the name of the track that has had the greatest number of races?
Additional table information: table: race_track

Answer: SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many colors are there?
Additional table information: table: products_gen_characteristics

Answer: SELECT COUNT(*) FROM ref_colors


Question:
Find the number of people who is under 40 for each gender.
Additional table information: table: network_2

Answer: SELECT COUNT(*), gender FROM Person WHERE age < 40 GROUP BY gender


Question:
List the names of the employees who authorized the destruction of documents and the employees who destroyed the corresponding documents.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT T2.employee_name, T3.employee_name FROM Documents_to_be_destroyed AS T1 JOIN Employees AS T2 ON T1.Destruction_Authorised_by_Employee_ID = T2.employee_id JOIN Employees AS T3 ON T1.Destroyed_by_Employee_ID = T3.employee_id


Question:
Find the name and email of the users who have more than 1000 followers.
Additional table information: table: twitter_1

Answer: SELECT name, email FROM user_profiles WHERE followers > 1000


Question:
Which campus was opened between 1935 and 1939?
Additional table information: table: csu_1

Answer: SELECT campus FROM campuses WHERE YEAR >= 1935 AND YEAR <= 1939


Question:
What are the hometowns that are shared by at least two gymnasts?
Additional table information: table: gymnast

Answer: SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown HAVING COUNT(*) >= 2


Question:
How many courses have more than 2 credits?
Additional table information: table: college_3

Answer: SELECT COUNT(*) FROM COURSE WHERE Credits > 2


Question:
What are the names and locations of tracks that have had exactly 1 race?
Additional table information: table: race_track

Answer: SELECT T2.name, T2.location FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id HAVING COUNT(*) = 1


Question:
Count the number of classrooms in Lamberton.
Additional table information: table: college_2

Answer: SELECT COUNT(*) FROM classroom WHERE building = 'Lamberton'


Question:
List the authors of submissions in ascending order of scores.
Additional table information: table: workshop_paper

Answer: SELECT Author FROM submission ORDER BY Scores ASC NULLS FIRST


Question:
Whah are the name of each industry and the number of companies in that industry?
Additional table information: table: company_office

Answer: SELECT Industry, COUNT(*) FROM Companies GROUP BY Industry


Question:
Find the average grade point of student whose last name is Smith.
Additional table information: table: college_3

Answer: SELECT AVG(T2.gradepoint) FROM ENROLLED_IN AS T1, GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T3.LName = 'Smith'


Question:
What is all the information about the basketball match?
Additional table information: table: university_basketball

Answer: SELECT * FROM basketball_match


Question:
What is the name and salary of the employee with the id 242518965?
Additional table information: table: flight_1

Answer: SELECT name, salary FROM Employee WHERE eid = 242518965


Question:
What is the team with at least 2 technicians?
Additional table information: table: machine_repair

Answer: SELECT Team FROM technician GROUP BY Team HAVING COUNT(*) >= 2


Question:
Find the description of the club called 'Tennis Club'.
Additional table information: table: club_1

Answer: SELECT clubdesc FROM club WHERE clubname = 'Tennis Club'


Question:
What are the names of photos taken with the lens brand 'Sigma' or 'Olympus'?
Additional table information: table: mountain_photos

Answer: SELECT T1.name FROM camera_lens AS T1 JOIN photos AS T2 ON T2.camera_lens_id = T1.id WHERE T1.brand = 'Sigma' OR T1.brand = 'Olympus'


Question:
Find the person who has exactly one friend.
Additional table information: table: network_2

Answer: SELECT name FROM PersonFriend GROUP BY name HAVING COUNT(*) = 1


Question:
In which year did the most recent crime happen?
Additional table information: table: perpetrator

Answer: SELECT MAX(YEAR) FROM perpetrator


Question:
Find the average number of customers in all banks of Utah state.
Additional table information: table: loan_1

Answer: SELECT AVG(no_of_customers) FROM bank WHERE state = 'Utah'


Question:
Which customer status code has least number of customers?
Additional table information: table: driving_school

Answer: SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
What are the names of customers who have taken out more than one loan?
Additional table information: table: loan_1

Answer: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name HAVING COUNT(*) > 1


Question:
Show all artist names and the year joined who are not from United States.
Additional table information: table: theme_gallery

Answer: SELECT name, year_join FROM artist WHERE country <> 'United States'


Question:
Can you return all detailed info of jobs which was done by any of the employees who is presently earning a salary on and above 12000?
Additional table information: table: hr_1

Answer: SELECT * FROM job_history AS T1 JOIN employees AS T2 ON T1.employee_id = T2.employee_id WHERE T2.salary >= 12000


Question:
Count the number of races.
Additional table information: table: race_track

Answer: SELECT COUNT(*) FROM race


Question:
Show the opening year in whcih at least two churches opened.
Additional table information: table: wedding

Answer: SELECT open_date FROM church GROUP BY open_date HAVING COUNT(*) >= 2


Question:
Find the name of dorms that do not have any amenity
Additional table information: table: dorm_1

Answer: SELECT dorm_name FROM dorm WHERE NOT dormid IN (SELECT dormid FROM has_amenity)


Question:
Find the title of courses that have two prerequisites?
Additional table information: table: college_2

Answer: SELECT T1.title FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING COUNT(*) = 2


Question:
Which cities have lower temperature in March than in Dec and have never served as 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 number of different cities that employees live in.
Additional table information: table: chinook_1

Answer: SELECT COUNT(DISTINCT city) FROM EMPLOYEE


Question:
Show names of technicians in ascending order of quality rank of the machine they are assigned.
Additional table information: table: machine_repair

Answer: SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID ORDER BY T2.quality_rank NULLS FIRST


Question:
How many customers are there?
Additional table information: table: customer_complaints

Answer: SELECT COUNT(*) FROM customers


Question:
Count the number of entrepreneurs.
Additional table information: table: entrepreneur

Answer: SELECT COUNT(*) FROM entrepreneur


Question:
What is the customer last name, id and phone number with most number of orders?
Additional table information: table: customers_and_invoices

Answer: SELECT T2.customer_last_name, T1.customer_id, T2.phone_number FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
For each journal_committee, find the editor name and the journal theme.
Additional table information: table: journal_committee

Answer: SELECT T2.Name, T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID


Question:
List the states which have between 2 to 4 staffs living there.
Additional table information: table: driving_school

Answer: SELECT T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.state_province_county HAVING COUNT(*) BETWEEN 2 AND 4


Question:
Return the full name and id of the actor or actress who starred in the greatest number of films.
Additional table information: table: sakila_1

Answer: SELECT T2.first_name, T2.last_name, T2.actor_id FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of all friends who are from New York?
Additional table information: table: network_2

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


Question:
What are the names of all instructors with a higher salary than any of the instructors in the Biology department?
Additional table information: table: college_2

Answer: SELECT name FROM instructor WHERE salary > (SELECT MAX(salary) FROM instructor WHERE dept_name = 'Biology')


Question:
What are the maximum and minimum product prices for each product type?
Additional table information: table: department_store

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


Question:
What are the official languages of the countries of players from Maryland or Duke college?
Additional table information: table: match_season

Answer: SELECT T1.Official_native_language FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.College = 'Maryland' OR T2.College = 'Duke'


Question:
Give me the descriptions of the service types that cost more than 100.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.Service_Type_Description FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Price > 100


Question:
What is the sport with the most scholarship students?
Additional table information: table: game_1

Answer: SELECT sportname FROM Sportsinfo WHERE onscholarship = 'Y' GROUP BY sportname ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of parties that have both delegates on 'Appropriations' committee and
Additional table information: table: election

Answer: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = 'Appropriations' INTERSECT SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = 'Economic Matters'


Question:
Find the details of all the distinct customers who have orders with status 'On Road'.
Additional table information: table: tracking_orders

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


Question:
What is ids of the songs whose resolution is higher than the average resolution of songs in modern genre?
Additional table information: table: music_1

Answer: SELECT f_id FROM song WHERE resolution > (SELECT AVG(resolution) FROM song WHERE genre_is = 'modern')


Question:
How many roles are there?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT COUNT(*) FROM ROLES


Question:
What are the total number of the audiences who visited any of the festivals?
Additional table information: table: entertainment_awards

Answer: SELECT SUM(Num_of_Audience) FROM festival_detail


Question:
How many artists do we have?
Additional table information: table: theme_gallery

Answer: SELECT COUNT(*) FROM artist


Question:
List the names of technicians who have not been assigned to repair machines.
Additional table information: table: machine_repair

Answer: SELECT Name FROM technician WHERE NOT technician_id IN (SELECT technician_id FROM repair_assignment)


Question:
What are the ids of the faculty members who do not advise any student.
Additional table information: table: activity_1

Answer: SELECT FacID FROM Faculty EXCEPT SELECT advisor FROM Student


Question:
What are the names and dates of races, and the names of the tracks where they are held?
Additional table information: table: race_track

Answer: SELECT T1.name, T1.date, T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id


Question:
Find the first names of all the teachers that teach in classroom 110.
Additional table information: table: student_1

Answer: SELECT firstname FROM teachers WHERE classroom = 110


Question:
Find the checking balance and saving balance in the Brown’s account.
Additional table information: table: small_bank_1

Answer: SELECT T2.balance, T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T1.name = 'Brown'


Question:
What are the ids of stations that have latitude above 37.4 and never had bike availability below 7?
Additional table information: table: bike_1

Answer: SELECT id FROM station WHERE lat > 37.4 EXCEPT SELECT station_id FROM status GROUP BY station_id HAVING MIN(bikes_available) < 7


Question:
What are the name, origin and owner of each program?
Additional table information: table: program_share

Answer: SELECT name, origin, OWNER FROM program


Question:
How many students are affected by each allergy type?
Additional table information: table: allergy_1

Answer: SELECT T2.allergytype, COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype


Question:
What are the names of courses that give either 3 credits, or 1 credit and 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:
Find the ids of orders which are shipped after 2000-01-01.
Additional table information: table: tracking_orders

Answer: SELECT order_id FROM shipments WHERE shipment_date > '2000-01-01'


Question:
What is the total number of products that are in orders with status 'Cancelled'?
Additional table information: table: customers_and_addresses

Answer: SELECT SUM(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_status = 'Cancelled'


Question:
Select the average price of each manufacturer's products, showing only the manufacturer's code.
Additional table information: table: manufactory_1

Answer: SELECT AVG(Price), manufacturer FROM Products GROUP BY manufacturer


Question:
Which buildings have apartments that have more than two bathrooms? Give me the addresses of the buildings.
Additional table information: table: apartment_rentals

Answer: SELECT T1.building_address FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T2.bathroom_count > 2


Question:
Find the last name of the author with first name 'Amal'.
Additional table information: table: icfp_1

Answer: SELECT lname FROM authors WHERE fname = 'Amal'


Question:
What is the average number of hours spent practicing for students who got rejected?
Additional table information: table: soccer_2

Answer: SELECT AVG(T1.HS) FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'no'


Question:
What are the dates of transactions with at least 100 share count or amount bigger than 100?
Additional table information: table: tracking_share_transactions

Answer: SELECT date_of_transaction FROM TRANSACTIONS WHERE share_count >= 100 OR amount_of_transaction >= 100


Question:
How old is the average person for each job?
Additional table information: table: network_2

Answer: SELECT AVG(age), job FROM Person GROUP BY job


Question:
What are the first and last names of all customers with between 1000 and 3000 dollars outstanding?
Additional table information: table: driving_school

Answer: SELECT first_name, last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000


Question:
What are the distinct first names, last names, and phone numbers for customers with accounts?
Additional table information: table: customers_and_invoices

Answer: SELECT DISTINCT T1.customer_first_name, T1.customer_last_name, T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id


Question:
Which vocal type has the band mate with last name 'Heilo' played the most?
Additional table information: table: music_2

Answer: SELECT TYPE FROM vocals AS T1 JOIN band AS T2 ON T1.bandmate = T2.id WHERE lastname = 'Heilo' GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the id of the files that are available in the format of mp4 and a resolution smaller than 1000?
Additional table information: table: music_1

Answer: SELECT f_id FROM files WHERE formats = 'mp4' INTERSECT SELECT f_id FROM song WHERE resolution < 1000


Question:
What are the speeds of the longest roller coaster?
Additional table information: table: roller_coaster

Answer: SELECT Speed FROM roller_coaster ORDER BY LENGTH DESC LIMIT 1


Question:
Find the total number of employees.
Additional table information: table: college_1

Answer: SELECT COUNT(*) FROM employee


Question:
How many main stream browsers whose market share is at least 5 exist?
Additional table information: table: browser_web

Answer: SELECT COUNT(*) FROM browser WHERE market_share >= 5


Question:
Return the staff ids and genders for any staff with the title Department Manager.
Additional table information: table: department_store

Answer: SELECT T1.staff_id, T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = 'Department Manager'


Question:
What are the allergies and their types that the student with first name Lisa has? And order the result by name of allergies.
Additional table information: table: allergy_1

Answer: SELECT T1.Allergy, T1.AllergyType FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = 'Lisa' ORDER BY T1.Allergy NULLS FIRST


Question:
What information is there on albums from 2010?
Additional table information: table: music_2

Answer: SELECT * FROM Albums WHERE YEAR = 2010


Question:
What are the different years for all competitions that are not of type equal to tournament?
Additional table information: table: sports_competition

Answer: SELECT DISTINCT YEAR FROM competition WHERE Competition_type <> 'Tournament'


Question:
What are lines 1 and 2 of the addressed of the customer with the email 'vbogisich@example.org'?
Additional table information: table: customer_complaints

Answer: SELECT address_line_1, address_line_2 FROM customers WHERE email_address = 'vbogisich@example.org'


Question:
What are the different ranges of the 3 mountains with the highest prominence?
Additional table information: table: climbing

Answer: SELECT DISTINCT Range FROM mountain ORDER BY Prominence DESC LIMIT 3


Question:
What are the different software platforms for devices, ordered by frequency descending?
Additional table information: table: device

Answer: SELECT Software_Platform FROM device GROUP BY Software_Platform ORDER BY COUNT(*) DESC


Question:
List the names of editors in ascending order of age.
Additional table information: table: journal_committee

Answer: SELECT Name FROM editor ORDER BY Age ASC NULLS FIRST


Question:
What are the minimum and maximum vote percents of elections?
Additional table information: table: election_representative

Answer: SELECT MIN(Vote_Percent), MAX(Vote_Percent) FROM election


Question:
What are the different district names in order of descending city area?
Additional table information: table: store_product

Answer: SELECT DISTINCT District_name FROM district ORDER BY city_area DESC


Question:
What are the names of all songs produced by the artist with the first name 'Marianne'?
Additional table information: table: music_2

Answer: SELECT T3.Title FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T2.firstname = 'Marianne'


Question:
Which customer made the smallest amount of claim in one claim? Return the customer details.
Additional table information: table: insurance_and_eClaims

Answer: SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_piad = (SELECT MIN(amount_piad) FROM claim_headers)


Question:
Which order deals with the most items? Return the order id.
Additional table information: table: tracking_orders

Answer: SELECT T1.order_id FROM orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id GROUP BY T1.order_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the amount of the largest payment.
Additional table information: table: sakila_1

Answer: SELECT amount FROM payment ORDER BY amount DESC LIMIT 1


Question:
Find the distinct unit prices for tracks.
Additional table information: table: chinook_1

Answer: SELECT DISTINCT (UnitPrice) FROM TRACK


Question:
Find the last names of the students in third grade that are not taught by COVIN JEROME.
Additional table information: table: student_1

Answer: SELECT DISTINCT T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 3 AND T2.firstname <> 'COVIN' AND T2.lastname <> 'JEROME'


Question:
Find the first name of students who are living in the dorm that has most number of amenities.
Additional table information: table: dorm_1

Answer: SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T2.dormid FROM dorm AS T3 JOIN has_amenity AS T4 ON T3.dormid = T4.dormid JOIN dorm_amenity AS T5 ON T4.amenid = T5.amenid GROUP BY T3.dormid ORDER BY COUNT(*) DESC LIMIT 1)


Question:
What are the names of scientists who have not been assigned a project?
Additional table information: table: scientist_1

Answer: SELECT Name FROM scientists WHERE NOT ssn IN (SELECT scientist FROM AssignedTo)


Question:
What are the booking start and end dates of the apartments with more than 2 bedrooms?
Additional table information: table: apartment_rentals

Answer: SELECT T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2


Question:
What is the color code and description of the product named 'chervil'?
Additional table information: table: products_gen_characteristics

Answer: SELECT t1.color_code, t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = 'chervil'


Question:
Return the total points of the gymnast with the lowest age.
Additional table information: table: gymnast

Answer: SELECT T1.Total_Points FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T2.Age ASC NULLS FIRST LIMIT 1


Question:
What are the different card types, and how many cards are there of each?
Additional table information: table: customers_card_transactions

Answer: SELECT card_type_code, COUNT(*) FROM Customers_cards GROUP BY card_type_code


Question:
Find the last name and hire date of the professor who is in office DRE 102.
Additional table information: table: college_1

Answer: SELECT T1.emp_lname, T1.emp_hiredate FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num WHERE T2.prof_office = 'DRE 102'


Question:
Find the first name and last name of the instructor of course that has course name
Additional table information: table: college_3

Answer: SELECT T2.Fname, T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID WHERE T1.CName = 'COMPUTER LITERACY'


Question:
What is the average length in feet of the bridges?
Additional table information: table: architecture

Answer: SELECT AVG(length_feet) FROM bridge


Question:
List the names of wrestlers in descending order of days held.
Additional table information: table: wrestler

Answer: SELECT Name FROM wrestler ORDER BY Days_held DESC


Question:
How many premises are there?
Additional table information: table: customers_campaigns_ecommerce

Answer: SELECT COUNT(*) FROM premises


Question:
Find the names of all instructors who have taught some course and the course_id.
Additional table information: table: college_2

Answer: SELECT name, course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID


Question:
Return the names and ids of each account, as well as the number of transactions.
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:
Show the distinct themes of journals.
Additional table information: table: journal_committee

Answer: SELECT DISTINCT Theme FROM journal