Q: Which of the following commands is the best way to generate an
overview of what stored procedures and functions are available in
the current database and what each does? Assume that the
developer(s) of the database have followed the good coding
guidelines laid out in this unit.
Solution:
1. |
SHOW PROCEDURES; |
2. |
SHOW PROCEDURE STATUS WHERE db = DATABASE(); |
3. |
SELECT * FROM INFORMATION_SCHEMA.ROUTINES; |
4. |
SELECT name, comment, type FROM mysql.proc WHERE db = DATABASE(); |
2.SHOW PROCEDURE STATUS WHERE db = DATABASE();
This is the ideal statement to list the procedures stored in the database mentioned in the search condition.
Only SHOW PROCEDURES is not a valid statement as it also needs STATUS
SELECT * FROM INFORMATION_SCHEMA.ROUTINES; this statement selects all the rows from the table ROUTINES and displays the result.
SELECT name, comment, type FROM mysql.proc WHERE db = DATABASE(); This is the selective display of certain columns from the table mysql.proc from the database db.
This is the ideal statement to list the procedures stored in the database mentioned in the search condition.
Only SHOW PROCEDURES is not a valid statement as it also needs STATUS
SELECT * FROM INFORMATION_SCHEMA.ROUTINES; this statement selects all the rows from the table ROUTINES and displays the result.
SELECT name, comment, type FROM mysql.proc WHERE db = DATABASE(); This is the selective display of certain columns from the table mysql.proc from the database db.
No comments:
Post a Comment