Today we put the finishing touches on another article for the
Developer's Zone page. This one centered on how to implement
foreign keys via triggers into MySQL. This is important when your
application requires referential integrity and the storage engine
you'd like to use, as in the case of MyISAM or more specifically
NDB (Cluster), does not support this functionality
natively.
In the article we cover:
- Restricting INSERTS
- Restricting UPDATES and DELETES
- Cascading UPDATES and DELETES
Some of the advantages of foreign key enforcement include:
- Assuming the proper design of the relationships, foreign key constraints make it more difficult for a programmer to introduce an inconsistency into the database.
- Centralizing the checking of these constraints by the database server makes it unnecessary to perform these checks on the application side. This …