
/* Chapter 7 - Try It Out sections */


/* Try It Out: Defining a HAVING Clause in Your SELECT Statement */

SELECT RatingID, COUNT(*) AS Total
FROM DVDs
GROUP BY RatingID
HAVING Total>1;


SELECT EmpID, COUNT(*) AS Amount
FROM Orders
GROUP BY EmpID
HAVING Amount>2;


/* Try It Out: Defining an ORDER BY Clause in Your SELECT Statement */

SELECT DVDName, MTypeID, RatingID
FROM DVDs
WHERE RatingID!='NR'
ORDER BY DVDName;


SELECT MTypeID, RatingID, DVDName
FROM DVDs
WHERE RatingID!='NR'
ORDER BY MTypeID, RatingID;



/* Try It Out: Defining a LIMIT Clause in Your SELECT Statement */

SELECT OrderID, CustID
FROM Orders
ORDER BY OrderID DESC
LIMIT 1;

