Neat & Clean Solution
IntuitionIdentify Salespeople – Start with all salespeople from SalesPerson.
Find Those Who Worked with 'RED' – Use Orders and Company tables to get sales_ids w
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
**Identify Salespeople** – Start with all salespeople from SalesPerson.
**Find Those Who Worked with 'RED'** – Use Orders and Company tables to get sales_ids where Company.name = 'RED'.
**Exclude Them** – Use NOT IN or NOT EXISTS to remove those sales_ids from the final list.
**Handle NULLs** – NOT EXISTS is better than NOT IN to avoid issues with NULL values.
**Optimize Performance** – Ensure indexes exist on sales_id and com_id for faster joins and filtering.


# Code
```postgresql []
-- Write your PostgreSQL query statement below
SELECT name 
FROM SalesPerson
WHERE sales_id NOT IN (
    SELECT sales_id 
    FROM Orders o 
    JOIN Company c ON o.com_id = c.com_id AND c.name = 'RED'
)
```
['PostgreSQL']