sentence
stringlengths 3
347
| sql
stringlengths 18
804
|
---|---|
How many rentals did Ella Oliver hire in June 2016? | SELECT COUNT(T1.rental_id) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'ELLA' AND T2.last_name = 'ELLA' AND date(T1.rental_date) BETWEEN '2005-06-01' AND '2005-06-30' |
For each country, what is the average elevation of that country's airports? | SELECT avg(elevation) , country FROM airports GROUP BY country |
How many laps did mike spence complete grids above 12? | SELECT COUNT(laps) FROM table_name_85 WHERE driver = "mike spence" AND grid > 12 |
Who was the runner-up for the Bulgaria Open, before 2007? | SELECT score FROM table_name_40 WHERE year < 2007 AND outcome = "runner-up" AND tournament = "bulgaria open" |
Count the total number of apartment bookings. | SELECT count(*) FROM Apartment_Bookings |
just locations | SELECT distinct location FROM wrestler |
How many airlines do you have? | SELECT count ( * ) FROM airlines |
Of all the contestants who got voted, what is the contestant number and name of the contestant who got least votes? | SELECT T1.contestant_number , T1.contestant_name FROM contestants AS T1 JOIN votes AS T2 ON T1.contestant_number = T2.contestant_number GROUP BY T1.contestant_number ORDER BY count(*) ASC LIMIT 1 |
Show all student ids who are older than 20. | SELECT StuID FROM Student WHERE age > 20 |
what is the finishes when points is more than 337 and starts is more than 26? | SELECT SUM(finishes) FROM table_name_90 WHERE points > 337 AND starts > 26 |
List the carriers of devices in ascending alphabetical order. | SELECT Carrier FROM device ORDER BY Carrier ASC |
What is the name of the customer of ship ID 1147? | SELECT T2.cust_name FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T1.ship_id = '1147' |
Find the average ranking for each player and their first name. | SELECT AVG(ranking), T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name |
What is the count of different game types? | SELECT count(DISTINCT gtype) FROM Video_games |
Please list the capital cities of the countries with an inflation rate under 2. | SELECT T1.Capital FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T2.Inflation < 2 |
What is the BMI of David Bornhammar? | SELECT CAST(T2.weight_in_kg AS REAL) / (CAST(T3.height_in_cm AS REAL) / 100 * (CAST(T3.height_in_cm AS REAL) / 100)) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id INNER JOIN height_info AS T3 ON T1.height = T3.height_id WHERE T1.PlayerName = 'David Bornhammar' |
What is the average year for a user to be upgraded to elite user? | SELECT CAST(SUM(T2.year_id - T1.user_yelping_since_year) AS REAL) / COUNT(T1.user_id) FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id |
What are the renting arrears tax ids related to the customer master index whose detail is not 'Schmidt, Kertzmann and Lubowitz'? | SELECT T1.council_tax_id FROM Rent_Arrears AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id JOIN Customer_Master_Index AS T3 ON T3.master_customer_id = T2.master_customer_id WHERE T3.cmi_details != 'Schmidt , Kertzmann and Lubowitz' |
What is Syracuse, when Buffalo is Oatka Creek Shale, and when Albany is Berne? | SELECT syracuse FROM table_name_90 WHERE buffalo = "oatka creek shale" AND albany = "berne" |
In what Week was the Result W 27-24? | SELECT MAX(week) FROM table_name_1 WHERE result = "w 27-24" |
What is the year for the United Arab Emirates? | SELECT COUNT(year) FROM table_name_19 WHERE country = "united arab emirates" |
What is the rank by average for the team who averaged 22.8? | SELECT MIN(rank_by_average) FROM table_25391981_3 WHERE average = "22.8" |
In what season did Pons Racing compete? | SELECT season FROM table_27571406_1 WHERE team_name = "Pons Racing" |
What is the percentage for manhattan 45,901? | SELECT COUNT(_percentage) FROM table_1108394_24 WHERE manhattan = "45,901" |
Which railways do not have trains? | Did you mean the object number of railways that do not have any train? | Yes | SELECT ObjectNumber FROM railway WHERE Railway_ID NOT IN ( SELECT Railway_ID FROM train ) |
Find the distinct first names of all the students who have vice president votes and whose city code is not PIT. | SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code = "PIT" |
Please show me the headquarters with at least two companies in the banking industry? | SELECT headquarters FROM company WHERE main_industry = 'Banking' GROUP BY headquarters HAVING count ( * ) > = 2 |
What was Jack McGrath's finish number in 1954? | SELECT finish FROM table_name_95 WHERE year = "1954" |
When did Mrs. Joye Homenick receive her most recent influenza seasonal vaccine? | SELECT T2.DATE FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Influenza seasonal injectable preservative free' AND T1.first = 'Joye' AND T1.last = 'Homenick' ORDER BY T2.DATE DESC LIMIT 1 |
what are the name of the wrestler | Would you like to know the names of all wrestlers with location Tokyo, Japan? | yes | SELECT name FROM wrestler WHERE LOCATION = 'Tokyo , Japan' |
how many driver are presented on the table | select count ( * ) from driver |
What is the capital of the 3rd most populated country in Asia and what is the capital city's ratio in percentage (%) against the overall population of the country? | SELECT T4.Capital, CAST(T3.Population AS REAL) * 100 / T4.Population FROM city AS T3 INNER JOIN ( SELECT T1.Capital , T1.Population FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country WHERE T2.Continent = 'Asia' ORDER BY T1.Population DESC LIMIT 2, 1 ) AS T4 ON T3.Name = T4.Capital |
What is the most common condition among the patients who received influenza seasonal injectable preservative free immunization? | SELECT T2.DESCRIPTION FROM immunizations AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.DESCRIPTION = 'Influenza seasonal injectable preservative free' GROUP BY T2.DESCRIPTION ORDER BY COUNT(T2.DESCRIPTION) DESC LIMIT 1 |
When did the institution located in Lewiston, Maine join the conference? | SELECT joined FROM table_261931_2 WHERE location = "Lewiston, Maine" |
Calculate the percentage of people who were born after 1970 and from California. | SELECT CAST(SUM(CASE WHEN birth_region = 'California' AND SUBSTR(birthdate, 1, 4) > '1970' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(birthdate) FROM Person; |
Sum up the votes from star 1 to 5 for all of the contestants in Blimp Award. | SELECT T2.stars, SUM(T2.stars) FROM Award AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.award_category = 'Blimp Award' AND T2.stars BETWEEN 1 AND 5 GROUP BY T2.stars; |
Return the maximum and minimum population among all counties. | SELECT max(Population) , min(Population) FROM county |
Which Win percentage has Points smaller than 472, and a Record (W–L–T/OTL) of 140–220–40? | SELECT AVG(win_percentage) FROM table_name_79 WHERE points < 472 AND record__w_l_t___otl_ = "140–220–40" |
What is the name of the airport with the lowest altitude? | SELECT name FROM airports ORDER BY elevation LIMIT 1 |
Who was the home team when the away team is Carlton? | SELECT home_team FROM table_16388478_4 WHERE away_team = "Carlton" |
How many different play-by-play announcers also had pregame analysis by Darren Flutie, Eric Tillman and Greg Frers? | SELECT COUNT(play_by_play) FROM table_17628022_2 WHERE pregame_analysts = "Darren Flutie, Eric Tillman and Greg Frers" |
List all opponents from the 4-4 scoring game. | SELECT opponent FROM table_24561550_1 WHERE record = "4-4" |
Who is the customer who purchased the highest number of products in a single order? | SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID GROUP BY T1.CompanyName ORDER BY COUNT(T3.ProductID) DESC LIMIT 1 |
What competition has 17-1 as the result? | SELECT competition FROM table_name_38 WHERE result = "17-1" |
Which location is in Oregon, ranked under 121, and contains Mount McLoughlin? | SELECT location FROM table_name_71 WHERE state = "oregon" AND rank < 121 AND mountain_peak = "mount mcloughlin" |
Which state was the tweet `tw-685681052912873473` from? Give the state code. | SELECT T2.StateCode FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.TweetID = 'tw-685681052912873473' |
Find the name of the most popular party form. | SELECT t1.form_name FROM forms AS t1 JOIN party_forms AS t2 ON t1.form_id = t2.form_id GROUP BY t2.form_id ORDER BY COUNT(*) DESC LIMIT 1 |
Can you tell me the Venue that has the Position in 2005 of 8? | SELECT venue FROM table_name_77 WHERE position_in_2005 = "8" |
Return the number of routes with destination airport in Italy operated by the airline with name 'American Airlines'. | SELECT count(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid JOIN airlines AS T3 ON T1.alid = T3.alid WHERE T2.country = 'Italy' AND T3.name = 'American Airlines' |
What are the name, origin and owner of each program? | SELECT name , origin , OWNER FROM program |
What is the city with the most number of flagship stores? | SELECT t3.headquartered_city 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 GROUP BY t3.headquartered_city ORDER BY count(*) DESC LIMIT 1 |
Give the flight numbers of flights leaving from Aberdeen. | SELECT T1.FlightNo FROM FLIGHTS AS T1 JOIN AIRPORTS AS T2 ON T1.SourceAirport = T2.AirportCode WHERE T2.City = "Aberdeen" |
Name the team with a tie number of 6. | SELECT date FROM table_name_51 WHERE tie_no = "6" |
Find the name of customer who has the highest amount of loans. | SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name ORDER BY sum(T2.amount) DESC LIMIT 1 |
How would an Italian say the Andalusian word coche? | SELECT italian FROM table_name_78 WHERE andalusian = "coche" |
Name the trine dehli cleve for english waltz | SELECT MIN(trine_dehli_cleve) FROM table_28677723_14 WHERE style = "English Waltz" |
In cook county Kerry# is? | SELECT kerry_number FROM table_1302886_1 WHERE county = "Cook" |
What are the names of all the branches? | SELECT Name FROM branch |
How many policies has she been involved in ? | SELECT count ( * ) FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id GROUP BY t2.customer_details ORDER BY count ( * ) DESC LIMIT 1 |
What was the term of Bruce Biers Kendall whose hometown is Anchorage? | SELECT term FROM table_name_6 WHERE hometown = "anchorage" AND name = "bruce biers kendall" |
For which Game 4 did Michael O'Connor play during Game 1? | SELECT game_4 FROM table_name_27 WHERE game_1 = "michael o'connor" |
What is the score of the game that holds a record of 80-61? | SELECT score FROM table_name_69 WHERE record = "80-61" |
When the crowd was 8642 what was the away team's score? | SELECT away_team AS score FROM table_16388439_2 WHERE crowd = 8642 |
What was the score in the tournament against Ekaterina Makarova? | SELECT score FROM table_name_21 WHERE opponent = "ekaterina makarova" |
What is the most common type of compliments that a user has received from other users? | SELECT T2.compliment_type FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id GROUP BY T2.compliment_type ORDER BY COUNT(T2.compliment_type) DESC LIMIT 1 |
How many times more for the papers that were presented at the "International Conference on Thermoelectrics" conference than "International Conference on Wireless Networks, Communications and Mobile Computing“ conference? | SELECT CAST(SUM(CASE WHEN T2.FullName = 'International Conference on Thermoelectrics' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.FullName = 'International Conference on Wireless Networks, Communications and Mobile Computing' THEN 1 ELSE 0 END) FROM Paper AS T1 INNER JOIN Conference AS T2 ON T1.ConferenceId = T2.Id |
What is the highest number of points scored when Acadie-Bathurst had 4 tied games, less than 257 goals, and over 72 games played? | SELECT MAX(points) FROM table_name_10 WHERE tied = "4" AND goals_for < 257 AND games > 72 |
Please list the top 3 cities with the most number of tweets posted in Canada. | SELECT T.City FROM ( SELECT T2.City, COUNT(T1.TweetID) AS num FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.Country = 'Canada' GROUP BY T2.City ) T ORDER BY T.num DESC LIMIT 3 |
Hello! Can you give me a list of all of the forenames and surnames of the various drivers? | SELECT forename , surname FROM drivers |
How many FG percent values are associated with 59 assists and offensive rebounds under 40? | SELECT COUNT(fg_pct) FROM table_name_21 WHERE asst = 59 AND off_reb < 40 |
What is the ID of the project with the least number of documents? | SELECT project_id FROM Documents GROUP BY project_id ORDER BY count ( * ) ASC LIMIT 1 |
When 62 is the number in series who is the writer? | SELECT written_by FROM table_27657925_1 WHERE no_in_series = "62" |
What is the average fastest lap speed in race named 'Monaco Grand Prix' in 2008 ? | SELECT avg(T2.fastestlapspeed) FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year = 2008 AND T1.name = "Monaco Grand Prix" |
What is the smallest number of tries with conversions more than 0? | SELECT MIN(tries) FROM table_name_22 WHERE conversions > 0 |
How many professors are there? | SELECT count ( * ) from professor |
Between Rome and Juliet, which character was mentioned the most in the The Tragedy of Romeo and Juliet? Calculate for Romeo and Juliet's individual amount of appearance in percentage against the overall number of characters that appeared in the said work. | SELECT SUM(IIF(T4.CharName = 'Romeo', 1, 0)), SUM(IIF(T4.CharName = 'Juliet', 1, 0)), CAST(SUM(IIF(T4.CharName = 'Romeo', 1, 0)) + SUM(IIF(T4.CharName = 'Juliet', 1, 0)) AS REAL) * 100 / COUNT(T1.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id |
What is the document type code with most number of documents? | SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1 |
list all the game type | SELECT gtype FROM Video_games |
Show the start dates and end dates of all the apartment bookings. | SELECT booking_start_date , booking_end_date FROM Apartment_Bookings |
What are the average number of all the male students (sex with M) from each city? | SELECT count ( * ) , city_code FROM student WHERE sex = 'M' GROUP BY city_code |
Who were the candidates when Noble Jones Gregory was incumbent? | SELECT candidates FROM table_1342270_17 WHERE incumbent = "Noble Jones Gregory" |
How many countries are there in total? | SELECT count(*) FROM country |
Show the attendances of the performances at location "TD Garden" or "Bell Centre" | SELECT Attendance FROM performance WHERE LOCATION = "TD Garden" OR LOCATION = "Bell Centre" |
What average year contains the title of machineries of joy vol. 4? | SELECT AVG(year) FROM table_name_54 WHERE title = "machineries of joy vol. 4" |
Please list the names of all the producers in the movie "Pirates of the Caribbean: At World's End". | SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Producer' |
what is the average number of days | did you mean the average days held by all wrestlers? | yes | SELECT avg ( Days_held ) FROM wrestler |
List down the number of inhabitants of customers with a divorced marital status and older than 50 years old. | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.MARITAL_STATUS = 'Divorced' AND T1.age < 50 |
Which venue had an against score smaller than 18 when the opposing team was North Auckland? | SELECT venue FROM table_name_84 WHERE against < 18 AND opposing_team = "north auckland" |
What are the width and height of the bounding box of the object with "keyboard" as their object class and (5, 647) as their coordinate? | SELECT T1.W, T1.H FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.OBJ_CLASS = 'keyboard' AND T1.X = 5 AND T1.Y = 647 |
Can you please list the grapes, appellations, and names of wines whose score is higher than 93? | SELECT Grape , Appelation , Name FROM WINE WHERE Score > 93 |
Which movie has the keyword 'extremis?' | SELECT 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 = 'extremis' |
Find the name of the department that has the biggest number of students minored in? | SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY COUNT(*) DESC LIMIT 1 |
What are the id and name of mountains that have photos and height above 4000? | SELECT T1.id , T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.height > 4000 |
What about by Susan? | SELECT count ( * ) FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name = "Susan" |
How many wins did Hobbs had a 15th finish at poles 0? | SELECT wins FROM table_name_89 WHERE poles = "0" AND final_placing = "15th" |
When 2011 is the period and olympikus is the kit manufacturer how many minor sponsors are there? | SELECT COUNT(minor_sponsors) FROM table_187239_1 WHERE kit_manufacturer = "Olympikus" AND period = "2011" |
What is the attendance in a week larter than 4, on December 6, 1992? | SELECT attendance FROM table_name_80 WHERE week > 4 AND date = "december 6, 1992" |
How many premierships for the queensland raceway? | SELECT premierships FROM table_name_40 WHERE venue = "queensland raceway" |
Count the number of customers. | SELECT count(*) FROM customers |
What Team had a 1:24.152 Best? | SELECT team FROM table_name_51 WHERE best = "1:24.152" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.