Click here to see the full article post
select name as Customers from customers
left join orders
where orders.id is null
How about this one,but little complicate:
select c.Name as Customers from Customers c
left join Orders as o on c.Id=o.CustomerId
where o.CustomerId is null;
support vladgpt answer because where in clause run slow in real time
why my anwser is not right?
select Name As Customers from Customers c where c.Id != All(select CustomerId from Orders);
select Name as Customers from Customers c where not exists( select 1 from Orders o where o.CustomerId=c.Id )
SELECT Name AS Customers
WHERE Customers.Id NOT IN (SELECT CustomerId FROM Orders)
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.