Two accepted solution


  • 0
    H
    SELECT C.Name AS Customers
    FROM Customers C LEFT JOIN Orders O ON C.Id = O.CustomerId WHERE CustomerId IS NULL;
    
    SELECT C.Name AS Customers FROM Customers C
    WHERE C.Id NOT IN (SELECT O.CustomerId FROM Orders O)
    

    I have no idea which one faster. I think it might be the #2.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.