在mysql中触发,不允许某些列对的重复值

时间:2021-07-31 02:24:18

I have a table that looks like this: 在mysql中触发,不允许某些列对的重复值

我有一个看起来像这样的表:

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.

我想创建一个触发器,如果​​它们已作为一组值存在于数据库中,则不允许(Dita AND Ora AND Salla)的新输入。

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

更具体地说,如果Hane,12:00,621存在记录,请不要插入!

1 个解决方案

#1


2  

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

#1


2  

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