Databases Reference
In-Depth Information
Afterwards, the
Structure
page for our
book
table reveals a new
Triggers
section,
which can be used the same way as for routines to edit or delete a trigger:
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 just have to insert a new book to see the
author.total_
page_count
column be updated.
Of course, a completely automatic management of this column would involve
creating
AFTER UPDATE
and
AFTER DELETE
triggers on the
book
table.
Information_schema
In the SQL:2003 standard, access to the data dictionary (or database metadata) is
provided by a structure called
information_schema
. Beacause 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
. Beware of
that fact if you plan to use this information in a software project that has
to remain portable to other SQL implementations.
Search WWH ::
Custom Search