bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 183. Customers Who Never Order

183. Customers Who Never Order

Leetcode Solutions

Finding Customers Who Never Order Using a Left Join

  1. Perform a LEFT JOIN on the Customers table with the Orders table using the customer's ID as the joining key.
  2. Filter the result of the join to include only those rows where the Orders customerId is NULL. This step will exclude all customers who have made an order.
  3. Select only the name column from the filtered result and alias it as 'Customers'.
  4. Return the final result set containing the names of customers who have never placed an order.
erDiagram
    Customers {
        int id PK
        varchar name
    }
    Orders {
        int id PK
        int customerId FK
    }
    Customers ||--o{ Orders : places

Identifying Non-Ordering Customers Using a Subquery

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...