
Sales Employees with Most Sales Revenue
As Michael Scott prepare to go on a sales call with his dream sales team to secure Lackawanna County as a client, he realizes that there is only room for 3 people on his Chrysler Sebring besides himself. This means he must choose only 3 sales department employees to go with him on this sales call. That's not good, Michael makes terrible decisions when under pressure.
Luckily, he is able to look up the sales history of each salesperson and choose the top 3 salespeople according to the amount of sales revenue they have brought in.
Exercise
Help Michael gather his employees for his dream team by obtaining the names of the top 3 salespeople with the highest sales revenue. These can be permanent employees from the Sales department only. The Employees
table provides the list of all employees and their information, and the Sales
table provides a history of sales for Dunder Mifflin. The sales revenue in each sale in the Sales
table can be found by multiplying the quantity
and price
columns. Your output table should display only the first_name
and last_name
of the top 3 employees, as well as a column called sales_revenue
that represents the amount of sales revenue brought in by the employee.
Tables
Employees
Column Name | Data Type |
---|---|
employee_id | INT PRIMARY KEY |
first_name | VARCHAR |
last_name | VARCHAR |
date_of_birth | TEXT |
department | VARCHAR |
employment_type | VARCHAR |
Sales
Column Name | Data Type |
---|---|
sale_id | INT PRIMARY KEY |
client_name | VARCHAR |
product_name | VARCHAR |
salesperson_id | INT (FOREIGN KEY Employees.employee_id ) |
date | TEXT |
quantity | INT |
price | DECIMAL |