SELECT	CustFirstName, CustLastName, COUNT(OrderNumber) AS [Number of Orders]
FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
GROUP BY CustLastName, CustFirstName
HAVING COUNT(OrderNumber) > 30

SELECT VendName, AVG(DaysToDeliver) AS [Days to Deliver]
FROM Vendors INNER JOIN Product_Vendors ON Vendors.VendorID = Product_Vendors.VendorID
GROUP BY VendName;

SELECT ProductName, SUM(QuotedPrice * QuantityOrdered) AS [Total Sales Amount]
FROM Products INNER JOIN Order_Details ON Products.ProductNumber = Order_Details.ProductNumber
GROUP BY ProductName;

SELECT Customers.CustomerID, Orders.OrderNumber, SUM(QuotedPrice * QuantityOrdered) AS [Total Sales Amount]
FROM (Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID)
INNER JOIN Order_Details ON Orders.OrderNumber = Order_Details.OrderNumber
GROUP BY Customers.CustomerID, Orders.OrderNumber;

SELECT ProductName, AVG(DaysToDeliver) AS [Days to Deliver]
FROM Products INNER JOIN Product_Vendors ON Products.ProductNumber = Product_Vendors.ProductNumber
GROUP BY ProductName;
