
/* Chapter 8 - Try It Out sections */


/* Try It Out: Creating Expressions with Comparison Operators */

SELECT DVDName, StatID
FROM DVDs
WHERE StatID='s2'
ORDER BY DVDName;


SELECT DVDName, StatID
FROM DVDs
WHERE StatID<>'s2'
ORDER BY DVDName;


SELECT DVDName, YearRlsd, StatID
FROM DVDs
WHERE YearRlsd>2000
ORDER BY DVDName;


SELECT EmpFN, EmpMN, EmpLN
FROM Employees
WHERE EmpMN IS NOT NULL;


SELECT OrderID, TransID, DVDID
FROM Transactions
WHERE DVDID IN (2, 5, 8)
ORDER BY OrderID, TransID;


SELECT DVDName, StatID, RatingID
FROM DVDs
WHERE DVDName LIKE '%horror%'
ORDER BY DVDName;


SELECT DVDName, StatID, RatingID
FROM DVDs
WHERE DVDName REGEXP 'ro'
ORDER BY DVDName;



/* Try It Out: Creating Expressions with Logical Operators */

SELECT DVDName, MTypeID, RatingID
FROM DVDs
WHERE RatingID='G' OR RatingID='PG'
ORDER BY DVDName;


SELECT DVDName, MTypeID, RatingID
FROM DVDs
WHERE StatID='s2' AND (RatingID='G' OR RatingID='PG')
ORDER BY DVDName;


SELECT DVDName, MTypeID, RatingID
FROM DVDs
WHERE StatID='s2' AND NOT (RatingID='G' OR RatingID='PG')
ORDER BY DVDName;



/* Try It Out: Creating Expressions with Sort Operators */

SELECT DVDName, StatID, RatingID
FROM DVDs
WHERE DVDName REGEXP 'W'
ORDER BY DVDName;


SELECT DVDName, StatID, RatingID
FROM DVDs
WHERE DVDName REGEXP BINARY 'W'
ORDER BY DVDName;


