Databases Reference
In-Depth Information
Testing the trigger
Contrary to testing stored procedures or functions, there is neither a CALL sequence
nor a function inside a SELECT statement to execute the trigger. Any time the defined
operation (a book INSERT ) happens, the code will execute (in our case, after the
insertion). Therefore, we simply have to insert a new book to see that the author.
total_page_count column is updated.
Of course, a completely automatic management of this column would involve
creating AFTER UPDATE and AFTER DELETE triggers on the book table.
Using information_schema
In the SQL:2003 Standard, access to the data dictionary (or database metadata) is
provided by a structure called information_schema . As this is part of the Standard,
and already exists in other database systems, the decision to implement this feature
into MySQL was a very good one.
MySQL has added some information that is not part of the standard,
for example, INFORMATION_SCHEMA.COLUMNS.COLUMN_TYPE . Be
aware of the fact that if you use this information in a software project,
it might not be portable to other SQL implementations.
A phpMyAdmin user sees the information_schema as a normal database
containing views. These views describe many aspects of the structure of the
databases hosted on this server. The following screenshot shows a subset of what can
be seen (and in fact, the only possible operation on this database is SELECT ):
 
Search WWH ::




Custom Search