Re: Determine which child table a record belongs to

2008-01-29 Thread MZ_TRICSTA
One last question, guys. What if there is overlapping between the child tables, so that one instance has more than one "Type"? Craig L Russell wrote: > > This is a very common pattern in object-relational mapping. The column > that contains the type of crane is commonly referred to as a > d

Re: Determine which child table a record belongs to

2008-01-29 Thread MZ_TRICSTA
Thanks, Craig. Glad to know that this is common practice. I am in the process of implementing the solution as we speak. Craig L Russell wrote: > > This is a very common pattern in object-relational mapping. The column > that contains the type of crane is commonly referred to as a > discrimi

RE: Determine which child table a record belongs to

2008-01-29 Thread MZ_TRICSTA
Oh! I see. So I would need to add a "Type" column for all my parent tables. That would definitely make things easier, but I was hoping there was some SQL code that would magically give me the name of the child table. Still, this will work fine. Thanks for all your help. ~Tricsta Brad Moore wrote

RE: Determine which child table a record belongs to

2008-01-29 Thread MZ_TRICSTA
Thanks for your help, Brad. You are absolutely right. In this case, it doesn't make sense to have so many tables. I will make the changes you suggest. However, there are times when it does make sense to have this kind of hierarchical structure such as when the child tables have different fields, s

Determine which child table a record belongs to

2008-01-29 Thread MZ_TRICSTA
Hello All, I have the following tables in my database -: CREATE TABLE Crane ( PTTEquipmentID INTEGER NOT NULL, LiftingCapacity INTEGER NOT NULL, PRIMARY KEY (PTTEquipmentID), FOREIGN KEY (PTTEquipmentID) REFERENCES Equipment ON DELETE CASCADE ) CREATE TABLE RoughTerrainCrane ( PTTEquipmentID IN