Cascade, NO ACTION, Restrict, set NULL in MySQL foreign key settings

Source: Internet
Author: User

1. Cascade Way
Synchronize update/delete out a matching record of a child table when Update/delete records on the parent table

2. Set NULL mode
Set the column of the matching record on the child table to NULL when the record is update/delete on the parent table
Note that the foreign key column of the child table cannot be not NULL

3. No Action Mode
If there are matching records in the child table, the Update/delete action is not allowed for the parent table corresponding to the candidate key

4. Restrict mode
Same no action, check foreign KEY constraints immediately

5. Set default mode
When a parent table has a change, the child table sets the foreign key column to a default value but InnoDB does not recognize

Reprint: http://blog.sina.com.cn/s/blog_91339bff0100ymc2.html

Cascade, NO ACTION, Restrict, set NULL in MySQL foreign key settings

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.