Skip to content

Practice Sales Person

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#607
LeetCode Problem

Sales Person

Problem Statement

Tables: SalesPerson(sales_id INT, name VARCHAR, salary INT, commission_rate INT, hire_date DATE); Company(com_id INT, name VARCHAR, city VARCHAR); Orders(order_id INT, order_date DATE, com_id INT, sales_id INT, amount INT). SalesPerson.sales_id, Company.com_id and Orders.order_id are unique keys. Orders.com_id and sales_id reference their corresponding tables. Return the names of salespeople with no order for any company named RED. Include salespeople with no orders at all. Output order is unrestricted.

Source: Sales Person on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
SalesPerson table: +----------+------+--------+-----------------+------------+ | sales_id | name | salary | commission_rate | hire_date  | +----------+------+--------+-----------------+------------+ | 1        | John | 100000 | 6               | 4/1/2006   | | 2        | Amy  | 12000  | 5               | 5/1/2010   | | 3        | Mark | 65000  | 12              | 12/25/2008 | | 4        | Pam  | 25000  | 25              | 1/1/2005   | | 5        | Alex | 5000   | 10              | 2/3/2007   | +----------+------+--------+-----------------+------------+ Company table: +--------+--------+----------+ | com_id | name   | city     | +--------+--------+----------+ | 1      | RED    | Boston   | | 2      | ORANGE | New York | | 3      | YELLOW | Boston   | | 4      | GREEN  | Austin   | +--------+--------+----------+ Orders table: +----------+------------+--------+----------+--------+ | order_id | order_date | com_id | sales_id | amount | +----------+------------+--------+----------+--------+ | 1        | 1/1/2014   | 3      | 4        | 10000  | | 2        | 2/1/2014   | 4      | 5        | 5000   | | 3        | 3/1/2014   | 1      | 1        | 50000  | | 4        | 4/1/2014   | 1      | 4        | 25000  | +----------+------------+--------+----------+--------+
Output
+------+ | name | +------+ | Amy  | | Mark | | Alex | +------+

Related LeetCode Problems

Practice more problems similar to Sales Person.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.