db_id
stringclasses 69
values | question
stringlengths 24
321
| evidence
stringlengths 0
673
| SQL
stringlengths 30
743
| question_id
int64 0
6.6k
| difficulty
stringclasses 3
values |
---|---|---|---|---|---|
university
|
Compute the average percentage of female students.
|
average percentage of female students refers to avg(pct_female_students)
|
SELECT AVG(pct_female_students) FROM university_year
| 400 |
simple
|
olympics
|
List out all the gold medalist winners in cycling sport.
|
gold medalist winners refer to full_name where medal_name = 'Gold'; cycling sport refers to sport_name = 'Cycling';
|
SELECT DISTINCT T5.full_name FROM event AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.event_id INNER JOIN games_competitor AS T3 ON T2.competitor_id = T3.id INNER JOIN sport AS T4 ON T1.sport_id = T4.id INNER JOIN person AS T5 ON T3.person_id = T5.id WHERE T4.sport_name = 'Cycling' AND T2.medal_id = 1
| 401 |
moderate
|
retail_world
|
List out the phone number of the shipping company of order id 10296.
|
shipping company refers to Shippers; phone number refers to Phone
|
SELECT T2.Phone FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.OrderID = 10260
| 402 |
simple
|
airline
|
What is the name of the airline with the highest number of non-cancelled flights?
|
names of the airlines refers to Description; highest number of non-cancelled flights refers to MAX(COUNT(CANCELLED = 0));
|
SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.CANCELLED = 0 GROUP BY T2.Description ORDER BY COUNT(T1.CANCELLED) DESC LIMIT 1
| 403 |
simple
|
address
|
Give at least five alias of cities with a postal point of post office.
|
postal point of post office refers to type = 'Post Office';
|
SELECT T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.type = 'Post Office' LIMIT 5
| 404 |
simple
|
synthea
|
List out all the observation information collected for the patient named Bella Rolfson.
|
observation information refers to observations.DESCRIPTION AND observations.VALUE AND observations.UNITS;
|
SELECT DISTINCT T2.DESCRIPTION, T2.VALUE, T2.UNITS FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Bella' AND T1.last = 'Rolfson'
| 405 |
simple
|
shipping
|
How many shipments were shipped to customers living in California in year 2016?
|
living in California refers to state = 'CA'; in year 2016 refers to CAST(ship_date AS DATE) = 2016
|
SELECT COUNT(*) AS per FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE STRFTIME('%Y', T2.ship_date) = '2016' AND T1.state = 'CA'
| 406 |
simple
|
image_and_language
|
How many images contain 'bridge' as an object element?
|
images refers to IMG_ID; 'bridge' as an object element refers to OBJ_CLASS = 'bridge'
|
SELECT COUNT(DISTINCT T1.IMG_ID) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.OBJ_CLASS = 'bridge'
| 407 |
simple
|
shakespeare
|
Please list the IDs of the paragraphs in which the character "son to Tamora" appears.
|
character "son to Tamora" refers to characters.Description = 'son to Tamora'
|
SELECT T1.id FROM paragraphs AS T1 INNER JOIN characters AS T2 ON T1.character_id = T2.id WHERE T2.Description = 'son to Tamora'
| 408 |
simple
|
works_cycles
|
What is the currency of Brazil?
|
SELECT T1.Name FROM Currency AS T1 INNER JOIN CountryRegionCurrency AS T2 ON T1.CurrencyCode = T2.CurrencyCode INNER JOIN CountryRegion AS T3 ON T2.CountryRegionCode = T3.CountryRegionCode WHERE T3.Name = 'Brazil'
| 409 |
simple
|
|
books
|
Which language was book id 1405 written in?
|
language written in refers to language_name;
|
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T1.book_id = 1405
| 410 |
simple
|
address
|
Give the country and area code of the city with zip code 1116.
|
SELECT T2.county, T1.area_code FROM area_code AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T1.zip_code = 1116
| 411 |
simple
|
|
ice_hockey_draft
|
Who has played the most game plays in the 2000-2001 season of the International league?
|
played the most game plays refers to MAX(GP); 2000-2001 season refers to SEASON = '2000-2001'; International league refers to LEAGUE = 'International';
|
SELECT DISTINCT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' AND T1.LEAGUE = 'International' ORDER BY T1.GP DESC LIMIT 1
| 412 |
moderate
|
university
|
Provide the ranking criteria and scores in 2005 that were received by Harvard University.
|
Harvard University refers to university_name = 'Harvard University'; in 2005 refers to year = 2005; ranking criteria refers to criteria_name;
|
SELECT T1.criteria_name, T2.score FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T3.university_name = 'Harvard University' AND T2.year = 2005
| 413 |
simple
|
regional_sales
|
Which regions have online sales channels that have the most discounts?
|
most discount refers to Max(Discount Applied)
|
SELECT T2.Region FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.`Sales Channel` = 'Online' ORDER BY T1.`Discount Applied` DESC LIMIT 1
| 414 |
simple
|
books
|
What are the books published by "Harper Collins"?
|
"Harper Collins" is the publisher_name; books refers to title
|
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Harper Collins'
| 415 |
simple
|
mondial_geo
|
What kind of government does Iran have?
|
Uganda is one of country names
|
SELECT T2.Government FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Iran'
| 416 |
simple
|
hockey
|
Among the players who died in Massachussets, how many of them have won an award?
|
died in Massachussets refers to deathState = 'Massachussets'
|
SELECT COUNT(DISTINCT T1.playerID) FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID WHERE T1.deathState = 'MA'
| 417 |
simple
|
professional_basketball
|
List the team name and the total wins of the team in year 2005 which has greater winning from the previous year.
|
2005 refers to year = 2005 ; previous year refers to year = 2004; team with greater winning than previous year refers to Won where year = 2005 > Won where year = 2004; team name refers to tmID
|
SELECT T1.name, T1.won FROM teams AS T1 INNER JOIN ( SELECT * FROM teams WHERE year = 2004 ) AS T2 on T1.tmID = T2.tmID WHERE T1.year = 2005 and T1.won > T2.won
| 418 |
simple
|
address
|
What is the Asian population in the city with the alias Leeds?
|
SELECT SUM(T2.asian_population) FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.alias = 'Leeds'
| 419 |
simple
|
|
movie_platform
|
Name movie titles released in year 1945. Sort the listing by the descending order of movie popularity.
|
released in the year 1945 refers to movie_release_year = 1945;
|
SELECT movie_title FROM movies WHERE movie_release_year = 1945 ORDER BY movie_popularity DESC LIMIT 1
| 420 |
simple
|
public_review_platform
|
What is the average rating of inactive businesses?
|
rating refers to stars; inactive refers to active = 'False'; average rating of inactive businesses = DIVIDE(SUM(stars), COUNT(business_id));
|
SELECT CAST(SUM(stars) AS REAL) / COUNT(business_id) AS "average" FROM Business WHERE active LIKE 'FALSE'
| 421 |
simple
|
books
|
How many orders got returned in 2022?
|
orders got returned refers to status_value = 'Returned'; in 2022 refers to SUBSTR(status_date, 1, 4) = '2022'
|
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Returned' AND STRFTIME('%Y', T2.status_date) = '2022'
| 422 |
simple
|
talkingdata
|
For the device with an event occurring on 2016/5/1 at 0:55:25, what is the gender of its user?
|
on 2016/5/1 at 0:55:25 refers to timestamp = '2016-05-01 00:55:25';
|
SELECT T1.gender FROM gender_age AS T1 INNER JOIN events AS T2 ON T1.device_id = T2.device_id WHERE T2.timestamp = '2016-05-01 00:55:25'
| 423 |
simple
|
mondial_geo
|
What is the GDP for Service of the country with Fuenlabrada as its city.
|
SELECT T4.Service * T4.GDP FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Province = T2.Name INNER JOIN economy AS T4 ON T4.Country = T2.Country WHERE T3.Name = 'Fuenlabrada'
| 424 |
simple
|
|
chicago_crime
|
In the most populated ward, how many incidents of domestic violence were reported in a bar or tavern?
|
the most populated refers to max(population); domestic violence refers to domestic = 'TRUE'; in a bar or tavern refers to location_description = 'BAR OR TAVERN'
|
SELECT COUNT(T2.report_no) FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.domestic = 'TRUE' AND T2.location_description = 'BAR OR TAVERN' ORDER BY T1.Population DESC LIMIT 1
| 425 |
moderate
|
authors
|
What is the title of the paper with the most authors?
|
paper refers to paper.Id; paper with the most authors refers to MAX(PaperAuthor.PaperId)
|
SELECT T2.Title FROM PaperAuthor AS T1 INNER JOIN Paper AS T2 ON T1.PaperId = T2.Id GROUP BY T1.PaperId ORDER BY COUNT(T1.PaperId) DESC LIMIT 1
| 426 |
simple
|
law_episode
|
What is the average rating for each episode in season 9?
|
average rating = divide(sum(rating), count(episode_id))
|
SELECT SUM(rating) / COUNT(episode_id) FROM Episode WHERE season = 9
| 427 |
simple
|
codebase_comments
|
What is the task of the method whose tokenized name is "online median filter test median window filling"?
|
tokenized name refers to NameTokenized; task of the method refers to the second part of name deliminated by "."; for example, the task of 'LinqToDelicious.HttpWebRequestFactory.Create' is 'HttpWebRequestFactory'
|
SELECT SUBSTR(SUBSTR(Name, INSTR(Name, '.') + 1), 1, INSTR(SUBSTR(Name, INSTR(Name, '.') + 1), '.') - 1) task FROM Method WHERE NameTokenized = 'online median filter test median window filling'
| 428 |
moderate
|
bike_share_1
|
How many bikes can be borrowed in San Jose Diridon Caltrain Station at 12:06:01 on 2013/8/29?
|
number of bikes that can be borrowed refers to bikes_available; San Jose Diridon Caltrain Station refers to name = 'San Jose Diridon Caltrain Station'; time = '2013/8/29 12:06:01'
|
SELECT T2.bikes_available FROM station AS T1 INNER JOIN status AS T2 ON T1.id = T2.station_id WHERE T1.name = 'San Jose Diridon Caltrain Station' AND T2.time = '2013/08/29 12:06:01'
| 429 |
simple
|
works_cycles
|
How many of the work orders didn’t meet the due date?
|
workers who did not meet the due date refers to EndDate>DueDate;
|
SELECT COUNT(WorkOrderID) FROM WorkOrder WHERE EndDate > DueDate
| 430 |
simple
|
authors
|
Who are the co-authors for Jei Keon Chae and what is the title of paper written by them?
|
'Jei Keon Chee' is the name of author;
|
SELECT T2.AuthorId, T1.Title FROM Paper AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.PaperId WHERE T2.Name = 'Jei Keon Chae'
| 431 |
simple
|
bike_share_1
|
What is the location coordinates of the bike station from which the bike for the trip that last the longest was borrowed?
|
location coordinates refers to (lat, long); bike that was borrowed the longest refers to MAX(duration);
|
SELECT T2.lat, T2.long FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.duration = ( SELECT MAX(T1.duration) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name )
| 432 |
moderate
|
computer_student
|
How many advisors are in charge of advising all the students in 1st year?
|
advisors refers to p_id_dummy; students in 1st year refers to student = 1 and yearsInProgram = 'Year_1'
|
SELECT COUNT(T1.p_id_dummy) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_1' AND T2.student = 1
| 433 |
simple
|
public_review_platform
|
List out the user who is an elite user for consecutively 5 years or more and what is the user average star? How many likes does this user gets?
|
elite user for consecutively 5 years or more refers to user_id COUNT(year_id) > 5; Average star = AVG(likes)
|
SELECT T2.user_average_stars, COUNT(T3.likes) FROM Elite AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id INNER JOIN Tips AS T3 ON T3.user_id = T2.user_id GROUP BY T1.user_id HAVING COUNT(T1.user_id) > 5
| 434 |
moderate
|
computer_student
|
How many students are advised to teach by a professor teaching basic or medium undergraduate courses?
|
students refers to advisedBy.p_id; professor refers to p_id_dummy and taughtBy.p_id and professor = 1; basic or medium undergraduate courses refers to courseLevel = 'Level_300'
|
SELECT COUNT(DISTINCT T4.p_id) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id INNER JOIN advisedBy AS T4 ON T4.p_id = T1.p_id WHERE T1.professor = 1 AND T3.courseLevel = 'Level_300'
| 435 |
moderate
|
retail_complains
|
List the product and its issues of the complains of clients with age greater than the 60% of average age of all clients.
|
age greater than the 60% of average age refers to age > multiply(avg(age) , 0.6)
|
SELECT DISTINCT T2.Product, T2.Issue FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.age * 100 > ( SELECT AVG(age) * 60 FROM client )
| 436 |
moderate
|
retails
|
What is the total price of all the orders made by customers in Germany?
|
orders refer to o_orderkey; total price refers to o_totalprice; Germany is the name of the nation which refers to n_name = 'GERMANY';
|
SELECT SUM(T3.o_totalprice) FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN orders AS T3 ON T2.c_custkey = T3.o_custkey WHERE T1.n_name = 'GERMANY'
| 437 |
simple
|
social_media
|
State the number of states in the United Kingdom.
|
"United Kingdom" is the Country
|
SELECT COUNT(State) AS State_number FROM location WHERE Country = 'United Kingdom'
| 438 |
simple
|
movie_3
|
Give the postal code for the address No.65.
|
address no. 65 refers to address_id = 65
|
SELECT postal_code FROM address WHERE address_id = 65
| 439 |
simple
|
retail_complains
|
Complaint about Credit Card mostly came from clients of which age group?
|
about Credit Card refers to Product = 'Credit Card'; teenager refers to 13 < age < = 19; adult refers to 19 < age < = 65; elder refers to age < = 65
|
SELECT SUM(CASE WHEN T1.age > 13 AND T1.age <= 19 THEN 1 ELSE 0 END), SUM(CASE WHEN T1.age > 19 AND T1.age <= 65 THEN 1 ELSE 0 END) AS adult , SUM(CASE WHEN T1.age > 65 THEN 1 ELSE 0 END) AS elder FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.Product = 'Credit card'
| 440 |
moderate
|
cs_semester
|
Which student failed the course Intro to Database 2? Please give his or her full name.
|
If grade is NULL, it means that this student fails to pass the course; full name refers to f_name and l_name;
|
SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.grade IS NULL AND T3.name = 'Intro to Database 2'
| 441 |
simple
|
works_cycles
|
Which type of transaction was it for the "LL Road Handlebars" order happened in 2012/11/3?
|
Transactiontype = 'w' means 'WorkOrder'; transactiontype = 's' means 'SalesOrder'; transactiontype = 'P' means 'PurchaseOrder'; happened in refers to TransactionDate
|
SELECT T1.TransactionType FROM TransactionHistoryArchive AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'LL Road Handlebars' AND STRFTIME('%Y-%m-%d',T1.TransactionDate) = '2012-11-03'
| 442 |
moderate
|
professional_basketball
|
Please list down the last name of players from "BLB" team.
|
"BLB" is the tmID
|
SELECT T1.lastName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.tmID = 'BLB'
| 443 |
simple
|
movie_3
|
Please provide the address of the customer whose first name is SUSAN with the postal code 77948.
|
SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'SUSAN' AND T1.postal_code = 77948
| 444 |
simple
|
|
retail_complains
|
Give the client ID of the complaint received on April 16, 2014 and submitted through fax.
|
April 16, 2014 refers to Date received = '2014-04-16'; submitted through fax refers to Submitted via = 'Fax'
|
SELECT T2.Client_ID FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.`Submitted via` = 'Fax' AND T1.`Date received` = '2014-04-16'
| 445 |
simple
|
ice_hockey_draft
|
List out the name of players who have a height of 5'8".
|
name of players refers to PlayerName; height of 5'8" refers to height_in_inch = '5''8"';
|
SELECT T2.PlayerName FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height WHERE T1.height_in_inch = '5''8"'
| 446 |
simple
|
movie
|
Who played the character named "Chanice Kobolowski"?
|
SELECT T2.Name FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T1.`Character Name` = 'Chanice Kobolowski'
| 447 |
simple
|
|
retail_complains
|
How many complaints have the client Diesel Galloway filed?
|
SELECT COUNT(T1.client_id) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Diesel' AND T1.last = 'Galloway'
| 448 |
simple
|
|
olympics
|
What is the percentage of the people who are under 35 and participated in the summer season?
|
DIVIDE(COUNT(age < 35) / COUNT(person_id)) as percentage where season = 'Summer';
|
SELECT CAST(COUNT(CASE WHEN T2.age < 35 THEN 1 END) AS REAL) * 100 / COUNT(T2.games_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.season = 'Summer'
| 449 |
moderate
|
movie_platform
|
How many movies were added to the list with the most number of movies? Indicate whether the user was a paying subscriber or not when he created the list.
|
list with the most number of movies refers to MAX(list_movie_number); user_has_payment_method = 1 means the user was a paying subscriber when he created the list; user_has_payment_method = 0 means the user was not a paying subscriber when he created the list;
|
SELECT T1.list_movie_number, T2.user_has_payment_method FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.list_id = T2.list_id ORDER BY T1.list_movie_number DESC LIMIT 1
| 450 |
moderate
|
authors
|
What percentage of journals whose short name begins with ANN were published in the paper database in 1989?
|
short name begins with ANN refers to ShortName like 'ANN%' ; percentage refers to DIVIDE(COUNT(ShortName like 'ANN%' ), COUNT(id)) * 100%; in 1989 refers to Year = 1989
|
SELECT CAST((SUM(CASE WHEN T1.ShortName LIKE 'ANN%' THEN 1 ELSE 0 END)) AS REAL) * 100 / COUNT(T1.ShortName) FROM Journal AS T1 INNER JOIN Paper AS T2 ON T1.Id = T2.JournalId WHERE T2.Year = 1989
| 451 |
moderate
|
sales_in_weather
|
Which items from store 1 have the highest units sold during rainy day?
|
store 1 refers to store_nbr = 1; highest unit sold refers to Max(units); during rainy day refers to codesum like '%'||'RA'||'%'; item refers to item_nbr
|
SELECT T2.item_nbr FROM weather AS T1 INNER JOIN sales_in_weather AS T2 ON T1.`date` = T2.`date` INNER JOIN relation AS T3 ON T2.store_nbr = T3.store_nbr AND T1.station_nbr = T3.station_nbr WHERE T2.store_nbr = 1 AND T1.codesum LIKE '%' OR 'RA' OR '%' GROUP BY T2.item_nbr ORDER BY T2.units DESC LIMIT 1
| 452 |
challenging
|
student_loan
|
Calculate the ratio in percentage between the average number of female and male students who joined Fire Department organization.
|
ratio = CONCAT(MULTIPLY(DIVIDE(COUNT(enlist.name WHERE organ = 'fire_department' which is NOT in male.name), COUNT(enlist.name WHERE organ = 'fire_department),'%'))) AS FEMALE; ratio = CONCAT(MULTIPLY(DIVIDE(COUNT(enlist.name WHERE organ = 'fire_department' which is IN male.name), COUNT(enlist.name WHERE organ = 'fire_department), 100))) AS MALE; female students refers to enlist.name who are NOT in male.name; male students refers to enlist.name who are IN male.name; organization refers to organ; organ = 'fire_department';
|
SELECT CAST(SUM(IIF(T2.name IS NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.name), CAST(SUM(IIF(T2.name IS NOT NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.name) FROM enlist AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name WHERE T1.organ = 'fire_department'
| 453 |
challenging
|
university
|
What is the university ID with the most students in 2011?
|
most students refers to MAX(num_students), in 2011 refers to year = 2011
|
SELECT university_id FROM university_year WHERE year = 2011 ORDER BY num_students DESC LIMIT 1
| 454 |
simple
|
public_review_platform
|
Among the review votes of funny and cool hit uber with long review length, describe the business ID, active status, user ID and user year of joining Yelp.
|
review votes of funny refers to review_votes_funny = 'Uber'; cool hit uber refers to review_votes_cool = 'Uber'; user year of joining Yelp refers to user_yelping_since_year
|
SELECT T1.business_id, T1.active, T3.user_id, T3.user_yelping_since_year FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T2.review_votes_cool = 'Uber' AND T2.review_votes_funny = 'Uber' AND T2.review_length = 'Long'
| 455 |
challenging
|
olympics
|
In the 2014 Winter game, what is the percentage of competitors who age 28 years old?
|
DIVIDE(COUNT(age = 28), COUNT(id)) as percentage where games_name = '2014 Winter';
|
SELECT CAST(COUNT(CASE WHEN T2.age = 28 THEN 1 END) AS REAL) * 100 / COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '2014 Winter'
| 456 |
moderate
|
world
|
List down the country names of countries that have a GNP lower than 1000 and have Dutch as their language.
|
GNP lower than 1000 refers to GNP < 1000; Dutch as their language refers to `Language` = 'Dutch';
|
SELECT T2.Name FROM CountryLanguage AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.Code WHERE T2.GNP < 1000 AND T1.IsOfficial = 'T' AND T1.Language = 'Dutch'
| 457 |
simple
|
authors
|
What is the title and author ID of paper with conference ID less than 100 in year 2006?
|
conference ID less than 100 refers to ConferenceId < 100; in year 2006 refers to Year = 2006
|
SELECT DISTINCT T1.Title, T2.AuthorId FROM Paper AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.PaperId WHERE T1.Year = 2006 AND T1.ConferenceId < 100
| 458 |
simple
|
music_platform_2
|
What is the content of the review under the title "really interesting!" and is created on 2018-04-24 at 12:05:16?
|
"really interesting" is the title of review; created on 2018-04-24 at 12:05:16 refers to created_at = '2018-04-24T12:05:16-07:00'
|
SELECT content FROM reviews WHERE title = 'really interesting!' AND created_at = '2018-04-24T12:05:16-07:00'
| 459 |
simple
|
airline
|
Among the flights operated by American Airlines Inc. on 2018/8/1, how many of them were cancelled?
|
American Airlines Inc. refers to Description = 'American Airlines Inc.: AA'; on 2018/8/1 refers to FL_DATE = '2018/8/1'; cancelled refers to CANCELLED = 1;
|
SELECT SUM(CASE WHEN T2.CANCELLED = 1 THEN 1 ELSE 0 END) AS count FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T2.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T2.FL_DATE = '2018/8/1' AND T3.Description = 'American Airlines Inc.: AA'
| 460 |
moderate
|
simpson_episodes
|
Based on the credits, state how many roles were played in the 5th episode of simpson 20.
|
5th episode refers to episode = 5
|
SELECT COUNT(DISTINCT T2.role) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.episode = 5;
| 461 |
simple
|
mondial_geo
|
Please list the organization names established in the countries where Dutch is spoken.
|
Dutch is one of language
|
SELECT T2.Name FROM language AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T1.Name = 'Dutch'
| 462 |
simple
|
works_cycles
|
Where can I find the Valley Bicycle Specialists store?
|
Valley Bicycle Specialists is a name of store; full address = AddressLine1+AddressLine2;
|
SELECT T2.AddressLine1, T2.AddressLine2 FROM BusinessEntityAddress AS T1 INNER JOIN Address AS T2 ON T1.AddressID = T2.AddressID INNER JOIN Store AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T3.Name = 'Valley Bicycle Specialists'
| 463 |
simple
|
professional_basketball
|
What is the birth date of the player with the most assists during the 1985 All-Star season?
|
most assist refers to Max(assists); in 1985 All Star season refers to season_id = 1985
|
SELECT T1.birthDate FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.season_id = 1985 ORDER BY T2.assists DESC LIMIT 1
| 464 |
simple
|
address
|
What are the precise locations of the cities with an area code of 787?
|
precise location refers to latitude, longitude
|
SELECT T2.latitude, T2.longitude FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = '787' GROUP BY T2.latitude, T2.longitude
| 465 |
simple
|
shipping
|
Where does the driver of ship ID 1127 live?
|
live refers to address
|
SELECT T2.address FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = '1127'
| 466 |
simple
|
retails
|
The part "hot spring dodger dim light" is ordered in how many orders?
|
part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'
|
SELECT COUNT(T1.p_partkey) FROM part AS T1 INNER JOIN lineitem AS T2 ON T1.p_partkey = T2.l_partkey WHERE T1.p_name = 'hot spring dodger dim light'
| 467 |
simple
|
regional_sales
|
At what Latitude and Longitude is the store that has used the WARE-PUJ1005 warehouse the fewest times?
|
WARE-PUJ1005 is the WarehouseCode; fewest times refers to Min (Count(WarehouseCode))
|
SELECT T2.Latitude, T2.Longitude FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.WarehouseCode = 'WARE-PUJ1005' GROUP BY T2.StoreID ORDER BY COUNT(T1.WarehouseCode) ASC LIMIT 1
| 468 |
moderate
|
legislator
|
Which current legislator is older, Sherrod Brown or Maria Cantwell?
|
older refers to MAX(birthday_bio); 'Sherrod Brown' and 'Maria Cantwell' are official_full_name
|
SELECT official_full_name FROM current WHERE official_full_name = 'Sherrod Brown' OR official_full_name = 'Maria Cantwell' ORDER BY birthday_bio LIMIT 1
| 469 |
simple
|
retails
|
Calculate the percentage of part supply that costs more than 500.
|
DIVIDE(COUNT(ps_suppkey where ps_supplycost > 500)), COUNT(ps_suppkey) as percentage;
|
SELECT CAST(SUM(IIF(ps_supplycost > 500, 1, 0)) AS REAL) * 100 / COUNT(ps_suppkey) FROM partsupp
| 470 |
simple
|
public_review_platform
|
What are the states of businesses with attribute of beer and wine located?
|
with attribute of beer and wine refers to attribute_value = 'beer_and_wine';
|
SELECT DISTINCT T2.state FROM Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.attribute_value = 'beer_and_wine'
| 471 |
simple
|
food_inspection_2
|
Among the establishments that failed the inspection in February 2010, list the names of the employees with a salary greater than 70% of the average salary of all employees.
|
failed the inspection refers to results = 'Fail'; in January 2010 refers to inspection_date like '2010-01%'; name of employee refers to first_name, last_name; a salary greater than 70% of the average salary refers to salary > multiply(avg(salary), 0.7)
|
SELECT DISTINCT T1.employee_id FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.results = 'Fail' AND strftime('%Y-%m', T2.inspection_date) = '2010-02' AND T1.salary > 0.7 * ( SELECT AVG(salary) FROM employee )
| 472 |
moderate
|
airline
|
List the air carrier's description of the flights with 0 departure delay.
|
0 departure delay refers to DEP_DELAY = 0;
|
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.DEP_DELAY = 0 GROUP BY T1.Description
| 473 |
simple
|
restaurant
|
What is the rating of each restaurant reviews on Atlantic Ave?
|
Atlantic Ave refers to street_name = 'atlantic ave'; rating refers to review
|
SELECT T1.review FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.street_name = 'atlantic ave'
| 474 |
simple
|
retails
|
Calculate the percentage of customers' accounts in debt.
|
DIVIDE(COUNT(c_custkey where c_acctbal < 0), COUNT(c_custkey)) as percentage;
|
SELECT CAST(SUM(IIF(c_acctbal < 0, 1, 0)) AS REAL) * 100 / COUNT(c_custkey) FROM customer
| 475 |
simple
|
world
|
How many cities are there in the country with the surface area of 652090?
|
SELECT T2.Name, COUNT(T1.Name) FROM City AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.Code WHERE T2.SurfaceArea = 652090 GROUP BY T2.Name
| 476 |
simple
|
|
world
|
List down the cities belongs to the country that has surface area greater than 7000000.
|
surface area greater than 7000000 refers to SurfaceArea > 7000000;
|
SELECT T2.Name, T1.Name FROM City AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.Code WHERE T2.SurfaceArea > 7000000
| 477 |
simple
|
soccer_2016
|
Who was the captain-keeper of Rising Pune Supergiants?
|
captain-keeper refers to Role_Desc = 'CaptainKeeper'; Rising Pune Supergiants refers to Role_Desc = 'CaptainKeeper'
|
SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Team AS T3 ON T2.Team_Id = T3.Team_Id INNER JOIN Rolee AS T4 ON T2.Role_Id = T4.Role_Id WHERE T3.Team_Name = 'Rising Pune Supergiants' AND T4.Role_Desc = 'CaptainKeeper' GROUP BY T1.Player_Name
| 478 |
moderate
|
world
|
Which country has the most crowded city in the world?
|
most crowded city refers to MAX(Population);
|
SELECT T1.Name FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode ORDER BY T2.Population DESC LIMIT 1
| 479 |
simple
|
works_cycles
|
Please list the titles of the documents that are pending approval.
|
documents pending approval refers to Status = 1
|
SELECT Title FROM Document WHERE Status = 1
| 480 |
simple
|
airline
|
On August 2018, which day had the highest number of cancelled flights due to the most serious reasons in Dallas/Fort Worth International?
|
On August 2018 refers to FL_DATE like '2018/8%'; day with the highest number of cancelled flights refers to MAX(COUNT(FL_DATE WHERE CANCELLED = 1)); cancelled due to the most serious reasons refers to CANCELLATION_CODE = 'A'; in Dallas/Fort Worth International refers to Description = 'Dallas/Fort Worth, TX: Dallas/Fort Worth International';
|
SELECT T2.FL_DATE FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE LIKE '2018/8%' AND T1.Description = 'Dallas/Fort Worth, TX: Dallas/Fort Worth International' AND T2.ORIGIN = 'DFW' AND T2.CANCELLED = 1 AND T2.CANCELLATION_CODE = 'A' GROUP BY T2.FL_DATE ORDER BY COUNT(T2.FL_DATE) DESC LIMIT 1
| 481 |
moderate
|
cs_semester
|
How many students does Ogdon Zywicki advise?
|
Ogdon Zywicki is a professor;
|
SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.first_name = 'Ogdon' AND T2.last_name = 'Zywicki'
| 482 |
simple
|
mondial_geo
|
What kind of political system is in place in the country with the highest inflation rate?
|
Political system refers to government form
|
SELECT T1.Government FROM politics AS T1 INNER JOIN economy AS T2 ON T1.Country = T2.Country ORDER BY T2.Inflation DESC LIMIT 1
| 483 |
simple
|
cookbook
|
Which recipe has the highest number of ingredients? Calculate the said recipe's total time of cooking.
|
the highest number of ingredients refers to MAX(ingredient_id); total time refers to recipe_id, total time of cooking refers to TOTAL(prep_min, cook_min, stnd_min)
|
SELECT T2.recipe_id, T1.prep_min + T1.cook_min + T1.stnd_min FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id GROUP BY T2.recipe_id ORDER BY COUNT(T2.ingredient_id) DESC LIMIT 1
| 484 |
moderate
|
public_review_platform
|
What are the most common compliments types received by user with uber number of fans?
|
the most common compliments types refer to MAX(COUNT(compliment_id)); user_fans = 'uber';
|
SELECT DISTINCT T3.compliment_type FROM Users AS T1 INNER JOIN Users_Compliments AS T2 ON T1.user_id = T2.user_id INNER JOIN Compliments AS T3 ON T2.compliment_id = T3.compliment_id WHERE T1.user_fans = 'Uber'
| 485 |
simple
|
sales_in_weather
|
Between the stores under weather station 12, what is the percentage of item 5 sold in store 10 in 2014?
|
weather station 12 refers to station_nbr = 12; item 5 refers to item_nbr = 5; 10 store refers to store_nbr = 10; in 2014 refers to SUBSTR(date, 1, 4) = '2014'; percentage = Divide (Sum(units where store_nbr = 10), Sum(units)) * 100
|
SELECT CAST(SUM(CASE WHEN T2.store_nbr = 10 THEN units * 1 ELSE 0 END) AS REAL) * 100 / SUM(units) FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr WHERE station_nbr = 12 AND item_nbr = 5 AND T2.`date` LIKE '%2014%'
| 486 |
challenging
|
mental_health_survey
|
Give the number of users who took the "mental health survey for 2018".
|
mental health survey for 2018 refers to SurveyID = 2018
|
SELECT COUNT(DISTINCT T1.UserID) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2018'
| 487 |
simple
|
book_publishing_company
|
For each publisher, state the type of titles they published order by the publisher name.
|
publisher name refers to pub_name
|
SELECT DISTINCT T2.pub_name, T1.type FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id ORDER BY T2.pub_name
| 488 |
simple
|
mental_health_survey
|
How many users answered "No" to the question "Would you bring up a mental health issue with a potential employer in an interview?" in 2014's survey?
|
2014 refer to SurveyID; Answered No refer to AnswerText = 'No'; Question refer to questiontext
|
SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'Would you bring up a mental health issue with a potential employer in an interview?' AND T2.SurveyID = 2014 AND T2.AnswerText LIKE 'NO'
| 489 |
moderate
|
codebase_comments
|
Among the repository "3", how many methods whose comments is XML format?
|
repository refers to RepoId; RepoId = 3; method refers to Name; method whose comment is XML format refers to CommentIsXml = 1;
|
SELECT COUNT(T2.SolutionId) FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.RepoId = 3 AND T2.CommentIsXml = 1
| 490 |
simple
|
soccer_2016
|
Which year do the majority of the players were born?
|
year refers to DOB; majority of the players refers to max(count(Player_Id))
|
SELECT DOB FROM Player GROUP BY DOB ORDER BY COUNT(DOB) DESC LIMIT 1
| 491 |
simple
|
public_review_platform
|
How many businesses in the city of Scottsdale open on Sunday at 12PM?
|
businesses that opened on Sunday refers to day_of_week = 'Sunday'; businesses that opened at 12PM refers to opening_time = '12PM'
|
SELECT COUNT(DISTINCT T2.business_id) FROM Business AS T1 INNER JOIN Business_hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.city = 'Scottsdale' AND T3.day_of_week = 'Sunday' AND T2.opening_time = '12PM'
| 492 |
simple
|
mondial_geo
|
What is the population density of Hanoi's home country?
|
population density = Population / Area
|
SELECT T1.Population / T1.Area FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Province = T2.Name WHERE T3.Name = 'Hanoi'
| 493 |
simple
|
professional_basketball
|
Among the coaches who won the 'NBA coach of the year' award from 1971 - 1975, how many of them were in 'POR' team?
|
the 'NBA coach of the year' award refers to award = 'NBA coach of the year'; from 1971 - 1975 refers to year between 1971 and 1975; 'POR' team refers to tmID = 'POR'
|
SELECT COUNT(T1.id) FROM awards_coaches AS T1 INNER JOIN teams AS T2 ON T1.year = T2.year WHERE T1.year BETWEEN 1971 AND 1975 AND T1.award = 'NBA Coach of the Year' AND T2.tmID = 'POR'
| 494 |
moderate
|
superstore
|
How many orders of O'Sullivan Plantations 2-Door Library in Landvery Oak in central superstore were shipped through the shipping mode with the fastest delivery speed?
|
'O'Sullivan Cherrywood Estates Traditional Bookcase' is the "Product Name"; shipping mode with the fastest delivery speed refers to "Ship Mode" = 'First Class'
|
SELECT COUNT(DISTINCT T1.`Order ID`) FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'O''Sullivan Plantations 2-Door Library in Landvery Oak' AND T2.Region = 'Central' AND T1.`Ship Mode` = 'First Class'
| 495 |
moderate
|
cars
|
What years did the Buick Skylark 320 get in production?
|
year refers to model_year; Buick Skylark 320 refers to car_name = 'buick skylark 320'
|
SELECT T2.model_year FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID WHERE T1.car_name = 'buick skylark 320'
| 496 |
simple
|
works_cycles
|
Calculate the average of the total ordered quantity of products purchased whose shipping method was Cargo Transport 5.
|
shipping method was Cargo Transport 5 refers to Name = 'Cargo Transport 5'; average = DIVIDE(SUM(OrderQty where Name = 'Cargo Transport 5'), COUNT(ShipMethodID))
|
SELECT CAST(SUM(IIF(T1.ShipMethodID = 5, T3.OrderQty, 0)) AS REAL) / COUNT(T3.ProductID) FROM ShipMethod AS T1 INNER JOIN PurchaseOrderHeader AS T2 ON T1.ShipMethodID = T2.ShipMethodID INNER JOIN PurchaseOrderDetail AS T3 ON T2.PurchaseOrderID = T3.PurchaseOrderID
| 497 |
challenging
|
codebase_comments
|
What is the processed time to download the repository whose files are contained in the solution with the path "jeffdik_tachy\src\Tachy.sln".
|
SELECT DISTINCT T2.ProcessedTime FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.Path = 'jeffdik_tachysrcTachy.sln'
| 498 |
simple
|
|
sales
|
Write down all of the product ids that were placed by Meander.
|
SELECT DISTINCT T2.ProductID FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID WHERE T1.FirstName = 'Meander'
| 499 |
simple
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.