Click here to Skip to main content

Design and Architecture

 
GeneralRe: Simple composition - Your thoughts? PinprotectorPete O'Hanlon15-May-12 4:25 
GeneralRe: Simple composition - Your thoughts? PinprotectorMarc Clifton15-May-12 5:57 
GeneralRe: Simple composition - Your thoughts? PinmemberVuNic15-May-12 5:41 
GeneralRe: Simple composition - Your thoughts? PinprotectorMarc Clifton15-May-12 6:06 
GeneralRe: Simple composition - Your thoughts? PinmemberVuNic15-May-12 19:32 
QuestionDatabase Modeling - Conditional Relationships PinmemberLeslie Sanford11-May-12 9:34 
AnswerRe: Database Modeling - Conditional Relationships Pinmembermark merrens11-May-12 10:49 
GeneralRe: Database Modeling - Conditional Relationships PinmemberLeslie Sanford12-May-12 9:42 
Thanks for your reply.
 
The solution I've settled on uses part of your answer. I have a 'base' table for all items. Then I have tables where needed for 'derived' sub types. These derived tables have a 'zero to one' relationship to the base table. The derived tables are a way of extending the properties of items in the base table.
 
So the items table could look like this:
 
+----+--------+-------+
| id | name   | price |
+----+--------+-------+
|  1 | wheel  | $1.23 |
+----+--------+-------+
|  2 | wire   | $1.50 |
+----+--------+-------+
 
Then if there are more than one kind of cogs, I can subclass them in 'derived' tables (like derived classes in object oriented programming).
 
wheels table
 
+----+--------+--------+
| id | cog_id | radius |
+----+--------+--------+
|  1 |    1   |   50"  |
+----+--------+--------+
 
wires table
 
+----+--------+--------+
| id | cog_id | length |
+----+--------+--------+
|  1 |    2   |   12"  |
+----+--------+--------+
 
I can then do joins to get back only wheels, and another join to get just wires.
 
I'm not sure if this is a common approach. I know the joins will cost more processing, but at least the schema makes sense to me.
AnswerRe: Database Modeling - Conditional Relationships PinmemberEddy Vluggen13-May-12 5:32 
AnswerRe: Database Modeling - Conditional Relationships Pinmemberjschell14-May-12 10:24 
Questionhow to design base class? Pinmemberwan.rui@qq.com10-May-12 18:09 
AnswerRe: how to design base class? Pinmemberwalterhevedeich10-May-12 20:29 
AnswerRe: how to design base class? PinprotectorPete O'Hanlon10-May-12 22:52 
GeneralRe: how to design base class? Pinmemberwan.rui@qq.com10-May-12 23:11 
GeneralRe: how to design base class? PinmemberBobJanova15-May-12 1:48 
GeneralRe: how to design base class? Pinmemberwan.rui@qq.com10-May-12 23:15 
GeneralRe: how to design base class? PinmemberTorstenH.15-May-12 1:00 
QuestionActive Directory PinmemberFranklin lloyd10-May-12 8:13 
AnswerRe: Active Directory Pinmemberjschell10-May-12 10:27 
QuestionSingle web solution vs web app + mobile web app Pinmemberlogicaldna8-May-12 23:56 
AnswerRe: Single web solution vs web app + mobile web app PinmemberAniruddha Loya9-May-12 8:34 
GeneralRe: Single web solution vs web app + mobile web app Pinmemberlogicaldna9-May-12 18:22 
SuggestionRe: Single web solution vs web app + mobile web app PinmemberAniruddha Loya10-May-12 11:50 
AnswerRe: Single web solution vs web app + mobile web app PinmemberRobCroll18-May-12 4:23 
QuestionDOC/View/Mainframe or does it matter? PinmemberBarryPearlman8-May-12 12:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.150129.1 | Last Updated 1 Feb 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid