Description of MySQL InnoDB foreign key constraints

Source: Internet
Author: User

  • Cascade:
    Deletes or updates matched rows from the parent table and automatically deletes or updates the child table. On Delete cascade and on update cascade are both available. Between two tables, you should not define several on update cascade clauses that take actions in the same column of the parent or child table.
  • Set NULL:
    Delete or update rows from the parent table, and set the foreign key column in the child table to null. If the foreign key column does not specify the not null qualifier, this is unique and valid. The on Delete set null and on update set null clauses are supported.
  • No action:
    In ANSI SQL-92 standards, no action means this does not take action, that is, if there is a related foreign key value in the referenced table, attempts to delete or update key values are not allowed (Gruber, Master SQL, 2000: 181 ). InnoDB rejects the deletion or update operation on the parent table.
  • Restrict:
    The deletion or update of the parent table is denied. No action and restrict are both the same. delete on
    Delete or on update clause. (Some database systems have extended checks and no
    Action is an extension check. In MySQL, foreign key constraints are checked immediately, so no action and restrict are the same ).
  • Set default:
    This action is parsedProgramBut InnoDB rejects table definitions that contain the on Delete set default or on update set default clause.

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.