firstdivision
MIS
I am working on building a reservation system and need a little help. Here's two links to my ERD and table layout (so far):
My question is, where does the forign key go in a supertype/subtype relationship?
My instincts tell me that it should go in the subtype (as it is in the tables image link above). But then adding a new record seems like a pain. I would have to add a record to the equipment table, then get the new equipment record's ID and use it when adding the second new record to one of the sub-type tables.
It would be easier to do it the other way around though, because the keys of the subtypes are serial numbers (so far anyway) and not autogenerated, it would be very easy to add the subtype IDs to the supertype table. But this feels "wrong".
I guess another option is to move all the properties to the subtype tables and have the supertype table only be a pointer to the correct subtype table (i.e. it would only have ID and SubTypeName for properties).
I hope I've explained my problem well enough. Please feel free to ask for any clarifications. I apreciate any help that can be provided.
Thanks,
Andrew
My question is, where does the forign key go in a supertype/subtype relationship?
My instincts tell me that it should go in the subtype (as it is in the tables image link above). But then adding a new record seems like a pain. I would have to add a record to the equipment table, then get the new equipment record's ID and use it when adding the second new record to one of the sub-type tables.
It would be easier to do it the other way around though, because the keys of the subtypes are serial numbers (so far anyway) and not autogenerated, it would be very easy to add the subtype IDs to the supertype table. But this feels "wrong".
I guess another option is to move all the properties to the subtype tables and have the supertype table only be a pointer to the correct subtype table (i.e. it would only have ID and SubTypeName for properties).
I hope I've explained my problem well enough. Please feel free to ask for any clarifications. I apreciate any help that can be provided.
Thanks,
Andrew