FOREIGN KEY ON UPDATE CASCADE
FOREIGN KEY ON UPDATE CASCADE is a SQL statement in the Constraints category. When the parent row's referenced key is updated, the same update is applied to child rows. The syntax is FOREIGN KEY (col) REFERENCES parent(id) ON UPDATE CASCADE;. It returns constraint with UPDATE CASCADE. A typical example: CREATE TABLE orders ( id INT PRIMARY KEY, user_id INT, FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ); -- If user.id changes from 5 to 50, order.user_id is auto-updated A close relative is PRIMARY KEY, which a column or set of columns that uniquely identifies each row. Only one PK per table. Automatically creates a unique index. A close relative is FOREIGN KEY, which ensures referential integrity: values in this column must exist in the referenced parent table. A close relative is UNIQUE, which ensures all values in a column (or combination) are unique across the table. Allows NULLs (multiple NULLs allowed).