Будьте так добры, подскажите где можно добыть толковое руководство по MySQL'ю, где было бы подробно описано, как реализовывать ссылочную целостность и каскадное удаление без вложенных запросов.
Здравствуйте Данилович Алексей, Вы писали:
ДА>Будьте так добры, подскажите где можно добыть толковое руководство по MySQL'ю, где было бы подробно описано, как реализовывать ссылочную целостность и каскадное удаление без вложенных запросов.
Из документации к MySQL 3.23.ХХ
5.4.5 Foreign Keys
The FOREIGN KEY syntax in MySQL exists only for compatibility with other SQL vendors' CREATE TABLE commands; it doesn't do anything. The FOREIGN KEY syntax without ON DELETE ... is mostly used for documentation purposes. Some ODBC applications may use this to produce automatic WHERE clauses, but this is usually easy to override. FOREIGN KEY is sometimes used as a constraint check, but this check is unnecessary in practice if rows are inserted into the tables in the right order. MySQL only supports these clauses because some applications require them to exist (regardless of whether or not they work).
In MySQL, you can work around the problem of ON DELETE ... not being implemented by adding the appropriate DELETE statement to an application when you delete records from a table that has a foreign key. In practice this is as quick (in some cases quicker) and much more portable than using foreign keys.
Все надо делать вручную. Для каждой таблицы, в которой содержатся данные, которые в обычном случае могут быть зацеплены каскадным удалением.