(event.start BETWEEN week.start AND week.end) OR (week.start BETWEEN event.start AND event.end)
In simple words, either the week begins during the event, or the event begins during the week.
Let me check:
Event starts and ends during the week.
The event starts within a week.
The event starts before the week, but ends during the week
Week starts during the event.
The event starts during the week, but ends after the week.
The event starts within a week.
The event starts before the week, and also ends after the week
Week starts during the event.
Note that BETWEEN in the above expressions is used for brevity only.
The strict expression is as follows:
(event.start >= week.start AND event.start < week.end) OR (week.start >= event.start AND week.start < event.end)
provided that week.end is week.start + INTERVAL 7 DAY .
I. e. if you start the week with Sun, 0:00:00 , then it should end at next Sun, 0:00:00 (not Sat, 0:00:00 )
This expression looks more complex than commonly used:
event.start < week.end AND event.end > week.start
but the first is more efficient and convenient for indexing.
See these blog posts for performance comparison: