Workshop

Team-Fly    

 
Sams Teach Yourself SQL in 24 Hours, Third Edition
By Ronald R. Plew, Ryan K. Stephens
Table of Contents
Hour  16.  Using Indexes to Improve Performance


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:

What are some major disadvantages of using indexes?

2:

Why is the order of columns in a composite important?

3:

Should a column with a large percentage of NULLs be indexed?

4:

Is the main purpose of an index to stop duplicate values in a table?

5:

True or false: The main reason for a composite index is for aggregate function usage in an index.

Exercises

1:

For the following situations, decide whether an index should be used and, if so, what type of index should be used.

  1. Several columns, but a rather small table

  2. Medium- sized table, no duplicates should be allowed

  3. Several columns, very large table, several columns used as filters in the WHERE clause

  4. Large table, many columns, a lot of data manipulation

2:

Type the following code into the mysql> prompt to create an index on the EMPLOYEE_PAY_TBL table on the POSITION column:

 CREATE INDEX EP_POSITION ON EMPLOYEE_PAY_TBL (POSITION); 
3:

Study the tables used in this book. What are some good candidates for indexed columns based on how a user might search for data?

4:

Create a multi-column index on the ORDERS_TBL table. Include the following columns: CUST_ID, PROD_ID, and ORD_DATE.

5:

Create some additional indexes on your tables as desired.


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