Workshop

Team-Fly    

 
Sams Teach Yourself SQL in 24 Hours, Third Edition
By Ronald R. Plew, Ryan K. Stephens
Table of Contents
Hour  9.  Summarizing Data Results from a Query


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

1:

True or false: The AVG function returns an average of all rows from a select column including any NULL values.

2:

True or false: The SUM function is used to add column totals.

3:

True or false: The COUNT(*) function counts all rows in a table.

4:

Will the following SELECT statements work? If not, what will fix the statements?

  1.  SELECT COUNT *  FROM EMPLOYEE_PAY_TBL; 
  2.  SELECT COUNT(EMPLOYEE_ID), SALARY  FROM EMPLOYEE_PAY_TBL; 
  3.  SELECT MIN(BONUS), MAX(SALARY)  FROM EMPLOYEE_PAY_TBL WHERE SALARY > 20000; 

Exercises

1:

Use EMPLOYEE_PAY_TBL to construct SQL statements to solve the following exercises:

  1. What is the average salary?

  2. What is the maximum bonus?

  3. What are the total salaries?

  4. What is the minimum pay rate?

  5. How many rows are in the table?

2:

How many employees do we have whose last names begin with a G?

3:

If every product cost $10.00, what would be the total dollar amount for all orders?


Team-Fly    
Top
 


Sams Teach Yourself SQL in 24 Hours
Sams Teach Yourself SQL in 24 Hours (5th Edition) (Sams Teach Yourself -- Hours)
ISBN: 0672335417
EAN: 2147483647
Year: 2002
Pages: 275

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net