Practice Interview Questions
| Question | Status |
|---|---|
You are working for Instagram Shop and your team wants to know what is the most popular product. Write a SQL query to find the 1 product with the highest number of orders. In case of a tie in order counts, select the product that comes first in alphabetical order.
orders table:
| Column Name | Description |
|---|---|
| id | Unique identifier for each order |
| product_id | Identifier for the product |
| customer_id | Identifier for the customer |
| order_date | Date the order was placed |
products table:
| Column Name | Description |
|---|---|
| id | Unique identifier for each product |
| name | Name of the product |
| price | Price of the product |
| category_id | Identifier for the category |
| product_name |
|---|
| Product B |
| Column Name |
|---|
| Description |
|---|
| id | Unique identifier for each product |
| name | Name of the product |
| price | Price of the product |
| category_id | Identifier for the category |
| product_name |
|---|
| Product B |