May 6, 2004 at 2:33 am
I have several entities for example: Order, Item, OrderITem, Country.... Each item can have many file path associated to it. so which is better?? 1-> For each entity, a table containing the file path and the entity it. Ex: FileID, OrderID, FilePath 2- or 1 table for all the entities in this way: FileID, FilePAth, EntityType (int: ex 1=Order, 2=Item..), RecordID Later on I need to select the file paths for a certain entity. Which approach is better? |
May 6, 2004 at 3:52 am
Personally, I'd always go for option one.
It worries me when I see names like EntityType, RecordType etc, since it inevitably leads to problems later.
The most common one is that certain entities require particular attribute information to be associated with them, while other entities require different attributes. You then end up with lots of attribute fields which are empty within each record.
Even if the above doesn't apply to your data as it stands now, going with option one will give you flexibility in the future as your requirements change.
May 6, 2004 at 5:48 pm
Sounds like 1 to me also but I am not sure I fully understand your final need. Can you give an overview of what you are dealing specific to the final issue?
May 7, 2004 at 12:57 am
well it is definite that no attributes other than filePath and fileID will be added. That's why i was wondering if I making too much table waste by making for each table a file table. Thus i was thinking what if i make one table with filePath and fileID and the type of entity and id. However, won't a select from 1 huge table take much time?? I need for example a query like this: Select filePath from tableName where orderID=3 |
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply