faqts : Computers : Databases : MySQL : Language and Syntax : Queries : Create Table

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

29 of 67 people (43%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

How can I ensure the referential integrity of MySQL tables?

Feb 8th, 2000 08:06
Nathan Wallace, Sinisa Milivojevic


You can force referential integrity in your programs.

The easiest way to do it is to check , before updating or deleting
primary key referenced by other tables, for existance of the
corresponding foreign key values in the referencing table.

Also, you could force checking , before inserting or updating foreign
key referencing primary key in some other table, for the existence of
the referenced primary key values in the referenced table.

Such practice would ensure referential integrity in your database.