Re: modeling either/or relationship...
Date: 1 Feb 2006 05:14:08 -0800
Message-ID: <1138799648.567004.182940_at_g43g2000cwa.googlegroups.com>
David Portas wrote:
> I think the different tables for 2- and 4-door vehicles was a poorly
> chosen example - useful only to illustrate how to extend the design.
> The number of doors is an attribute that all vehicles have in common so
> it more sensibly belongs in one place only - the Vehicles table.
>
> More generally, a union and joins should allow you to interrogate the
> data across all tables without resorting to procedural code in an
> external script.
>
> --
> David Portas
Thanks for your response. Simplifying it slightly, if I wanted to determine the total number of cars stored, the logical process might be:
- Obtain the table names for individual car types (SUV, SED, etc) from the master table (so I can determine where the cars are stored).
- Iterate through each of these type names counting the no. of rows in each of their corresponding sub table.
- Sum these counts.
But how to link these steps together into one statement is still eluding me, specifically the link between steps 1 and 2? Much appreciated if anyone can illuminate me. Many thanks, Jason. Received on Wed Feb 01 2006 - 14:14:08 CET