sentence
stringlengths
3
347
sql
stringlengths
18
804
How many airlines are there?
SELECT COUNT ( * ) FROM airlines
How much Elevation (m) has a Prominence (m) larger than 2,876?
SELECT COUNT(elevation__m_) FROM table_name_18 WHERE prominence__m_ > 2 OFFSET 876
Find courses that ran in Fall 2009 or in Spring 2010.
SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 UNION SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010
How many video games do you have?
SELECT count(*) FROM Video_games
How many people whose age is greater 30 and job is engineer?
SELECT count ( * ) FROM Person WHERE age > 30 AND job = 'engineer'
Which GPU has the cushaw application?
SELECT gpu‡ FROM table_name_31 WHERE application = "cushaw"
Yes. What is their date of birth?
SELECT date_of_birth FROM Employees WHERE employee_id IN ( SELECT employee_id FROM Employees EXCEPT SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed )
How many titles did Mary Smith rent in 2005? Determine the percentage of titles rented in June 2005.
SELECT COUNT(T2.rental_id) , CAST(SUM(IIF(STRFTIME('%m',T2.rental_date) = '7', 1, 0)) AS REAL) * 100 / COUNT(T2.rental_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Maria' AND T1.last_name = 'Miller' AND STRFTIME('%Y',T2.rental_date) = '2005'
Find the titles of the papers the author "Stephanie Weirich" wrote.
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Stephanie" AND t1.lname = "Weirich"
Please list all unique Product Names
SELECT DISTINCT product_name FROM Products
When did the program air on Vier?
SELECT premiere___aired FROM table_178242_1 WHERE channel = "VIER"
List the title of all cartoon directed by "Ben Jones" or "Brandon Vietti".
SELECT Title FROM Cartoon WHERE Directed_by = "Ben Jones" OR Directed_by = "Brandon Vietti";
What is the grid associated witha Time/Retired of +8.180 secs, and under 47 laps?
SELECT SUM(grid) FROM table_name_80 WHERE time_retired = "+8.180 secs" AND laps < 47
How many books were ordered by customer Kandy Adamec?
SELECT COUNT(*) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Kandy' AND T3.last_name = 'Adamec'
How many patients' prescriptions are made by physician John Dorian?
SELECT COUNT(T1.SSN) FROM patient AS T1 JOIN prescribes AS T2 ON T1.SSN = T2.patient JOIN physician AS T3 ON T2.physician = T3.employeeid WHERE T3.name = "John Dorian"
For each nationality, how many different constructors are there?
SELECT count(*) , nationality FROM constructors GROUP BY nationality
What are the distinct names of products purchased by at least two different customers?
SELECT DISTINCT T3.product_name FROM customer_orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id JOIN products AS T3 ON T2.product_id = T3.product_id GROUP BY T3.product_id HAVING COUNT (DISTINCT T1.customer_id) >= 2
Give the name of the nation that uses the greatest amount of languages.
SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode GROUP BY T1.Name ORDER BY COUNT(*) DESC LIMIT 1
Show budget type codes and the number of documents in each budget type.
SELECT budget_type_code , count(*) FROM Documents_with_expenses GROUP BY budget_type_code
What is the venue of the match with more than 8 against and ireland as the opposing team?
SELECT venue FROM table_name_33 WHERE against > 8 AND opposing_teams = "ireland"
What are the names of storms that did not affect any regions?
SELECT name FROM storm WHERE storm_id NOT IN (SELECT storm_id FROM affected_region)
Which cities have 4 or more airports
SELECT city FROM airports GROUP BY city HAVING count ( * ) > = 4
What is the full name of the actor who starred in most movies?
SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.film_id) AS num FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1
Find the subject ID, subject name, and the corresponding number of available courses for each subject.
SELECT T1.subject_id , T2.subject_name , COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id
Find the movies with the highest average rating. Return the movie titles and average rating.
SELECT T2.title , avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY avg(T1.stars) DESC LIMIT 1
what is the name of the station where the metlink code is mata?
SELECT station FROM table_3005450_1 WHERE metlink_code = "MATA"
Calculate the average income made by movies using the keyword "paris". List the title of the movies.
SELECT AVG(T1.revenue), T1.title FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T3.keyword_name = 'paris'
What is the lowest Place, when Televotes is 15424?
SELECT MIN(place) FROM table_name_50 WHERE televotes = 15424
Provide the air carrier description of the flight with the highest actual elapsed time.
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID ORDER BY T2.ACTUAL_ELAPSED_TIME DESC LIMIT 1
Which student have allergy to both milk and cats? | Here are the student ids of the students who have allergies to both milk and cat. | What are their last names?
SELECT lname FROM Student WHERE StuID IN ( SELECT StuID FROM Has_allergy WHERE Allergy = "Milk" INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = "Cat" )
B.P. of 0, and a Pts Agst smaller than 247 has how many total number of played?
SELECT COUNT(played) FROM table_name_25 WHERE bp = 0 AND pts_agst < 247
What city has the museum that holds the Sue specimen?
SELECT museum AS city FROM table_name_48 WHERE name = "sue"
What is the total number of tweets sent by male users on Mondays?
SELECT COUNT(DISTINCT T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Weekday = 'Monday'
Riggs of e, and a Buechel & Manhart spelling (pronunciation) of e had what ullrich?
SELECT ullrich FROM table_name_92 WHERE riggs = "e" AND buechel_ & _manhart_spelling__pronunciation_ = "e"
What year has a make & model of mci d4000n?
SELECT year FROM table_name_79 WHERE make_ & _model = "mci d4000n"
And how about the lowest?
SELECT T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance LIMIT 1
When was the school with the largest enrollment founded?
SELECT founded FROM university ORDER BY enrollment DESC LIMIT 1
What are the names of all the songs that have a higher rating than some song of the blues genre?
SELECT song_name FROM song WHERE rating > ( SELECT max ( rating ) FROM song WHERE genre_is = "blues" )
Can you tell me the Venue that has the Away team of south dragons?
SELECT venue FROM table_name_98 WHERE away_team = "south dragons"
How many phone hardware models are produced by the company named "Nokia Corporation"?
SELECT COUNT(*) FROM phone WHERE Company_name = "Nokia Corporation"
What was the attendance on August 2?
SELECT attendance FROM table_name_48 WHERE date = "august 2"
what is the highest runners when the jockey is frankie dettori and the placing is higher than 1?
SELECT MAX(runners) FROM table_name_68 WHERE jockey = "frankie dettori" AND placing > 1
Count the number of employees for each city.
SELECT count(*) , city FROM employee GROUP BY city
which Streak has a Location/Attendance of staples center, and a Score of 67–89?
SELECT streak FROM table_name_1 WHERE location_attendance = "staples center" AND score = "67–89"
what is the average salary for all teams?
SELECT avg ( salary ) FROM salary
Which film titles have the most expensive rental rate?
SELECT title FROM film WHERE rental_rate = ( SELECT MAX(rental_rate) FROM film )
Which Fencing Victories (pts) has a Total of 5640?
SELECT fencing_victories__pts_ FROM table_name_68 WHERE total = 5640
What was the score of the away team at Junction Oval venue?
SELECT away_team AS score FROM table_name_8 WHERE venue = "junction oval"
What person on team Minardi Team USA with a qual of 1:17.481?
SELECT name FROM table_name_59 WHERE team = "minardi team usa" AND qual_1 = "1:17.481"
Show all sport name and the number of students.
SELECT sportname , count(*) FROM Sportsinfo GROUP BY sportname
What is the genre of PG rated movie starred by the actor with highest net worth?
SELECT T1.Genre FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T1.`MPAA Rating` = 'PG' ORDER BY CAST(REPLACE(REPLACE(T3.NetWorth, ',', ''), '$', '') AS REAL) DESC LIMIT 1
How many hours do the players train on average?
SELECT avg(HS) FROM Player
What are the names of the two students who are playing multiple sports?
SELECT T2.Fname , T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID having count ( * ) >1
What are the name of courses that have at least five enrollments?
SELECT T1.CName FROM COURSE AS T1 JOIN ENROLLED_IN AS T2 ON T1.CID = T2.CID GROUP BY T2.CID HAVING COUNT(*) >= 5
What their names?
SELECT name FROM swimmer WHERE id NOT IN ( SELECT swimmer_id FROM record )
Hi there! Can you show me a list of all of the cities including city IDs and city names?
SELECT City_ID,Name FROM city
Count the number of credit cards that the customer with first name Blanche and last name Huels has.
SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Blanche" AND T2.customer_last_name = "Huels" AND T1.card_type_code = "Credit"
Find the names of the swimmers who have both "win" and "loss" results in the record.
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'
when was the first start date that actually began on august 6, 1969
SELECT launched FROM table_291768_1 WHERE commissioned = "August 6, 1969"
What is the rank of user id 3?
SELECT T2.rank FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id WHERE T2.u_id = 3
State the customer name of orders which has shipped date in 7/8/2018.
SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.ShipDate = '7/8/18' THEN T1.`Customer Names` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL
what is the enrollment of the conference | The enrollment of the oldest college is 19067.0. | list the enrollment and primary-conference of the oldest college
SELECT enrollment , primary_conference FROM university ORDER BY founded LIMIT 1
what are the names of the products with category "Herbs"
SELECT T1.product_name FROM products AS T1 JOIN Ref_colors AS T2 ON T1.color_code = T2.color_code WHERE product_category_code = "Herbs"
What are the official names of cities that have not hosted a farm competition?
SELECT Official_Name FROM city WHERE City_ID NOT IN (SELECT Host_city_ID FROM farm_competition)
What is the Round for the jiu-jitsu vs martial arts?
SELECT round FROM table_name_20 WHERE event = "jiu-jitsu vs martial arts"
What happened in week 12 when week 13 resulted in Tennessee (9-1)?
SELECT week_12_nov_19 FROM table_name_20 WHERE week_13_nov_26 = "tennessee (9-1)"
What is the least total number of medals when the bronze medals is 1, and Czech Republic (CZE) is the nation?
SELECT MIN(total) FROM table_name_46 WHERE bronze = 1 AND nation = "czech republic (cze)"
Find the average number of followers for the users who had some tweets.
SELECT AVG(followers) FROM user_profiles WHERE UID IN (SELECT UID FROM tweets)
What is the host year of city "Taizhou ( Zhejiang )"?
SELECT T2.year FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T1.city = "Taizhou ( Zhejiang )"
Name the constructor for alberto ascari
SELECT constructor FROM table_21977704_1 WHERE driver = "Alberto Ascari"
What championship had Francesca Schiavone in the finals?
SELECT championship FROM table_name_81 WHERE opponent_in_the_final = "francesca schiavone"
What is the Attendance of the game with a Record of 37–21–12 and less than 86 Points?
SELECT AVG(attendance) FROM table_name_44 WHERE record = "37–21–12" AND points < 86
What is the name of the patient who made the most recent appointment?
SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1
Which City has Seasons in league of 17, and a Club of shakhter?
SELECT city FROM table_name_99 WHERE seasons_in_league = 17 AND club = "shakhter"
How many film categories are there?
SELECT COUNT(DISTINCT category_id) FROM category
Name the total number of points with year less than 1955 and rank of 5th with wins less than 0
SELECT COUNT(points) FROM table_name_31 WHERE year < 1955 AND rank = "5th" AND wins < 0
Show me the open year of all shops in numerical order.
select open_year from shop order by open_year
What are the years that Andretti Autosport is a team?
SELECT COUNT(year) FROM table_name_44 WHERE team = "andretti autosport"
What is College, when Pick is less than 145, and when Player is Jeff Wilkins?
SELECT college FROM table_name_34 WHERE pick < 145 AND player = "jeff wilkins"
Which Neon has a Argon of −189.6?
SELECT neon FROM table_name_95 WHERE argon = "−189.6"
How many samples taken from producer Qingdao Suncare Nutritional Technology with a melamine content less than 53.4?
SELECT SUM(samples_taken) FROM table_name_12 WHERE melamine_content_mg_kg_ < 53.4 AND producer = "qingdao suncare nutritional technology"
Name the surface for philadelphia
SELECT surface FROM table_23235767_4 WHERE championship = "Philadelphia"
Name the pinyin for kɵkyar k̡irƣiz yezisi
SELECT pinyin FROM table_2008069_2 WHERE uyghur___yenɡi_yezik̢__ = "Kɵkyar K̡irƣiz yezisi"
what number is associated with the baltic fleet and leninets (ленинец)?
SELECT number FROM table_name_49 WHERE fleet = "baltic" AND name = "leninets (ленинец)"
What was the score on May 12, 2008?
SELECT score FROM table_name_8 WHERE date = "may 12, 2008"
Name the highest week for result of w 38-13
SELECT MAX(week) FROM table_name_7 WHERE result = "w 38-13"
Who wrote the series number 14?
SELECT written_by FROM table_18734298_1 WHERE no_in_series = 14
Which one has the least amount of years worked?
SELECT journalist_ID FROM journalist where Nationality = 'England' order by Years_working limit 1
When five is the new channel what is the date of original removal?
SELECT date_s__of_original_removal FROM table_19114172_11 WHERE new_channel_s_ = "Five"
How many schools have some students playing in goalie and mid positions.
SELECT COUNT(*) FROM (SELECT cName FROM tryout WHERE pPos = 'goalie' INTERSECT SELECT cName FROM tryout WHERE pPos = 'mid')
What is Minister, when Party is "AN"?
SELECT minister FROM table_name_89 WHERE party = "an"
Calculate the total number of sales in North America.
SELECT SUM(T2.num_sales) * 100000 AS nums FROM region AS T1 INNER JOIN region_sales AS T2 ON T1.id = T2.region_id WHERE T1.region_name = 'North America'
How many students are enrolled in some classes that are taught by an accounting professor?
SELECT count(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN department AS T4 ON T3.dept_code = T4.dept_code WHERE T4.dept_name = 'Accounting'
Find the name and ID of the product whose total order quantity is the largest.
SELECT t2.product_details , t2.product_id FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY sum(t1.order_quantity) LIMIT 1
Find the ship type that are used by both ships with Panama and Malta flags?
SELECT TYPE FROM ship WHERE flag = 'Panama' INTERSECT SELECT TYPE FROM ship WHERE flag = 'Malta'
What was the least amount of wins when he had 10 poles?
SELECT MIN(wins) FROM table_24584486_1 WHERE poles = 10
Show all publishers and the number of books for each publisher.
SELECT publisher, COUNT(*) FROM book_club GROUP BY publisher
When did the venue of round 3 happen?
SELECT date FROM table_name_23 WHERE venue = "round 3"
Among episodes aired in 2009, which episode has received the worst response based on the rating.
SELECT episode_id FROM Episode WHERE air_date LIKE '2009%' ORDER BY rating LIMIT 1;
What opponent did they have a bye result against before week 14?
SELECT opponent FROM table_name_19 WHERE result = "bye" AND week < 14