Conventions and styles conventions and programming styles
Every time I want to demonstrate the actual code, I adjust the code that appears on the MySQL client's screen, changing the font to courier so that they look different from normal text (which lets you distinguish between the program code and the body). Here's an example:
mysql> DROP FUNCTION f;
Query OK, 0 rows affected (0.00 sec)
If the instance is larger, you need to annotate some lines and paragraphs, and I will use the "<--" symbol on the right side of the page to emphasize. For example:
mysql> CREATE PROCEDURE p ()
-> BEGIN
-> /* This procedure does nothing */ <--
-> END;//
Query OK, 0 rows affected (0.00 sec)
Sometimes I will remove the "mysql>" and "->" systems in the example, and you can copy the code directly to the MySQL client (if you are not reading the electronic version, you can download the relevant script on the MySQL.com website)
So the examples have been tested in the SuSE 9.2 Linux, Mysql 5.0.3 public edition. As you read this book, MySQL already has a higher version and can support more OS, including Windows,sparc,hp-ux. So the example here will be able to run normally on your computer. However, if the operation still fails, you can consult the senior MySQL users you know, so that you can get better support and help.
Why triggers Why do you use triggers
We included support for triggers in MySQL 5.0 for the following reasons:
MySQL's earlier version of the user needs a trigger request for a long time.
We have promised to support the attributes of all ANSI standards.
You can use it to check or prevent bad data from entering the database.
You can change or cancel the INSERT, UPDATE, and DELETE statements.
You can monitor the movement of data changes in a session.