insert, update, delete, writetext, and truncate table allow you to change data without changing related data in other tables, however, disparities may develop.
For example, if you change the au_id entry for Sylvia Panteley in the authors table, you must also change it in the titleauthor table and in any other table in the database that has a column containing that value. If you do not, you cannot find information such as the names of Ms. Panteley’s books, because you cannot make joins on her au_id column.
Keeping data modifications consistent throughout all tables in a database is called referential integrity. One way to manage it is to define referential integrity constraints for the table. Another way is to create special procedures called triggers that take effect when you give insert, update, and delete commands for particular tables or columns (the truncate table command is not caught by triggers or referential integrity constraints). See Chapter 19, “Triggers: Enforcing Referential Integrity”; and Chapter 8, “Creating Databases and Tables.”
To delete data from referential integrity tables, change the referenced tables first and then the referencing table.
Copyright © 2005. Sybase Inc. All rights reserved. |