Differences between “foreign key” and “constraint foreign key”

The first one assigns a user-defined name to the foreign key, the second one will assign a system-generated name to the foreign key.

User-defined foreign key names can be useful for subsequent statements like these:

ALTER TABLE XTable DROP    CONSTRAINT fk_idq;
ALTER TABLE XTable ENABLE  CONSTRAINT fk_idq;
ALTER TABLE XTable DISABLE CONSTRAINT fk_idq;

It’s harder to alter constraints with system-generated names, as you have to discover those names first.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)