Customers


SELECT * 
FROM CUSTOMERS

SELECT CompanyName 
           ,ContactName
FROM CUSTOMERS

List of customers and the corresponding number of orders they have placed.

SELECT Customers.CompanyName, COUNT(Orders.CustomerID) 
FROM Customers
INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
GROUP BY Customers.CompanyName

List of customers that have placed over 10 orders

SELECT Customers.CompanyName, COUNT(Orders.CustomerID) 
FROM Customers
INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
GROUP BY Customers.CompanyName
HAVING COUNT(Orders.CustomerID) > 10


© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext