Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in SQL by (55.6k points)

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

1 Answer

0 votes
by (119k points)
edited by

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

SELECT Customer_Name

FROM Customers


                                         (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 server training and certification program by Intellipaat to learn writing complex SQL queries.

Browse Categories