Lorik Berisha
Lorik Berisha

Reputation: 273

Trigger in mysql which doesnt allow duplicate values of certain pairs of columns

I have a table that looks like this: enter image description here

I want to create a trigger, which doesn't allow new inputs of (Dita AND Ora AND Salla) if they already exist in database as a group of values.

To be more specific, if a record exists with Hane, 12:00, 621. Do not allow it to be inserted!

Upvotes: 0

Views: 90

Answers (1)

Lorik Berisha
Lorik Berisha

Reputation: 273

ALTER TABLE fiekorari
ADD UNIQUE INDEX duplli (Dita, Ora, Salla);

Upvotes: 2

Related Questions