anchor
stringlengths
10
14.3k
positive
stringlengths
10
14.9k
How many games were played in park "Columbia Park" in 1907?
SELECT count(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 1907 AND T2.park_name = 'Columbia Park';
List the name and residence for players whose occupation is not "Researcher".
SELECT Player_name , residence FROM player WHERE Occupation != "Researcher"
How old is each gender, on average?
SELECT avg(age) , gender FROM Person GROUP BY gender
What are the number of rooms for each bed type?
SELECT bedType , count(*) FROM Rooms GROUP BY bedType;
What are the name and id of the team with the most victories in 2008 postseason?
SELECT T2.name , T1.team_id_winner FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T1.year = 2008 GROUP BY T1.team_id_winner ORDER BY count(*) DESC LIMIT 1;
What are the dates of the assessment notes?
SELECT date_of_notes FROM Assessment_Notes
What are the distinct names of customers who have purchased at least three different products?
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.customer_id HAVING COUNT (DISTINCT T3.product_id) >= 3
Find the number of teachers who teach the student called CHRISSY NABOZNY.
SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "CHRISSY" AND T1.lastname = "NABOZNY"
Find the first names of professors who are teaching more than one class.
SELECT T2.emp_fname FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING count(*) > 1
What are the employee ids of the employees whose role name is "Human Resource" or "Manager"?
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"
How many book clubs are there?
SELECT count(*) FROM book_club
Show the season, the player, and the name of the team that players belong to.
SELECT T1.Season , T1.Player , T2.Name FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id
What are the names of all cities and states?
SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses
How many markets have number of cities smaller than 300?
SELECT count(*) FROM market WHERE Number_cities < 300
In which country and state does Janessa Sawayn live?
SELECT T1.country , T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
Give me the name and description of the location with code x.
SELECT location_name , location_description FROM Ref_locations WHERE location_code = "x"
What are the first names and last names of all the guests?
SELECT guest_first_name , guest_last_name FROM Guests
Find the id of the customers who have order status both "On Road" and "Shipped".
SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "On Road" INTERSECT SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "Shipped"
What are the details of all products?
SELECT DISTINCT product_details FROM products
Find the name and college of students whose decisions are yes in the tryout.
SELECT T1.pName , T2.cName FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes'
What is the average number of stars that each reviewer awards for a movie?
SELECT T2.name , avg(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name
Show the delegate from district 1 in election.
SELECT Delegate FROM election WHERE District = 1
Find the name of all the cities and states.
SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses
Find the titles of items that received both a rating higher than 8 and a rating below 5.
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > 8 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5
What are the countries that contain 3 or more cities?
SELECT T2.country FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id GROUP BY T2.country_id HAVING count(*) >= 3
What are the ids and details of all accounts?
SELECT account_id , account_details FROM Accounts
Show the name and date for each race and its track name.
SELECT T1.name , T1.date , T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id
Find the max, average and min training hours of all players.
SELECT avg(HS) , max(HS) , min(HS) FROM Player
Find the Char cells, Pixels and Hardware colours for the screen of the phone whose hardware model name is "LG-P760".
SELECT T1.Char_cells , T1.Pixels , T1.Hardware_colours FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T2.Hardware_Model_name = "LG-P760";
What is maximum group equity shareholding of the companies?
SELECT max(group_equity_shareholding) FROM operate_company
Show name, address road, and city for all branches sorted by open year.
SELECT name , address_road , city FROM branch ORDER BY open_year
What is the average weeks on top of volumes associated with the artist aged 25 or younger?
SELECT avg(T2.Weeks_on_Top) FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age <= 25
How many events did not have any participants?
SELECT count(*) FROM EVENTS WHERE event_id NOT IN (SELECT event_id FROM Participants_in_Events)
Find the name of dorms only for female (F gender).
SELECT dorm_name FROM dorm WHERE gender = 'F'
How many sections does each course have?
SELECT count(*) , crs_code FROM CLASS GROUP BY crs_code
What is the id for the employee called Ebba?
SELECT employee_ID FROM Employees WHERE employee_name = "Ebba"
Find out the first name and last name of staff lived in city Damianfort.
SELECT T2.first_name , T2.last_name FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T1.city = "Damianfort";
How many players are there?
SELECT count(*) FROM player
Which months have more than 2 happy hours?
SELECT MONTH FROM happy_hour GROUP BY MONTH HAVING count(*) > 2
What are the names of all the different reviewers who rates Gone with the Wind?
SELECT DISTINCT T3.name FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.title = 'Gone with the Wind'
Find the name of the dorm with the largest capacity.
SELECT dorm_name FROM dorm ORDER BY student_capacity DESC LIMIT 1
What are the official names of cities, ordered descending by population?
SELECT Official_Name FROM city ORDER BY Population DESC
What are the employee ids and job ids for employees who make less than the lowest earning employee with title MK_MAN?
SELECT employee_id , job_id FROM employees WHERE salary < ( SELECT min(salary) FROM employees WHERE job_id = 'MK_MAN' )
Which services have been used more than twice in first notification of loss? Return the service name.
SELECT t2.service_name FROM first_notification_of_loss AS t1 JOIN services AS t2 ON t1.service_id = t2.service_id GROUP BY t1.service_id HAVING count(*) > 2
Count the number of companies.
SELECT count(*) FROM Companies
Which problems were reported by the staff named Dameon Frami or Jolie Weber? Give me the ids of the problems.
SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Dameon" AND T2.staff_last_name = "Frami" UNION SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Jolie" AND T2.staff_las...
Find the the names of the tourist attractions that the tourist named Alison visited but Rosalind did not visit.
SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN 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 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_...
Return the rank for which there are the fewest captains.
SELECT rank FROM captain GROUP BY rank ORDER BY count(*) DESC LIMIT 1
Find the name and budget of departments whose budgets are more than the average budget.
SELECT dept_name , budget FROM department WHERE budget > (SELECT avg(budget) FROM department)
How many customers have no payment histories?
SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payments );
What are the different transaction types, and how many transactions of each have taken place?
SELECT transaction_type , count(*) FROM Financial_transactions GROUP BY transaction_type
Find the detail of products whose detail contains the word "Latte" or the word "Americano"
SELECT product_details FROM products WHERE product_details LIKE "%Latte%" OR product_details LIKE "%Americano%"
What are the dates and locations of performances?
SELECT Date , LOCATION FROM performance
What is title of album which track Balls to the Wall belongs to?
SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T2.name = "Balls to the Wall";
How many rooms in total are there in the apartments in the building with short name "Columbus Square"?
SELECT sum(T2.room_count) FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_short_name = "Columbus Square"
Find the zip code in which the average mean visibility is lower than 10.
SELECT zip_code FROM weather GROUP BY zip_code HAVING avg(mean_visibility_miles) < 10
List the names of products that are not in any event.
SELECT Product_Name FROM Products WHERE Product_ID NOT IN (SELECT Product_ID FROM Products_in_Events)
Find the number of students who participate in the tryout for each college ordered by descending count.
SELECT count(*) , cName FROM tryout GROUP BY cName ORDER BY count(*) DESC
What are the 3 most common cloud covers in the zip code of 94107?
SELECT cloud_cover FROM weather WHERE zip_code = 94107 GROUP BY cloud_cover ORDER BY COUNT (*) DESC LIMIT 3
What is all the information regarding employees with salaries above the minimum and under 2500?
SELECT * FROM employees WHERE salary BETWEEN (SELECT MIN(salary) FROM employees) AND 2500
What is the average fastest lap speed for races held after 2004, for each race, ordered by year?
SELECT avg(T2.fastestlapspeed) , T1.name , T1.year FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year > 2014 GROUP BY T1.name ORDER BY T1.year
Find the IDs of customers whose name contains "Diana".
SELECT customer_id FROM customers WHERE customer_name LIKE "%Diana%"
List the document type code for the document with the id 2.
SELECT document_type_code FROM Documents WHERE document_id = 2;
What is the average rating stars and title for the oldest movie?
SELECT avg(T1.stars) , T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT min(YEAR) FROM Movie)
find the name of driver who is driving the school bus with the longest working history.
SELECT t1.name FROM driver AS t1 JOIN school_bus AS t2 ON t1.driver_id = t2.driver_id ORDER BY years_working DESC LIMIT 1
What is the total number of clubs that have less than 10 medals in total?
SELECT count(*) FROM club_rank WHERE Total < 10
How many flights have a velocity larger than 200?
SELECT count(*) FROM flight WHERE velocity > 200
Which faculty members advise two ore more students? Give me their faculty ids.
SELECT T1.FacID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID HAVING count(*) >= 2
What is the type of vocals that the band member with the last name "Heilo" played the most?
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
Find the name of the department that has the fewest members.
SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY count(*) ASC LIMIT 1
What is the theme, date, and attendance for the exhibition in year 2004?
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
For each payment method, how many payments were made?
SELECT payment_method_code , count(*) FROM Customer_Payments GROUP BY payment_method_code;
What are the names of customers who have a savings balance lower than their checking balance, and what is the total of their checking and savings balances?
SELECT T1.name , T3.balance + T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance < T2.balance
What are the first names of the professors who do not play Canoeing or Kayaking as activities?
SELECT lname FROM faculty WHERE rank = 'Professor' EXCEPT SELECT DISTINCT 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' OR T3.activity_name = 'Kayaking'
What is the name of the dorm with both a TV Lounge and Study Room listed as amenities?
SELECT T1.dorm_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 T3.amenity_name = 'TV Lounge' INTERSECT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.ameni...
What are the descriptions of the courses with name "database"?
SELECT course_description FROM COURSES WHERE course_name = "database"
Show the movie titles and book titles for all companies in China.
SELECT T1.title , T3.book_title FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id JOIN book_club AS T3 ON T3.book_club_id = T2.book_club_id WHERE T2.incorporated_in = 'China'
How many songs have a lead vocal?
SELECT count(DISTINCT title) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE TYPE = "lead"
List the distinct positions of pilots older than 30.
SELECT DISTINCT POSITION FROM pilot WHERE Age > 30
How many farms are there?
SELECT count(*) FROM farm
return the smallest salary for every departments.
SELECT MIN(salary) , department_id FROM employees GROUP BY department_id
Show the accelerator names and supporting operating systems that are not compatible with the browser named 'Opera'.
SELECT name , operating_system FROM web_client_accelerator EXCEPT SELECT T1.name , T1.operating_system FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T3.name = 'Opera'
What is the average number of votes of representatives from party "Republican"?
SELECT avg(T1.Votes) FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE T2.Party = "Republican"
How many students are older than average for each gender?
SELECT count(*) , sex FROM student WHERE age > (SELECT avg(age) FROM student) GROUP BY sex
What is the total number of faculty members?
SELECT count(*) FROM Faculty
How many invoices correspond to each order id?
SELECT order_id , count(*) FROM Invoices GROUP BY order_id
What are the manager's first name, last name and id who won the most manager award?
SELECT T1.name_first , T1.name_last , T2.player_id FROM player AS T1 JOIN manager_award AS T2 ON T1.player_id = T2.player_id GROUP BY T2.player_id ORDER BY count(*) DESC LIMIT 1;
Return the minimum, maximum, and average seating across all tracks.
SELECT min(seating) , max(seating) , avg(seating) FROM track
What are the first and last name of all biology professors?
SELECT T3.EMP_FNAME , T3.EMP_LNAME FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code JOIN employee AS T3 ON T1.EMP_NUM = T3.EMP_NUM WHERE DEPT_NAME = "Biology"
What are the countries of all airlines whose names start with Orbit?
SELECT country FROM airlines WHERE name LIKE 'Orbit%'
Show the fleet series of the aircrafts flied by pilots younger than 34
SELECT T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID WHERE T3.Age < 34
How many faculty is there in total in the year of 2002?
SELECT sum(faculty) FROM faculty WHERE YEAR = 2002
Show the name and opening year for three churches that opened most recently.
SELECT name , open_date FROM church ORDER BY open_date DESC LIMIT 3
What are the names of all airports in Cuba or Argentina?
SELECT name FROM airports WHERE country = 'Cuba' OR country = 'Argentina'
List the names of players in ascending order of votes.
SELECT Player_name FROM player ORDER BY Votes ASC
Show the faculty id of each faculty member, along with the number of students he or she advises.
SELECT T1.FacID , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID
What are the names of representatives in descending order of votes?
SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY votes DESC
Show the distinct position of players from college UCLA or Duke.
SELECT DISTINCT POSITION FROM match_season WHERE College = "UCLA" OR College = "Duke"
Return the average money requested across all entrepreneurs.
SELECT avg(Money_Requested) FROM entrepreneur
Find the first name and major of the students who are not allegry to soy.
SELECT fname , major FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Soy")