I created an unique index (id_contact_2
) over columns id_contact
, id_rubrique
and poste
as you can see in the screenshot below:
CREATE TABLE poste (
id_poste int NOT NULL AUTO_INCREMENT,
id_contact int NOT NULL,
id_rubrique int NOT NULL,
poste varchar(255) NULL,
CONSTRAINT PRIMARY KEY ( id_poste ),
CONSTRAINT UNIQUE ( id_contact, id_rubrique, poste )
);
CREATE INDEX id_contact ON poste ( id_contact );
Despite this unique index I can add the same value for more than one row.
Have you an idee of hos this can be possible?
Thanks