1082. Sales Analysis I

https://leetcode.com/problems/sales-analysis-i

Description

Table: Product

+--------------+---------+
| Column Name  | Type    |
+--------------+---------+
| product\_id   | int     |
| product\_name | varchar |
| unit\_price   | int     |
+--------------+---------+
product\_id is the primary key of this table.

Table: Sales

+-------------+---------+
| Column Name | Type    |
+-------------+---------+
| seller\_id   | int     |
| product\_id  | int     |
| buyer\_id    | int     |
| sale\_date   | date    |
| quantity    | int     |
| price       | int     |
+------ ------+---------+
This table has no primary key, it can have repeated rows.
product\_id is a foreign key to Product table.

Write an SQL query that reports the best seller by total sales price, If there is a tie, report them all.

The query result format is in the following example:

ac

Last updated

Was this helpful?