I found some legacy code, which sets two almost identical constraints (UNIQUE
and PRIMARY KEY
) for the primary key field.
Here is the code sample:
CREATE TABLE foofoo (
id NUMERIC(9) NOT NULL ,
bar VARCHAR(40) NOT NULL,
CONSTRAINT PK_foofoo PRIMARY KEY (id),
CONSTRAINT UNIQUE_foofoo UNIQUE(id)
)
I think it's redundant to have these two set and PRIMARY KEY
would do the job.
Of course, I read what's the difference between these two constraints, but
what's the point of setting these two constraints for the same field?