Sales Person

2pts
Salesforce

Problem Statement

Salesforce management wants to identify sales representatives who have no business history with a specific competitor or partner company named RED.

Write an SQL query to report the names of all the salespersons who did not have any orders related to the company with the name RED.

Rules:

  • You must check the Orders table to see which salespersons are linked to which companies.
  • A salesperson should be included in the output if they have no orders at all, or if none of their orders are linked to RED.
  • Return the result table containing only the name column.
  • Results must be sorted by name in ascending order.
Tests your understanding of
Basic SQL, Subquery, Joins and Filtering

Input Tables

salesperson
sales_id(INTEGER)name(VARCHAR)salary(INTEGER)commission_rate(INTEGER)hire_date(DATE)
1John10000062006-04-01
2Amy1200052010-05-01
3Mark65000122008-12-25
4Pam25000252005-01-01
5Alex5000102007-02-03
company
com_id(INTEGER)name(VARCHAR)city(VARCHAR)
1REDBoston
2ORANGENew York
3YELLOWChicago
4GREENAustin
orders
order_id(INTEGER)order_date(DATE)com_id(INTEGER)sales_id(INTEGER)amount(INTEGER)
12014-01-013410000
22014-02-01455000
32014-03-011150000
42014-04-011425000

Expected Output

name(VARCHAR)
Alex
Amy
Mark

Tags

EasyBasic SQLSubqueryJoinsFiltering
10-15 min
66%

Hints