Click here to Skip to main content
12,349,911 members (23,445 online)

Design and Architecture

 
GeneralRe: Simple composition - Your thoughts? Pin
Pete O'Hanlon15-May-12 1:57
protectorPete O'Hanlon15-May-12 1:57 
GeneralRe: Simple composition - Your thoughts? Pin
Marc Clifton15-May-12 2:45
protectorMarc Clifton15-May-12 2:45 
GeneralRe: Simple composition - Your thoughts? Pin
Pete O'Hanlon15-May-12 3:25
protectorPete O'Hanlon15-May-12 3:25 
GeneralRe: Simple composition - Your thoughts? Pin
Marc Clifton15-May-12 4:57
protectorMarc Clifton15-May-12 4:57 
GeneralRe: Simple composition - Your thoughts? Pin
VuNic15-May-12 4:41
memberVuNic15-May-12 4:41 
GeneralRe: Simple composition - Your thoughts? Pin
Marc Clifton15-May-12 5:06
protectorMarc Clifton15-May-12 5:06 
GeneralRe: Simple composition - Your thoughts? Pin
VuNic15-May-12 18:32
memberVuNic15-May-12 18:32 
QuestionDatabase Modeling - Conditional Relationships Pin
Leslie Sanford11-May-12 8:34
memberLeslie Sanford11-May-12 8:34 
This is probably a really basic database design question, but for some reason, I'm struggling with it.

The real world problem I'm trying to solve is a little too escoteric to describe, so I'll try to use a generic example that presents the same problem.

Say a store sells two kinds of cogs. Each type of cog is represented in the database with its own table (they have sufficiently different characteristics to warent different table schemas). A customer can buy both kinds of cogs, and we want to keep track of their purchases. So we have a sales table that's associates the customer with the cogs he/she buys. One foreign key points to the customer, and another foreign points to the cog.

What's got me stumped is that the foreign key that points to the cog could be associated with either type of cogs. How do we know which? Do we create an additional field that tells us the type of cog the customer purchased? That rings alarms for me in that it's surely unnormalized.

So instead do we have seperate sales table for each type of cog? But wouldn't this lead to an explosion of tables as we add more cogs types to our inventory?

This must seem like a beginner's question; I'm an old C++ audio programmer who's become a 'web developer', so occasionally I get stumped on DB basics. Any help is appreciated. Smile | :)
AnswerRe: Database Modeling - Conditional Relationships Pin
mark merrens11-May-12 9:49
membermark merrens11-May-12 9:49 
GeneralRe: Database Modeling - Conditional Relationships Pin
Leslie Sanford12-May-12 8:42
memberLeslie Sanford12-May-12 8:42 
AnswerRe: Database Modeling - Conditional Relationships Pin
Eddy Vluggen13-May-12 4:32
memberEddy Vluggen13-May-12 4:32 
AnswerRe: Database Modeling - Conditional Relationships Pin
jschell14-May-12 9:24
memberjschell14-May-12 9:24 
Questionhow to design base class? Pin
wan.rui@qq.com10-May-12 17:09
memberwan.rui@qq.com10-May-12 17:09 
AnswerRe: how to design base class? Pin
walterhevedeich10-May-12 19:29
memberwalterhevedeich10-May-12 19:29 
AnswerRe: how to design base class? Pin
Pete O'Hanlon10-May-12 21:52
protectorPete O'Hanlon10-May-12 21:52 
GeneralRe: how to design base class? Pin
wan.rui@qq.com10-May-12 22:11
memberwan.rui@qq.com10-May-12 22:11 
GeneralRe: how to design base class? Pin
BobJanova15-May-12 0:48
memberBobJanova15-May-12 0:48 
GeneralRe: how to design base class? Pin
wan.rui@qq.com10-May-12 22:15
memberwan.rui@qq.com10-May-12 22:15 
GeneralRe: how to design base class? Pin
TorstenH.15-May-12 0:00
memberTorstenH.15-May-12 0:00 
QuestionActive Directory Pin
Franklin lloyd10-May-12 7:13
memberFranklin lloyd10-May-12 7:13 
AnswerRe: Active Directory Pin
jschell10-May-12 9:27
memberjschell10-May-12 9:27 
QuestionSingle web solution vs web app + mobile web app Pin
logicaldna8-May-12 22:56
memberlogicaldna8-May-12 22:56 
AnswerRe: Single web solution vs web app + mobile web app Pin
Aniruddha Loya9-May-12 7:34
memberAniruddha Loya9-May-12 7:34 
GeneralRe: Single web solution vs web app + mobile web app Pin
logicaldna9-May-12 17:22
memberlogicaldna9-May-12 17:22 
SuggestionRe: Single web solution vs web app + mobile web app Pin
Aniruddha Loya10-May-12 10:50
memberAniruddha Loya10-May-12 10:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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
Web02 | 2.8.160621.1 | Last Updated 11 Jun 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid