sql - Records linked to any table? -
Hi Im with a little struggle and some ideas can be used ...
My The database has the following tables;
etc.
I would like to add "Notes" record to any type of record
Notes Table Notepell Intel (PK) Note: NITF Type Variant (3) NoteText Vartcha (100) Nodet DateTime
Where the note is a PK of a customer or Supplier etc. and Note type is that note is against the record of
Now I Realize that I can not add an FK Note that FK bin Many tables have to be present in all tables referring to.
How do you design above? Note: FK must be in any of the above tables
Cheers, Daniel
Accept this limitation that you can not teach the database about this foreign key constraint. So you have to do without integrity check (and cascading removal).
Your design is fine, it is easily extensible for extra tables, you can have multiple notes per unit, and the target tables do not even need to be aware of the note feature.
One advantage is that the separate table of table notes in this design is that you can easily run questions in all notes, for example "the most recent notes", or "any given information All the notes created by the user have been made "
that table is getting bigger for debate, dividing it into five tables will shrink the table into the fifth of its size, but this index-based access For someone Will not make the difference. Databases are prepared to handle large tables (as long as they are properly indexed).
Comments
Post a Comment