Home >Database >Mysql Tutorial >MySql 外键约束 之CASCADE、SET NULL、RESTRICT、空等类型分析和_MySQL

MySql 外键约束 之CASCADE、SET NULL、RESTRICT、空等类型分析和_MySQL

WBOY
WBOYOriginal
2016-06-01 13:11:48944browse

Mysql外键

主表,从表【MySql】//http://my.oschina.net/cart/blog/277624空、RESTRICT、NO ACTION删除:从表记录不存在时,主表才可以删除。删除从表,主表不变更新:从表记录不存在时,主表才可以更新。更新从表,主表不变//http://my.oschina.net/cart/blog/277624CASCADE删除:删除主表时自动删除从表。删除从表,主表不变更新:更新主表时自动更新从表。更新从表,主表不变//http://my.oschina.net/cart/blog/277624SET NULL删除:删除主表时自动更新从表值为NULL。删除从表,主表不变更新:更新主表时自动更新从表值为NULL。更新从表,主表不变



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn