I have one table that store values about recurrence of some events, for example, the event with id=1 occurs in Monday, Wednesday and Friday, and the event with id=2 occurs in Monday and Wednesday. So my table is like this:
id event_id day
1 1 Monday
2 1 Wednesday
3 1 Friday
4 2 Monday
5 2 Wednesday
My problem is that sometimes (not always) my script insert duplicate values in my database, so my table have twice the recurrence of event 1 and 2, like show the following table:
id event_id day
1 1 Monday
2 1 Wednesday
3 1 Friday
4 2 Monday
5 2 Wednesday
1 1 Monday
2 1 Wednesday
3 1 Friday
4 2 Monday
5 2 Wednesday
If I add a constraint UNIQUE in column event_id the event 1 only have the value Monday but I want that has the rest of values like Wednesday and Friday. How to add a constraint to solve this?
event_idanddaycombined instead of a unique constraint simply onevent_id