Workshop
The following workshop is composed of a series of quiz questions and practical exercises. The quiz questions are designed to test your overall understanding of the current material. The practical exercises are intended to afford you the opportunity to apply the concepts discussed during the current hour, as well as build upon the knowledge acquired in previous hours of study. Please take time to complete the quiz questions and exercises before continuing. Refer to Appendix C, "Answers to Quizzes and Exercises," for answers.
Quiz
True or false: The AVG function returns an average of all rows from a select column including any NULL values.
True or false: The SUM function is used to add column totals.
True or false: The COUNT(*) function counts all rows in a table.
Will the following SELECT statements work? If not, what will fix the statements?
-
SELECT COUNT * FROM EMPLOYEE_PAY_TBL;
-
SELECT COUNT(EMPLOYEE_ID), SALARY FROM EMPLOYEE_PAY_TBL;
-
SELECT MIN(BONUS), MAX(SALARY) FROM EMPLOYEE_PAY_TBL WHERE SALARY > 20000;
Exercises
Use EMPLOYEE_PAY_TBL to construct SQL statements to solve the following exercises:
What is the average salary?
What is the maximum bonus?
What are the total salaries?
What is the minimum pay rate?
How many rows are in the table?
How many employees do we have whose last names begin with a G?
If every product cost $10.00, what would be the total dollar amount for all orders?