Question: Write an SQL query to get the 3 most popular pizzas for each city. The goal is to rank the pizza by the count of
Write an SQL query to get the 3 most popular pizzas for each city.
The goal is to rank the pizza by the count of orders in descending order for each city where orders were made. Pizzas with the same number of orders should be sorted alphabetically in ascending order. For each city, the top 3 pizzas must be selected and concatenated into a final list.
In the final list the pizza names must be delimited by comma and space characters. Items in the list must be sorted alphabetically.
example output:


city pizza_list Florence Capricciosa, Country, Margarita Las Vegas Capricciosa, Veggie Malm Country, Gourmet, Quattro Formaggi Manaus Pepperoni, Quattro Stagioni, Veggie Selinia Country, Gourmet, Quattro Stagioni
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
