------------------------------------------------------------------------
-- John David Ayers ----------------------------------------------------
-- September 22, 2009 --------------------------------------------------
-- SELECT COMMAND 3 ----------------------------------------------------
------------------------------------------------------------------------

-- Average
SELECT AVG(QuotedPrice) AS [Average Quoted Price]
FROM Order_Details;

-- Count
SELECT COUNT(*) AS [Number of Rows]
FROM Order_Details;

SELECT COUNT(QuotedPrice) AS [Number of Rows]
FROM Order_Details;

-- Max
SELECT MAX(QuotedPrice) AS [Largest]
FROM Order_Details;

-- Min
SELECT MIN(QuotedPrice) AS [Smallest]
FROM Order_Details;

-- Sum
SELECT SUM(QuotedPrice) AS [Total]
FROM Order_Details;

-- Math Answers
SELECT 342 + 452;

-- Print - Displays No Grids
PRINT 342 + 452;

-- Absolute Value
SELECT ABS(-235)

-- Rounding
-- Round Up
SELECT RetailPrice, CEILING(RetailPrice)
FROM Products;

-- Round Down
SELECT RetailPrice, FLOOR(RetailPrice)
FROM Products;

-- Rounding to the Right
SELECT RetailPrice, ROUND(RetailPrice, 1)
FROM Products;

-- Rounding to the Left
SELECT RetailPrice, ROUND(RetailPrice, -3)
FROM Products;

-- Contatination
SELECT 'The Stuff ' + ProductName + ' is ' + STR(RetailPrice, 6, 2)
FROM Products;

-- Square
-- Square Root
SELECT RetailPrice, SQRT(RetailPrice)
FROM Products;

SELECT RetailPrice, STR(SQRT(RetailPrice), 4, 2)
FROM Products;

-- Square
SELECT RetailPrice, SQUARE(RetailPrice)
FROM Products;

-- Cast
SELECT 'The Stuff ' + ProductName + ' is ' + CAST(RetailPrice AS VarCHAR(10))
FROM Products;
