Keeping boolean requirements in a database
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Keeping boolean requirements in a database

  1. #1
    Join Date
    Jun 2000
    Posts
    417
    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)

    Ad nauseum.

    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).

  2. #2
    Join Date
    Sep 2000
    Posts
    384
    You could use the check option...
    Radhakrishnan.M

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width