Home mysql Differences between RESTRICT and NO ACTION statements in MySQL

Differences between RESTRICT and NO ACTION statements in MySQL

Author

Date

Category

What is the difference between RESTRICT and NO ACTION in mySQL (when using a foreign key)?


Answer 1, authority 100%

Originally in standard SQL:

  • NO ACTION – when deleting or updating records from the ancestor table
    links to child tables are ignored until the transaction is closed. Thus, within a single transaction, you can first update or delete records in the ancestor table, before making changes to the descendant tables. This only works with deferred keys.
  • RESTRICT – when trying to delete or update records from the ancestor table,
    an error will be thrown if there are related records in the descendant table.

But in MySQL the RESTRICT and NO ACTION options are identical.

https: //dev.mysql. com / doc / refman / 5.7 / en / create-table-foreign-keys.html


Answer 2

http: //dev.mysql. com / doc / refman / 5.6 / en / create-table-foreign-keys.html

NO ACTION: A keyword from standard SQL. In MySQL, equivalent to RESTRICT.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions