Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL RESTRICT and NO ACTION

What's the difference in a MySQL FK between RESTRICT and NO ACTION? From the doc they seem exactly the same. Is this the case? If so, why have both?

like image 586
Erebus Avatar asked Apr 27 '11 20:04

Erebus


1 Answers

From MySQL Documentation: https://dev.mysql.com/doc/refman/8.0/en/create-table-foreign-keys.html

Some database systems have deferred checks, and NO ACTION is a deferred check. In MySQL, foreign key constraints are checked immediately, so NO ACTION is the same as RESTRICT.

like image 52
Anthony Accioly Avatar answered Sep 29 '22 23:09

Anthony Accioly