keywords:
Bookmark and Share



Front Back
ROUND()    Rounds a numeric field to the number of decimals specified SELECT ROUND(column_name,decimals)
FROM table_name; SELECT ProductName, ROUND(Price,0) AS RoundedPrice FROM Products;
MAX()    Returns the largest value SELECT MAX(Price) AS HighestPrice FROM Products; MIN()    Returns the smallest value SELECT MIN(Price) AS SmallestOrderPrice FROM Products;
SUM()    Returns the sum  SELECT c.ContactName,od.OrderID, o.OrderDate, od.ProductID, p.ProductName,        sum((od.UnitPrice - (od.UnitPrice * od.Discount)) * od.Quantity) As Subtotal   FROM OrderDetails od     INNER JOIN Products p     ON od.ProductID = p.ProductID     INNER JOIN Orders o     ON od.OrderID = o.OrderID     INNER JOIN Customers c     ON o.CustomerID = c.CustomerID GROUP BY c.ContactName, od.OrderID,o.OrderDate, od.ProductID, p.ProductName ORDER BY OrderID;
SELECT OrderID,      sum((UnitPrice - (UnitPrice * Discount)) * Quantity) As Subtotal from OrderDetails group by OrderID order by OrderID;
x of y cards