question
stringlengths 63
269
| answer
stringlengths 18
557
|
---|---|
List all the username and passwords of users with the most popular role.
Additional table information: table: document_management | SELECT user_name, password FROM users GROUP BY role_code ORDER BY COUNT(*) DESC LIMIT 1 |
List the names of 5 users followed by the largest number of other users.
Additional table information: table: twitter_1 | SELECT name FROM user_profiles ORDER BY followers DESC LIMIT 5 |
Show teams that have suffered more than three eliminations.
Additional table information: table: wrestler | SELECT Team FROM elimination GROUP BY Team HAVING COUNT(*) > 3 |
What are all the instruments used by the musician with the last name 'Heilo'?
Additional table information: table: music_2 | SELECT instrument FROM instruments AS T1 JOIN Band AS T2 ON T1.bandmateid = T2.id WHERE T2.lastname = 'Heilo' |
How many instruments does the song 'Le Pop' use?
Additional table information: table: music_2 | SELECT COUNT(DISTINCT instrument) FROM instruments AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE title = 'Le Pop' |
Which nurses are in charge of patients undergoing treatments?
Additional table information: table: hospital_1 | SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID |
What are the distinct secretary votes in the fall election cycle?
Additional table information: table: voter_2 | SELECT DISTINCT Secretary_Vote FROM VOTING_RECORD WHERE ELECTION_CYCLE = 'Fall' |
What are the names of patients who are not taking the medication of Procrastin-X.
Additional table information: table: hospital_1 | SELECT name FROM patient EXCEPT SELECT T1.name FROM patient AS T1 JOIN Prescribes AS T2 ON T2.Patient = T1.SSN JOIN Medication AS T3 ON T2.Medication = T3.Code WHERE T3.name = 'Procrastin-X' |
What are the names of projects that have taken longer than the average number of hours for all projects?
Additional table information: table: scientist_1 | SELECT name FROM projects WHERE hours > (SELECT AVG(hours) FROM projects) |
Find the latest logon date of the students whose family name is 'Jaskolski' or 'Langosh'.
Additional table information: table: e_learning | SELECT date_of_latest_logon FROM Students WHERE family_name = 'Jaskolski' OR family_name = 'Langosh' |
Find all the cities that have 2 to 4 parks.
Additional table information: table: baseball_1 | SELECT city FROM park GROUP BY city HAVING COUNT(*) BETWEEN 2 AND 4 |
Find the id and name of the most expensive base price room.
Additional table information: table: inn_1 | SELECT RoomId, roomName FROM Rooms ORDER BY basePrice DESC LIMIT 1 |
How much salary did the top 3 well-paid players get in 2001?
Additional table information: table: baseball_1 | SELECT salary FROM salary WHERE YEAR = 2001 ORDER BY salary DESC LIMIT 3 |
List the name of all customers sorted by their account balance in ascending order.
Additional table information: table: loan_1 | SELECT cust_name FROM customer ORDER BY acc_bal NULLS FIRST |
How many customers do we have?
Additional table information: table: customers_card_transactions | SELECT COUNT(*) FROM Customers |
How many tracks belong to rock genre?
Additional table information: table: chinook_1 | SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Rock' |
Retrieve all the first and last names of authors in the alphabetical order of last names.
Additional table information: table: icfp_1 | SELECT fname, lname FROM authors ORDER BY lname NULLS FIRST |
What are the different names of all the races in reverse alphabetical order?
Additional table information: table: formula_1 | SELECT DISTINCT name FROM races ORDER BY name DESC |
Return the name of the category to which the film 'HUNGER ROOF' belongs.
Additional table information: table: sakila_1 | SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id = T2.category_id JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'HUNGER ROOF' |
Find the forename and surname of drivers whose nationality is German?
Additional table information: table: formula_1 | SELECT forename, surname FROM drivers WHERE nationality = 'German' |
What are the room names and ids of all the rooms that cost more than 160 and can accommodate more than two people.
Additional table information: table: inn_1 | SELECT roomName, RoomId FROM Rooms WHERE basePrice > 160 AND maxOccupancy > 2 |
Return the address and email of the customer with the first name Linda.
Additional table information: table: sakila_1 | SELECT T2.address, T1.email FROM customer AS T1 JOIN address AS T2 ON T2.address_id = T1.address_id WHERE T1.first_name = 'LINDA' |
How many lessons were taught by a staff member whose first name has the letter 'a' in it?
Additional table information: table: driving_school | SELECT COUNT(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE '%a%' |
What is the theme and artist name for the exhibition with a ticket price higher than the average?
Additional table information: table: theme_gallery | SELECT T1.theme, T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.ticket_price > (SELECT AVG(ticket_price) FROM exhibition) |
What are the names of the technicians that are assigned to repair machines with more point values than 70?
Additional table information: table: machine_repair | 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 WHERE T2.value_points > 70 |
Count the number of courses in the Physics department.
Additional table information: table: college_2 | SELECT COUNT(DISTINCT course_id) FROM course WHERE dept_name = 'Physics' |
Show the ids of the students who don't participate in any activity.
Additional table information: table: activity_1 | SELECT StuID FROM Student EXCEPT SELECT StuID FROM Participates_in |
How many schools are in the basketball match?
Additional table information: table: university_basketball | SELECT COUNT(DISTINCT school_id) FROM basketball_match |
What is the theme, date, and attendance for the exhibition in year 2004?
Additional table information: table: theme_gallery | SELECT T2.theme, T1.date, T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T2.year = 2004 |
What are the ids of all reviewers who have not given 4 stars at least once?
Additional table information: table: movie_1 | SELECT rID FROM Rating WHERE stars <> 4 |
Find all the albums in 2012.
Additional table information: table: music_2 | SELECT * FROM Albums WHERE YEAR = 2012 |
What are the rooms for members of the faculty who are professors and who live in building NEB?
Additional table information: table: college_3 | SELECT Room FROM FACULTY WHERE Rank = 'Professor' AND Building = 'NEB' |
What is maximum and minimum RAM size of phone produced by company named 'Nokia Corporation'?
Additional table information: table: phone_1 | SELECT MAX(T1.RAM_MiB), MIN(T1.RAM_MiB) FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T2.Company_name = 'Nokia Corporation' |
List the names of people that have not been on the affirmative side of debates.
Additional table information: table: debate | SELECT Name FROM people WHERE NOT People_id IN (SELECT Affirmative FROM debate_people) |
find the total percentage share of all channels owned by CCTV.
Additional table information: table: program_share | SELECT SUM(Share_in_percent) FROM channel WHERE OWNER = 'CCTV' |
What are the names of students who have taken the prerequisite for the course International Finance?
Additional table information: table: college_2 | SELECT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id = T4.course_id WHERE T3.title = 'International Finance') |
What are the party emails associated with parties that used the party form that is the most common?
Additional table information: table: e_government | SELECT t1.party_email FROM parties AS t1 JOIN party_forms AS t2 ON t1.party_id = t2.party_id WHERE t2.form_id = (SELECT form_id FROM party_forms GROUP BY form_id ORDER BY COUNT(*) DESC LIMIT 1) |
How many medications are prescribed for each brand?
Additional table information: table: hospital_1 | SELECT COUNT(*), T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand |
What are the names, classes, and dates for all races?
Additional table information: table: race_track | SELECT name, CLASS, date FROM race |
Find the city that hosted the most events.
Additional table information: table: city_record | SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY T2.host_city ORDER BY COUNT(*) DESC LIMIT 1 |
How many vehicles exist?
Additional table information: table: driving_school | SELECT COUNT(*) FROM Vehicles |
Which catalog contents have a product stock number that starts from '2'? Show the catalog entry names.
Additional table information: table: product_catalog | SELECT catalog_entry_name FROM catalog_contents WHERE product_stock_number LIKE '2%' |
What is the aircraft name for the flight with number 99
Additional table information: table: flight_1 | SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99 |
What are the names and locations of festivals?
Additional table information: table: entertainment_awards | SELECT Festival_Name, LOCATION FROM festival_detail |
On what dates did the student with family name 'Zieme' and personal name 'Bernie' enroll in and complete the courses?
Additional table information: table: e_learning | SELECT T1.date_of_enrolment, T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.family_name = 'Zieme' AND T2.personal_name = 'Bernie' |
What are the gas station ids, locations, and manager names for the gas stations ordered by opening year?
Additional table information: table: gas_company | SELECT station_id, LOCATION, manager_name FROM gas_station ORDER BY open_year NULLS FIRST |
List all the event names by year from the most recent to the oldest.
Additional table information: table: swimming | SELECT name FROM event ORDER BY YEAR DESC |
What are the names and countries of members?
Additional table information: table: decoration_competition | SELECT Name, Country FROM member |
List the actual delivery date for all the orders with quantity 1
Additional table information: table: cre_Drama_Workshop_Groups | SELECT T1.Actual_Delivery_Date FROM Customer_Orders AS T1 JOIN ORDER_ITEMS AS T2 ON T1.Order_ID = T2.Order_ID WHERE T2.Order_Quantity = 1 |
What are the names of races that were held after 2017 and the circuits were in the country of Spain?
Additional table information: table: formula_1 | SELECT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitid = T2.circuitid WHERE T2.country = 'Spain' AND T1.year > 2017 |
Show the name of cities in the county that has the largest number of police officers.
Additional table information: table: county_public_safety | SELECT name FROM city WHERE county_ID = (SELECT county_ID FROM county_public_safety ORDER BY Police_officers DESC LIMIT 1) |
Find the buildings which have rooms with capacity more than 50.
Additional table information: table: college_2 | SELECT DISTINCT building FROM classroom WHERE capacity > 50 |
Find the name of the customer who made an order most recently.
Additional table information: table: customers_and_addresses | SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.order_date DESC LIMIT 1 |
What is the average price of products with manufacturer codes equal to 2?
Additional table information: table: manufactory_1 | SELECT AVG(price) FROM products WHERE manufacturer = 2 |
Find the average age and experience working length of journalists working on different role type.
Additional table information: table: news_report | SELECT AVG(t1.age), AVG(Years_working), t2.work_type FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_id = t2.journalist_id GROUP BY t2.work_type |
Which Advisor has most of students? List advisor and the number of students.
Additional table information: table: restaurant_1 | SELECT Advisor, COUNT(*) FROM Student GROUP BY Advisor ORDER BY COUNT(Advisor) DESC LIMIT 1 |
Find the names of all the tracks that contain the word 'you'.
Additional table information: table: chinook_1 | SELECT Name FROM TRACK WHERE Name LIKE '%you%' |
What are the names of all instructors who advise students in the math depart sorted by total credits of the student.
Additional table information: table: college_2 | SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'Math' ORDER BY T3.tot_cred NULLS FIRST |
Find the average access count across all documents?
Additional table information: table: document_management | SELECT AVG(access_count) FROM documents |
Which industry has the most companies?
Additional table information: table: company_office | SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1 |
Return the most common first name among all actors.
Additional table information: table: sakila_1 | SELECT first_name FROM actor GROUP BY first_name ORDER BY COUNT(*) DESC LIMIT 1 |
What are the type codes of the policies used by the customer 'Dayana Robel'?
Additional table information: table: insurance_and_eClaims | SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_details = 'Dayana Robel' |
What are the names of all the tracks that are in both the Movies and music playlists?
Additional table information: table: store_1 | SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' INTERSECT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music' |
Show the delegates and the names of the party they belong to.
Additional table information: table: election | SELECT T1.Delegate, T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID |
display the full name (first and last name), and salary of those employees who working in any department located in London.
Additional table information: table: hr_1 | SELECT first_name, last_name, salary FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id WHERE T3.city = 'London' |
Compute the total salary that the player with first name Len and last name Barker received between 1985 to 1990.
Additional table information: table: baseball_1 | SELECT SUM(T1.salary) FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id WHERE T2.name_first = 'Len' AND T2.name_last = 'Barker' AND T1.year BETWEEN 1985 AND 1990 |
What are the name, id and the corresponding number of visits for each tourist attraction?
Additional table information: table: cre_Theme_park | SELECT T1.Name, T2.Tourist_Attraction_ID, COUNT(*) FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID |
What are the method, date and amount of each payment? Sort the list in ascending order of date.
Additional table information: table: insurance_policies | SELECT Payment_Method_Code, Date_Payment_Made, Amount_Payment FROM Payments ORDER BY Date_Payment_Made ASC NULLS FIRST |
List the first name and last name of all customers.
Additional table information: table: driving_school | SELECT first_name, last_name FROM Customers |
Show the name and location for all tracks.
Additional table information: table: race_track | SELECT name, LOCATION FROM track |
List the name, born state and age of the heads of departments ordered by age.
Additional table information: table: department_management | SELECT name, born_state, age FROM head ORDER BY age NULLS FIRST |
Find the title, credit, and department name of courses that have more than one prerequisites?
Additional table information: table: college_2 | SELECT T1.title, T1.credits, T1.dept_name FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING COUNT(*) > 1 |
How many airports are there per city in the US ordered from most to least?
Additional table information: table: flight_4 | SELECT COUNT(*), city FROM airports WHERE country = 'United States' GROUP BY city ORDER BY COUNT(*) DESC |
Show all role codes and the number of employees in each role.
Additional table information: table: cre_Doc_Tracking_DB | SELECT role_code, COUNT(*) FROM Employees GROUP BY role_code |
What is the id and detail of the vehicle used in lessons for most of the times?
Additional table information: table: driving_school | SELECT T1.vehicle_id, T1.vehicle_details FROM Vehicles AS T1 JOIN Lessons AS T2 ON T1.vehicle_id = T2.vehicle_id GROUP BY T1.vehicle_id ORDER BY COUNT(*) DESC LIMIT 1 |
List the dates and vote percents of elections.
Additional table information: table: election_representative | SELECT Date, Vote_Percent FROM election |
List the names of mountains that do not have any climber.
Additional table information: table: climbing | SELECT Name FROM mountain WHERE NOT Mountain_ID IN (SELECT Mountain_ID FROM climber) |
What is the average total number of passengers of airports that are associated with aircraft 'Robinson R-22'?
Additional table information: table: aircraft | SELECT AVG(T3.Total_Passengers) 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 T1.Aircraft = 'Robinson R-22' |
Find the name of instructors who didn't teach any courses?
Additional table information: table: college_2 | SELECT name FROM instructor WHERE NOT id IN (SELECT id FROM teaches) |
How many distinct official languages are there among countries of players whose positions are defenders.
Additional table information: table: match_season | SELECT COUNT(DISTINCT T1.Official_native_language) FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.Position = 'Defender' |
Retrieve the country that has published the most papers.
Additional table information: table: icfp_1 | SELECT t1.country FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.country ORDER BY COUNT(*) DESC LIMIT 1 |
What destination has the fewest number of flights?
Additional table information: table: flight_1 | SELECT destination FROM Flight GROUP BY destination ORDER BY COUNT(*) NULLS FIRST LIMIT 1 |
Return the channel code and contact number of the customer contact channel whose active duration was the longest.
Additional table information: table: customers_and_addresses | SELECT channel_code, contact_number FROM customer_contact_channels WHERE active_to_date - active_from_date = (SELECT active_to_date - active_from_date FROM customer_contact_channels ORDER BY (active_to_date - active_from_date) DESC LIMIT 1) |
What is the average high temperature for each day of week?
Additional table information: table: station_weather | SELECT AVG(high_temperature), day_of_week FROM weekly_weather GROUP BY day_of_week |
How many distinct publication dates are there in our record?
Additional table information: table: book_2 | SELECT COUNT(DISTINCT Publication_Date) FROM publication |
What are the payment dates for any payments that have an amount greater than 10 or were handled by a staff member with the first name Elsa?
Additional table information: table: sakila_1 | SELECT payment_date FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa' |
What is the average number of stars that each reviewer awards for a movie?
Additional table information: table: movie_1 | SELECT T2.name, AVG(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name |
Please list the years of film market estimations when the market is in country 'Japan' in descending order.
Additional table information: table: film_rank | SELECT T1.Year FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID WHERE T2.Country = 'Japan' ORDER BY T1.Year DESC |
Find the number of students whose city code is NYC and who have class senator votes in the spring election cycle.
Additional table information: table: voter_2 | SELECT COUNT(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.city_code = 'NYC' AND T2.Election_Cycle = 'Spring' |
What are all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona.
Additional table information: table: customers_and_addresses | SELECT address_content FROM addresses WHERE city = 'East Julianaside' AND state_province_county = 'Texas' UNION SELECT address_content FROM addresses WHERE city = 'Gleasonmouth' AND state_province_county = 'Arizona' |
What are the first and last names of the instructors who teach the top 3 number of courses?
Additional table information: table: college_3 | SELECT T2.Fname, T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor ORDER BY COUNT(*) DESC LIMIT 3 |
Return the ids of all products that were ordered more than three times or supplied more than 80000.
Additional table information: table: department_store | SELECT product_id FROM Order_Items GROUP BY product_id HAVING COUNT(*) > 3 UNION SELECT product_id FROM Product_Suppliers GROUP BY product_id HAVING SUM(total_amount_purchased) > 80000 |
What is the salaray and name of the employee with the most certificates to fly planes more than 5000?
Additional table information: table: flight_1 | SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.distance > 5000 GROUP BY T1.eid ORDER BY COUNT(*) DESC LIMIT 1 |
Which campus has the most faculties in year 2003?
Additional table information: table: csu_1 | SELECT T1.campus FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2003 ORDER BY T2.faculty DESC LIMIT 1 |
Which is the email of the party that has used the services the most number of times?
Additional table information: table: e_government | SELECT t1.party_email FROM parties AS t1 JOIN party_services AS t2 ON t1.party_id = t2.customer_id GROUP BY t1.party_email ORDER BY COUNT(*) DESC LIMIT 1 |
Show the distinct fate of missions that involve ships with nationality 'United States'
Additional table information: table: ship_mission | SELECT DISTINCT T1.Fate FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T2.Nationality = 'United States' |
How many hours do the students spend studying in each department?
Additional table information: table: college_1 | SELECT SUM(stu_hrs), dept_code FROM student GROUP BY dept_code |
Return the age of the person with the greatest height.
Additional table information: table: gymnast | SELECT Age FROM people ORDER BY Height DESC LIMIT 1 |
Find the name and account balance of the customers who have loans with a total amount of more than 5000.
Additional table information: table: loan_1 | SELECT T1.cust_name, T1.acc_type FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name HAVING SUM(T2.amount) > 5000 |
How many rooms whose capacity is less than 50 does the Lamberton building have?
Additional table information: table: college_2 | SELECT COUNT(*) FROM classroom WHERE building = 'Lamberton' AND capacity < 50 |