RESTRICT is a safeguard keyword that can follow certain SQL statements to block the requested action if it would break referential integrity or invalidate dependent objects. In Standard SQL you can append RESTRICT to DROP statements (DROP TABLE|VIEW|SCHEMA … RESTRICT) or define it as a referential action in a FOREIGN KEY constraint (ON DELETE RESTRICT / ON UPDATE RESTRICT). Some dialects (DB2, Teradata, Informix) also accept RESTRICT with GRANT and REVOKE. When the database engine encounters RESTRICT it performs an immediate check for dependencies. If any child rows or objects rely on the target, the statement fails with an error rather than implicitly removing or changing the children. Unlike NO ACTION, which defers the check until the end of the statement, RESTRICT enforces the rule immediately, making the difference visible only inside complex transactions with deferred constraints. RESTRICT is the opposite of CASCADE, which automatically deletes or drops dependents. It provides a safe-by-default option for administrators who prefer to refactor dependencies manually.
CASCADE, NO ACTION, SET NULL, DROP TABLE, FOREIGN KEY, ON DELETE, ON UPDATE
SQL-92
RESTRICT stops a DROP, DELETE, or UPDATE statement if the target has dependent objects or rows, raising an error instead of removing data.
Use RESTRICT when you want to guarantee manual review before deleting or altering objects, preventing accidental data loss.
No. MySQL supports RESTRICT only as a referential action in foreign keys. DROP statements ignore the keyword.
RESTRICT performs the dependency check immediately. If the check fails, the statement is rolled back on the spot, even if the transaction remains open.