MySQL RESTRICT and NO ACTION

Erebus picture Erebus · Apr 27, 2011 · Viewed 48k times · Source

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?

Answer

Anthony Accioly picture Anthony Accioly · Apr 27, 2011

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.