Greetings list,

In an analysis I was sent, there is 1 table with a simple set of rules, e.g.
a_table (id, day, max_hours, min_hours, min_days, start_time, stop_time, max_attendants, ...)
No biggie there.

The problem is the user has to be able to define exceptions to those rules.
These exceptions will at one time be a quantitative value, i.e. a minimum or maximum number of attendants for a specific day, at other times it will concern a start_time that has to be met at least X times a month, etc.

I've more or less broken the table structure for this down to a couple of tables, like this:
table_case_quantity
table_case_actions
table_case_day
table_case_time
...
I 'concatenated' (foreign keys) related tables together into tables that specify a certain condition. At this time, there are 3 kinds of exception tables.
In other words, I've managed to normalize this, no problem there.

And now for the question :)
When looking up exceptions, I would like it if there is just 1 table 'exceptions', that looks like this: exceptions (id, exception_type, id_of_the_exception_in_the_table_of_that_exception_type), i.e. while keeping a foreign constraint.
In bashed up SQL syntax, I guess what I'd like to do is
FOREIGN KEY (exception_type) REFERENCES table_of_the_exception_type (<--- notice no id, just the table)
FOREIGN KEY (id_of_the_...) REFERENCES table_of_the_exception_type(id)

I'm thinking this has come up earlier, the question is how to do it.

The other option is querying the db for every exception-type-table, which I'd prefer not doing.


TIA,

Stijn Verholen


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to