0 votes
1 view
in SQL by (37.2k points)

Can anyone tell me which SQL command that will find any customers who have not placed orders?

1 Answer

0 votes
by (90.2k points)

Here is the SQL Query to find the customers details who have not placed orders:

SELECT Customer_Name

FROM Customers

WHERE Customer.id NOT IN

                                         (SELECT person_id

                                          FROM orders)

In the above query, the inner query returns the customer ids who placed orders. The outer query returns the customer names whose ids are not in the subquery using NOT IN operator.

You can register for this SQL Certification program by Intellipaat to learn writing complex SQL queries.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !