sentence
stringlengths
3
347
sql
stringlengths
18
804
What is the average Gold, when Nation is Yugoslavia, and when Silver is greater than 0?
SELECT AVG(gold) FROM table_name_28 WHERE nation = "yugoslavia" AND silver > 0
What is the percentage of female athletes below 20s who participated in the 2002 Winter Olympic?
SELECT CAST(COUNT(CASE WHEN T3.gender = 'F' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '2002 Winter' AND T2.age < 20
What are the total per assembly quantity for unit measure code EA, IN and OZ respectively? What are the name of these 3 code?
SELECT SUM(T1.PerAssemblyQty), T2.Name FROM BillOfMaterials AS T1 INNER JOIN UnitMeasure AS T2 ON T1.UnitMeasureCode = T2.UnitMeasureCode WHERE T1.UnitMeasureCode IN ('EA', 'IN', 'OZ') GROUP BY T2.Name
What are the names of wines that are more expensive than all wines made in the year 2006?
SELECT Name FROM WINE WHERE Price > (SELECT max(Price) FROM WINE WHERE YEAR = 2006)
What is the id, forename, and number of races for all drivers that have participated in at least 2 races?
SELECT T1.driverid , T1.forename , count(*) FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid HAVING count(*) >= 2
Who is the partner in the final with a score of 2–6, 7–6, 7–6?
SELECT partner FROM table_name_10 WHERE score_in_the_final = "2–6, 7–6, 7–6"
Can you add the people id associated with that weight into the table?
SELECT people_id, weight from people order by weight desc limit 1
How many third party companies are there?
SELECT count ( * ) FROM Third_Party_Companies
When was Alianza's first season in first division with a promotion after 1959?
SELECT first_season_in_first_division FROM table_name_63 WHERE first_season_after_most_recent_promotion = "1959" AND name = "alianza"
What is the sum of all totals with a rank greater than 6, gold greater than 0, and silver greater than 2?
SELECT SUM(total) FROM table_name_11 WHERE rank > 6 AND gold > 0 AND silver = 2
What is the Pick # for the College/junior/club team of edmonton oil kings (wchl), and the position if defence?
SELECT pick__number FROM table_name_49 WHERE college_junior_club_team = "edmonton oil kings (wchl)" AND position = "defence"
What was the score of the game for April 16?
SELECT loss FROM table_name_62 WHERE date = "april 16"
In which city do the most employees live and how many of them live there?
SELECT T1.city , count(*) FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.city ORDER BY count(*) DESC LIMIT 1;
Name the record for prudential center - 12,880
SELECT record FROM table_27539272_4 WHERE location_attendance = "Prudential Center - 12,880"
Give the annual revenue of the customer of ship ID 1047.
SELECT T2.annual_revenue FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T1.ship_id = '1047'
What is the ergative for the dative chven?
SELECT ergative FROM table_name_33 WHERE dative = "chven"
What is the highest of balmoor/
SELECT highest FROM table_11206787_5 WHERE stadium = "Balmoor"
What player is from the California Golden Seals?
SELECT player FROM table_1965650_10 WHERE nhl_team = "California Golden Seals"
Could you please tell me all the names of the journalists?
SELECT name from journalist
For ranks over 2 with Golds over 6 and Silvers over 5 what would be the lowest qualifying Total?
SELECT MIN(total) FROM table_name_4 WHERE gold > 6 AND rank > 2 AND silver > 5
what are the names of the districts where both city mall and village store type stores.
SELECT t3.District_name FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id WHERE t1.Type = "City Mall" INTERSECT SELECT t3.District_name FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id WHERE t1.Type = "Village Store"
What is Country, when Score is 71-71-69=211?
SELECT country FROM table_name_26 WHERE score = 71 - 71 - 69 = 211
Which employee has showed up in most circulation history documents. List the employee's name and the number of drafts and copies.
SELECT Employees.employee_name , count(*) FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id GROUP BY Circulation_History.document_id , Circulation_History.draft_number , Circulation_History.copy_number ORDER BY count(*) DESC LIMIT 1;
How many customer ids has the "delivered" status on the list?
select count ( customer_id ) from Customer_Orders where order_status = 'Delivered'
Among the most popular professors, how many are females?
SELECT COUNT(prof_id) FROM prof WHERE gender = 'Female' AND popularity = ( SELECT MAX(popularity) FROM prof )
Find the routes operated by all airlines? | Do you mean return all the routes? | yes.
select * from routes
How many movies were made before 2000?
SELECT count(*) FROM Movie WHERE YEAR < 2000
Name who wrote the 11 number in the season
SELECT written_by FROM table_15584067_7 WHERE no_in_season = "11"
In users yelping since 2010 to 2012, how many of them has an low fans?
SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year BETWEEN 2010 AND 2012 AND user_fans LIKE 'Low'
Tell me the price ranges for all the hotels.
SELECT price_range FROM HOTELS
What is the Time of the Rowers from Belgium?
SELECT time FROM table_name_36 WHERE country = "belgium"
Return the names of the gymnasts.
SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID
What is Position in Table, when Team is "Morelia"?
SELECT position_in_table FROM table_name_64 WHERE team = "morelia"
List the authors of submissions in ascending order of scores.
SELECT Author FROM submission ORDER BY Scores ASC
In what year was the most degrees conferred?
SELECT YEAR FROM degrees GROUP BY YEAR ORDER BY sum(degrees) DESC LIMIT 1
How many different store locations are there?
SELECT count(DISTINCT LOCATION) FROM shop
Who is the director of the adventure movie which was released on 2007/3/30?
SELECT T1.director FROM director AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.name WHERE T2.genre = 'Adventure' AND T2.release_date = 'Mar 30, 2007'
What is Tournament, when Date is "Sep 25, 1977"?
SELECT tournament FROM table_name_61 WHERE date = "sep 25, 1977"
What party does Bill McCollum belong to?
SELECT party FROM table_1341453_11 WHERE incumbent = "Bill McCollum"
Tell me the document date of the project id 30?
SELECT document_type_code from documents where project_id = 30
What is Date, when Round is less than 10, and when Circuit is "Norisring"?
SELECT date FROM table_name_18 WHERE round < 10 AND circuit = "norisring"
What is the name of the youngest captain?
SELECT name FROM captain ORDER BY age LIMIT 1
List all the username and passwords of users with the most popular role.
SELECT user_name, password FROM users GROUP BY role_code ORDER BY COUNT(*) DESC LIMIT 1
What are the id and first name of the student whose addresses have the highest average monthly rental?
SELECT T1.student_id , T2.first_name FROM Student_Addresses AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY AVG(monthly_rental) DESC LIMIT 1
What is the margin of victory that has masters gc ladies as the tournament?
SELECT margin_of_victory FROM table_name_45 WHERE tournament = "masters gc ladies"
In which tournament was the opponent Lauren Embree?
SELECT tournament FROM table_name_83 WHERE opponent = "lauren embree"
Name the incumbent for first elected 1956
SELECT incumbent FROM table_1341930_40 WHERE first_elected = 1956
What is the first and last name of the student participating in the most activities?
SELECT T1.fname , T1.lname FROM Student AS T1 JOIN Participates_in AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
List down the ID of movies with running time of 3 and average revenue of 1?
SELECT T1.movieid FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid INNER JOIN directors AS T3 ON T2.directorid = T3.directorid WHERE T1.runningtime = 3 AND T3.avg_revenue = 1
What points has points for as points for?
SELECT points FROM table_name_25 WHERE points_for = "points for"
What is the word id for title "Sometent"?
SELECT T2.wid FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.title = 'Sometent'
What are the first and last names of the 5 customers who purchased something most recently?
SELECT T1.first_name , T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY T2.invoice_date DESC LIMIT 5;
What is the mean temperature in Fahrenheit on 8/29/2013 for the area where the zip code is 94107?
SELECT SUM(IIF(zip_code = 94107 AND date = '8/29/2013', mean_temperature_f, 0)) FROM weather
Which Episode has a Viewers (millions) larger than 11.26, a Weekly Rank of #8, and a Share of 12?
SELECT episode FROM table_name_62 WHERE viewers__millions_ > 11.26 AND weekly_rank = "#8" AND share = 12
What is High Assists, when High Points is Keon Clark (19)?
SELECT high_assists FROM table_name_57 WHERE high_points = "keon clark (19)"
Which tournament had a 2008 result of 1R?
SELECT tournament FROM table_name_85 WHERE 2006 = "a" AND 2008 = "1r"
Find each student's first name.
SELECT DISTINCT fname FROM student
I want the replaced for date of appointment being 12 october 2007
SELECT replaced_by FROM table_name_73 WHERE date_of_appointment = "12 october 2007"
What is the name of the publisher who published Agatha Christie's first book?
SELECT T4.publisher_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'Agatha Christie' ORDER BY T1.publication_date ASC LIMIT 1
Sort the apartment numbers in ascending order of room count.
SELECT apt_number FROM Apartments ORDER BY room_count ASC
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
Which employee has the highest salary? Please give his or her full name.
SELECT firstname, lastname FROM employee ORDER BY salary DESC LIMIT 1
Where is the classroom located?
SELECT class_room FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T1.Crs_Code = "ACCT-211" AND T1.Class_Time LIKE '%T%'
What is the crime rate in Aibonito?
SELECT Crime_rate FROM county_public_safety WHERE County_ID = ( select County_ID from city where Name = 'Aibonito' )
Among the classic movies, how many movies have a rental rate of less than 1?
SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.rental_rate < 1 AND T2.name = 'Classics'
What Gaelic Athletic Association stadium is located in Carrick-on-Shannon?
SELECT stadium FROM table_name_72 WHERE location = "carrick-on-shannon"
Show all locations which don't have a train station with at least 15 platforms.
SELECT LOCATION FROM station EXCEPT SELECT LOCATION FROM station WHERE number_of_platforms > = 15
For each zip code, what is the average mean temperature for all dates that start with '8'?
SELECT zip_code , avg(mean_temperature_f) FROM weather WHERE date LIKE "8/%" GROUP BY zip_code
Find all types of store and number of them.
SELECT TYPE , count(*) FROM store GROUP BY TYPE
Show details of all investors if they make any transaction with share count greater than 100.
SELECT T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id WHERE T2.share_count > 100
Find the name and age of the person who is a friend of both Dan and Alice.
SELECT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' INTERSECT SELECT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice'
Name the number ends won when L is 4 and stolen ends is 17
SELECT COUNT(Ends) AS won FROM table_15333005_1 WHERE l = 4 AND stolen_ends = 17
What is the name of the genre with the most number of video games?
SELECT T2.genre_name FROM game AS T1 INNER JOIN genre AS T2 ON T2.id = T1.genre_id GROUP BY T2.genre_name ORDER BY COUNT(T1.genre_id) DESC LIMIT 1
Show the first name and last name for all the instructors.
SELECT fname , lname FROM Faculty WHERE Rank = "Instructor"
Which Laps have a Time/Retired of +23.215, and a Grid larger than 11?
SELECT MIN(laps) FROM table_name_41 WHERE time_retired = "+23.215" AND grid > 11
What is the name of the customer who has the most orders?
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
List the name and count of each product in all orders.
SELECT T3.product_name , count(*) FROM orders AS T1 JOIN order_items AS T2 JOIN products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_id
What is the role name and role description for employee called Ebba?
SELECT T2.role_name , T2.role_description FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code = T2.role_code WHERE T1.employee_name = "Ebba"
Show all product names and the number of customers having an order on each product.
SELECT T2.product_name , count ( * ) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id JOIN Orders AS T3 ON T3.order_id = T1.order_id GROUP BY T2.product_name
Find the name of the scientist who worked on both a project named 'Matter of Time' and a project named 'A Puzzling Parallax'.
SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.name = 'Matter of Time' INTERSECT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.name = 'A Puzzling Parallax'
how many master card there
SELECT count ( * ) FROM INVOICES where payment_method_code = "MasterCard"
What transfer window has baptista as the name?
SELECT transfer_window FROM table_name_44 WHERE name = "baptista"
What is the average number of points of the team with more than 17 pg won?
SELECT AVG(points__pts_) FROM table_name_26 WHERE won__pg_ > 17
Name the highest Ends Lost which has an Shot % larger than 78, and a Ends Won smaller than 38?
SELECT MAX(ends_lost) FROM table_name_63 WHERE shot__percentage > 78 AND ends_won < 38
I want the prothrombin time with a partial thromboplastin time of prolonged and unaffected bleeding time and factor xii deficiency for condition of factor
SELECT prothrombin_time FROM table_name_49 WHERE partial_thromboplastin_time = "prolonged" AND bleeding_time = "unaffected" AND condition = "factor xii deficiency"
Show the teams that have both wrestlers eliminated by "Orton" and wrestlers eliminated by "Benjamin".
SELECT Team FROM Elimination WHERE Eliminated_By = "Orton" INTERSECT SELECT Team FROM Elimination WHERE Eliminated_By = "Benjamin"
How many documents have the document description "Initial Application"?
SELECT count ( * ) FROM Documents AS T1 JOIN Document_Types AS T2 ON T1.document_type_code = T2.document_type_code JOIN Grants AS T3 ON T1.grant_id = T3.grant_id WHERE T2.document_description = 'Initial Application'
How many people attended the match on 1/11?
SELECT attendance FROM table_name_45 WHERE date = "1/11"
What was the result of Samuel Smith's race?
SELECT result FROM table_2668329_11 WHERE incumbent = "Samuel Smith"
What is the number of Goals For for Games Played more than 8?
SELECT SUM(goals_for) FROM table_name_44 WHERE games_played > 8
How many distinct students are enrolled in courses?
SELECT count(DISTINCT student_id) FROM Student_Course_Enrolment
What is the total for the draw with 0 points, and less than 14 lost?
SELECT SUM(draw) FROM table_name_15 WHERE points = 0 AND lost < 14
Yes, what is the exact altitude of the Bar Yehuda Airfield?
SELECT elevation FROM airports where name = "Bar Yehuda Airfield"
What are the distinct names and nationalities of the architects who have ever built a mill?
SELECT DISTINCT T1.name , T1.nationality FROM architect AS T1 JOIN mill AS t2 ON T1.id = T2.architect_id
How many players with the first name Joe were drafted in 1970?
SELECT COUNT(DISTINCT playerID) FROM draft WHERE firstName = 'Joe' AND draftYear = 1970
What was the score when the partner was arnaud clément?
SELECT score FROM table_name_60 WHERE partner = "arnaud clément"
Who is the driver of the chassis that is tg183b tg184?
SELECT driver FROM table_name_79 WHERE chassis = "tg183b tg184"
In what state was the electorate fowler?
SELECT state FROM table_name_1 WHERE electorate = "fowler"
What was the record for the Orangemen when they played against Army?
SELECT record FROM table_23346983_1 WHERE opponent = "Army"
What is the Virtue of Temperance in Latin?
SELECT latin FROM table_name_64 WHERE virtue = "temperance"