This isn't for a real problem (yet) but I was starting to plan for something we're going to hit down the road.
Suppose I want to have a table that stores some kinds of conditions
user, condition, operator, value
joe, temperature, >, 90
bob, number of beers, <, 24
joe wants to be notified when the temperature is over 90, bob wants to be notified when he has less than 24 beers.
That's easy enough to keep track of. But suppose bob wanted to be notified when he has less than 24 beers, and the date of his party is tomorrow? Easy, just keep two records and watch both.
But if Bob wants two events with a logical AND, and Joe wants two events with a logical OR, it becomes a little more complicated, but is easily solved. Add another column to keep track, or another table, etc.
However how can you extend this to allow basically any logical combination?
A AND (B OR C)
A OR (B AND C)
A OR B
A AND C
A AND B AND (C OR D)
Is there a table structure that can extend to allow simple (one event, or two events) to be watched, and also allow any number of events to be watched using any logical combination? (limited to AND/OR, I wouldn't worry about XOR and the rest).