sentence
stringlengths
3
347
sql
stringlengths
18
804
Return the average total amount purchased and total value purchased for the supplier who supplies the greatest number of products.
SELECT avg(total_amount_purchased) , avg(total_value_purchased) FROM Product_Suppliers WHERE supplier_id = (SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id ORDER BY count(*) DESC LIMIT 1)
What is the name of the bike that has a grid number smaller than 9 with a time of +7.764?
SELECT bike FROM table_name_18 WHERE grid < 9 AND time = "+7.764"
In which county is the residential area with the highest average income per household located?
SELECT T2.county FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO' GROUP BY T2.county ORDER BY T1.avg_income_per_household DESC LIMIT 1
When davao city is the home or representative town or province and clash 2010 is the edition how many ages are there?
SELECT COUNT(age) FROM table_19061741_3 WHERE edition = "Clash 2010" AND home_or_representative_town_or_province = "Davao City"
if 22km is the trekking route what is height from sea level in meters?
SELECT height_from_sea_level_in_meters FROM table_1430913_1 WHERE trekking_route = "22km"
What is the 2006 total with a 2010 value greater than 417.9?
SELECT COUNT(2006) FROM table_name_95 WHERE 2010 > 417.9
What is the lowest week that has Minnesota Vikings as the opponent?
SELECT MIN(week) FROM table_name_75 WHERE opponent = "minnesota vikings"
Who did Bruno Soares and a partner face in the finals on a clay surface on August 1, 2010?
SELECT opponents_in_the_final FROM table_name_37 WHERE partnering = "bruno soares" AND surface = "clay" AND date = "august 1, 2010"
what is the highest number city affected
SELECT T1.region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id order by count ( * ) desc limit 1
Find the id for the trips that lasted at least as long as the average duration of trips in zip code 94103.
SELECT id FROM trip WHERE duration >= (SELECT AVG(duration) FROM trip WHERE zip_code = 94103)
Name the launch vehicle with Institutional authority of ndc
SELECT launch_vehicle FROM table_name_59 WHERE institutional_authority = "ndc"
Write down the last name of employee who did inspection ID 52238?
SELECT T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 52238
how many names or products in the table | Do you mean the names of products in the products table | how many headquarter in the Manufacturers table
SELECT count ( Headquarter ) from Manufacturers
Which Group position has Result F–A of 0–1 on 1 november 2006?
SELECT group_position FROM table_name_50 WHERE result_f_a = "0–1" AND date = "1 november 2006"
what is the least amount of milk cattle in ontario
SELECT MIN(number_of_dairy_cows) FROM table_29012710_1 WHERE province = "Ontario"
What Brands Hatch race had Niki Lauda as its Fastest Lap?
SELECT race FROM table_name_78 WHERE fastest_lap = "niki lauda" AND location = "brands hatch"
Hello! Can you tell me how many total employees are on this list?
SELECT count ( distinct EMPLOYEE_ID ) from employees
how many female students are presented on the table
select count ( StuID ) from Student where Sex = 'F'
What was the session at the circuit of autodrom most?
SELECT session FROM table_name_95 WHERE circuit = "autodrom most"
List the names of climbers in descending order of points.
SELECT Name FROM climber ORDER BY Points DESC
If the just cents is 701.96, what is the interval name?
SELECT interval_name FROM table_18955077_1 WHERE just__cents_ = "701.96"
Find the number of distinct amenities.
SELECT count(*) FROM dorm_amenity
What's the rank for February 11, 2012 with less than 18,735 in attendance?
SELECT AVG(rank) FROM table_name_67 WHERE date = "february 11, 2012" AND attendance < 18 OFFSET 735
Show the name of aircrafts with top three lowest distances.
SELECT name FROM Aircraft ORDER BY distance LIMIT 3
Which rank has the smallest number of faculty members?
SELECT rank FROM Faculty GROUP BY rank ORDER BY count(*) ASC LIMIT 1
Which home teams had crowds larger than 4,000?
SELECT home_team FROM table_name_25 WHERE crowd > 4 OFFSET 000
What is the highest number of students with a teacher:student ratio of 20.8?
SELECT MAX(students) FROM table_1414743_1 WHERE pupil_teacher_ratio = "20.8"
FIND THE NAME OF CUSTOMER WHO HAS HIGH ACCOUNT BALANCE | Did you mean the highest account balance? | YES
SELECT cust_name FROM customer ORDER BY acc_bal desc LIMIT 1
Find the first names and offices of all professors sorted by alphabetical order of their first name.
SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname
What was the water depth that entered service in 2001 named Cajun Express?
SELECT water_depth FROM table_name_11 WHERE entered_service = "2001" AND name = "cajun express"
What products were ordered by the customer ID "WILMK" which were required on 3/26/1998?
SELECT T3.ProductName FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T1.RequiredDate LIKE '1998-03-26%' AND T1.CustomerID = 'WILMK'
What player is a lock with 1 cap?
SELECT player FROM table_name_16 WHERE position = "lock" AND caps = 1
what was the lowest numbers for the winner gregory w. meeks
SELECT MIN(elected) FROM table_13870048_3 WHERE incumbent = "Gregory W. Meeks"
How many times did Boston Red Stockings lose in 2009 postseason?
SELECT count(*) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2009;
Show all church names except for those that had a wedding in year 2015.
SELECT name FROM church EXCEPT SELECT T1.name FROM church AS T1 JOIN wedding AS T2 ON T1.church_id = T2.church_id WHERE T2.year = 2015
What is the quantity of Ikura ordered in order no. 10273?
SELECT T2.Quantity FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10273 AND T1.ProductName = 'Ikura'
What is the average Apps for the team Kairat with level larger than 1?
SELECT AVG(apps) FROM table_name_51 WHERE team = "kairat" AND level > 1
What is the Format of the Epic/Sony Label after 1980?
SELECT format FROM table_name_33 WHERE label = "epic/sony" AND date > 1980
Calculate the difference between the number of cars that has a horsepower of 130 with the model year 1970 and model year 1976
SELECT SUM(CASE WHEN T2.model_year = 1970 THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.model_year = 1976 THEN 1 ELSE 0 END) FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID WHERE T1.horsepower = 130
Show the titles of books in descending order of publication price.
SELECT T1.Title FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID ORDER BY T2.Price DESC
Among the cities with alias Ponce, what is the percentage of cities with a country level FIPS code of less than 20?
SELECT CAST(COUNT(CASE WHEN T2.county_fips < 20 THEN T2.zip_code ELSE NULL END) AS REAL) * 100 / COUNT(T2.zip_code) FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.alias = 'Ponce'
Find the names of rooms that have been reserved for more than 60 times.
SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room HAVING count(*) > 60
Which courses are taught on days MTW?
SELECT CName FROM COURSE WHERE Days = "MTW"
What's the 2009 of the Australian Open having a 1R in 2011?
SELECT 2009 FROM table_name_56 WHERE 2011 = "1r" AND tournament = "australian open"
In the circuit of Madonie, what was the date that had the winning constructor Bugatti?
SELECT date FROM table_name_17 WHERE circuit = "madonie" AND winning_constructor = "bugatti"
What are the first name and last name of each male member in club "Hopkins Student Enterprises"?
SELECT t3.fname , t3.lname 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 = "Hopkins Student Enterprises" AND t3.sex = "M"
Who is the youngest? | Did you mean the youngest students whose GPA is higher than 3? | Yes, please.
SELECT * FROM student WHERE stu_gpa > 3 ORDER BY stu_dob DESC LIMIT 1
List the game IDs of the games produced by Abylight.
SELECT T1.game_id FROM game_publisher AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id WHERE T2.publisher_name = 'Abylight'
In the database, how many times is the number of Indian cities to the South African cities?
SELECT CAST(SUM(CASE WHEN T2.Country_Name = 'India' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.Country_Name = 'South Africa' THEN 1 ELSE 0 END) FROM City AS T1 INNER JOIN Country AS T2 ON T1.Country_Id = T2.Country_Id
How many points were scored in 1:44:59.557 of time?
SELECT points FROM table_name_64 WHERE time_retired = "1:44:59.557"
List the hardware model name for the phones that were produced by "Nokia Corporation" or whose screen mode type is "Graphics."
SELECT DISTINCT T2.Hardware_Model_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = "Graphics" OR t2.Company_name = "Nokia Corporation"
What was the label for Shake Your Groove Thing in USA?
SELECT label FROM table_name_59 WHERE country_of_release = "usa" AND title = "shake your groove thing"
Which Team has a Year smaller than 2007, and a Class of gts?
SELECT team FROM table_name_96 WHERE year < 2007 AND class = "gts"
Name the region for cd with catalog of alca-9203
SELECT region FROM table_name_43 WHERE format = "cd" AND catalog = "alca-9203"
Which Date has a Tournament of milan , italy?
SELECT date FROM table_name_69 WHERE tournament = "milan , italy"
Who was the winning team in the 1989 season?
SELECT winningteam FROM table_12028543_3 WHERE season = "1989"
what is the result when the round is less than 7 and the opponent is melbourne storm?
SELECT result FROM table_name_76 WHERE round < 7 AND opponent = "melbourne storm"
Which of these host cities has a lower temperature in March than July.
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul INTERSECT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city
Please provide the IDs of any three AdventureWorks product subcategories.
SELECT DISTINCT ProductCategoryID FROM ProductSubcategory LIMIT 3
or a C? | You want the students just with grade "C" or including "A" | Who got either an A or a C?
SELECT count ( T1.stu_fname ) FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'C' OR T2.enroll_grade = 'A'
What were the official itv ratings in millions for semi-final 5?
SELECT official_itv_rating__millions_ FROM table_27319183_7 WHERE episode = "Semi-final 5"
What are their id numbers?
SELECT DISTINCT RID FROM Rating
Which chassis-engine had 77 laps?
SELECT chassis___engine FROM table_name_9 WHERE laps = 77
with a share of 44.2% and 77 seats, what is the greatest seat total?
SELECT MAX(total_seats) FROM table_name_82 WHERE seats = 77 AND share_of_votes = "44.2%"
Find the total number of king beds available.
SELECT sum(beds) FROM Rooms WHERE bedtype = 'King';
What were the home team scores at york park?
SELECT home_team AS score FROM table_16388478_2 WHERE ground = "York Park"
Show all main industry for all companies.
SELECT DISTINCT main_industry FROM company
Who was Team 2 when Team 1 was América?
SELECT team_2 FROM table_name_88 WHERE team_1 = "américa"
List the full name of employees and titles who have to report to Sales Manager.
SELECT FirstName, LastName, Title FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE Title = 'Sales Manager' )
What is the exact number of Total that has a percentage of precisely 12.03%?
SELECT COUNT(total) FROM table_name_24 WHERE percentage = "12.03%"
Who has a licence of gpl v2 and a current version of 0.9.9?
SELECT name FROM table_name_92 WHERE license = "gpl v2" AND current_version = "0.9.9"
What is the rank for the 3 silver medals?
SELECT rank FROM table_name_13 WHERE silver = 3
Whose term expired in 1996 and was from the province of Central Highlands?
SELECT name FROM table_name_74 WHERE province = "central highlands" AND term_expires = 1996
What type of structure is there at the American Tower Christmas?
SELECT structure_type FROM table_name_17 WHERE name = "american tower christmas"
What was the year opened for North Carolina with a smaller than 21,500 capacity?
SELECT year_opened FROM table_name_50 WHERE state = "north carolina" AND capacity < 21 OFFSET 500
What are the wifi and screen mode type of the hardware model named "LG-P760"?
SELECT T1.WiFi , T3.Type FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model JOIN screen_mode AS T3 ON T2.screen_mode = T3.Graphics_mode WHERE T2.Hardware_Model_name = "LG-P760";
What is the lowest overall number of hurricanes?
SELECT MIN(number_of_hurricanes) FROM table_2930244_3
Which municipality has a party of Lega Friuli-VG that won elections before 2011?
SELECT municipality FROM table_name_34 WHERE party = "lega friuli-vg" AND election < 2011
Among the products manufactured by manufacturer 5 that have a retail price of no more than 1,000, how many products were shipped via rail?
SELECT COUNT(T1.ps_partkey) FROM partsupp AS T1 INNER JOIN lineitem AS T2 ON T1.ps_suppkey = T2.l_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T3.p_mfgr = 'Manufacturer#5' AND T3.p_retailprice < 1000 AND T2.l_shipmode = 'RAIL'
Show all party names and the number of members in each party.
SELECT T2.party_name , count(*) FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id
List venues of all matches in the order of their dates starting from the most recent one.
SELECT venue FROM MATCH ORDER BY date DESC
What studio produced Star Trek II: The Wrath of Khan?
SELECT Studio FROM film WHERE Title = "Star Trek II: The Wrath of Khan"
What country is ranked number 4?
SELECT country FROM table_name_41 WHERE rank = 4
What is the name of the race where Stirling Moss was the winning driver?
SELECT race_name FROM table_name_13 WHERE winning_driver = "stirling moss"
List down the rating for the App Learn C++.
SELECT DISTINCT Rating FROM playstore WHERE App = 'Learn C++'
what is their address?
SELECT T1.address FROM employees AS T1 JOIN customers AS T2 ON T1.id = T2.support_rep_id GROUP BY T1.id ORDER BY count ( * ) DESC LIMIT 1
What score occurred on February 6?
SELECT score FROM table_name_31 WHERE date = "february 6"
What is the total number of Issues has a End month of oct-80?
SELECT COUNT(number_of_issues) FROM table_name_60 WHERE end_month = "oct-80"
Find the names of courses taught by the tutor who has personal name "Julio".
SELECT T2.course_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T1.personal_name = "Julio"
find the event names that have more than 2 records.
SELECT event_name FROM party_events GROUP BY event_name HAVING count(*) > 2
What are the dates of birth of entrepreneurs with investor "Simon Woodroffe" or "Peter Jones"?
SELECT T2.Date_of_Birth FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor = "Simon Woodroffe" OR T1.Investor = "Peter Jones"
Please list 3 businesses along with their IDs that use cellphones.
SELECT T2.BusinessEntityID FROM PhoneNumberType AS T1 INNER JOIN PersonPhone AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.Name = 'Cell' LIMIT 3
Among the dishes, how many of them are for free?
SELECT COUNT(*) FROM Dish WHERE lowest_price = 0
What is the Position with a height of less than 183, and a weight of less than 91 kg and born in bloomington, minnesota?
SELECT position FROM table_name_73 WHERE height__cm_ < 183 AND weight__kg_ < 91 AND birthplace = "bloomington, minnesota"
What is the total number of sales across all regions?
SELECT SUM(T.num_sales) * 100000 FROM region_sales t
What Trainer had Jockey William Jenkins in a race with Time of 1:44.80?
SELECT trainer FROM table_name_54 WHERE time = "1:44.80" AND jockey = "william jenkins"
Find the name and city of the airport which is the source for the most number of flight routes.
SELECT T1.name, T1.city FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid GROUP BY T2.src_apid ORDER BY count(*) DESC LIMIT 1
How many staff does each project has? List the project id and the number in an ascending order.
SELECT T1.project_id , count(*) FROM Project_Staff AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id ORDER BY count(*) ASC
I want the standing for january 29 and finished of 3rd and total points less than 248
SELECT standing FROM table_name_59 WHERE total_points < 248 AND finished = "3rd" AND date = "january 29"
What 2009 has lq as the 2011?
SELECT 2009 FROM table_name_58 WHERE 2011 = "lq"