On database you can use triggers. With delphi you can use TZUpdateSQL to intercept insert, update, delete records. Maybe with some hack of TZUpdateSQL you be able to do something like to update two tables.