SELECT customerNumber, checkNumber, amount FROM payments WHERE amount = ( SELECT MAX(amount) FROM payments );
SELECT customerNumber, checkNumber, amount FROM payments WHERE amount > ( SELECT AVG(amount) FROM payments );
SELECT customername FROM customers WHERE customerNumber NOT IN( SELECT DISTINCT customernumber FROM orders );
SELECT priceEach * quantityOrdered FROM orderdetails WHERE priceEach * quantityOrdered > 10000 GROUP BY orderNumber;
SELECT customerName FROM customers WHERE EXISTS ( SELECT priceEach * quantityOrdered FROM orderdetails WHERE priceEach * quantityOrdered > 10000 GROUP BY orderNumber )
SELECT max(items), min(items), floor(avg(items)) FROM (SELECT orderNumber, count(orderNumber) AS items FROM orderdetails GROUP BY orderNumber) AS lineitems;
SELECT productname, buyprice FROM products AS p1 WHERE buyprice > ( SELECT AVG(buyprice) FROM products WHERE productline = p1.productline)