Sams Teach Yourself SQL in 24 Hours, Third Edition By Ronald R. Plew, Ryan K. Stephens
Table of Contents
Hour 22. Advanced SQL Topics
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:
Can a trigger be altered ?
2:
When a cursor is closed, can you reuse the name ?
3:
What command is used to retrieve the results after a cursor has been opened?
4:
Are triggers executed before or after an INSERT, DELETE, or UPDATE?
Exercises
1:
Enter the following code at the mysql> prompt to generate DESCRIBE TABLE statements for all tables in your MySQL database:
SELECT CONCAT('DESCRIBE ',TABLE_NAME,';') FROM TABLES_PRIV;
2:
Write a SELECT statement that generates the SQL code to count all rows in each of your tables. (Hint: it is similar to exercise #1.)