Click here to Skip to main content
15,860,943 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: Simple composition - Your thoughts? Pin
Pete O'Hanlon15-May-12 1:57
subeditorPete O'Hanlon15-May-12 1:57 
GeneralRe: Simple composition - Your thoughts? Pin
Marc Clifton15-May-12 2:45
mvaMarc Clifton15-May-12 2:45 
GeneralRe: Simple composition - Your thoughts? Pin
Pete O'Hanlon15-May-12 3:25
subeditorPete O'Hanlon15-May-12 3:25 
GeneralRe: Simple composition - Your thoughts? Pin
Marc Clifton15-May-12 4:57
mvaMarc Clifton15-May-12 4:57 
GeneralRe: Simple composition - Your thoughts? Pin
Eytukan15-May-12 4:41
Eytukan15-May-12 4:41 
GeneralRe: Simple composition - Your thoughts? Pin
Marc Clifton15-May-12 5:06
mvaMarc Clifton15-May-12 5:06 
GeneralRe: Simple composition - Your thoughts? Pin
Eytukan15-May-12 18:32
Eytukan15-May-12 18:32 
QuestionDatabase Modeling - Conditional Relationships Pin
Leslie Sanford11-May-12 8:34
Leslie 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
R. Giskard Reventlov11-May-12 9:49
R. Giskard Reventlov11-May-12 9:49 
GeneralRe: Database Modeling - Conditional Relationships Pin
Leslie Sanford12-May-12 8:42
Leslie Sanford12-May-12 8:42 
AnswerRe: Database Modeling - Conditional Relationships Pin
Eddy Vluggen13-May-12 4:32
professionalEddy Vluggen13-May-12 4:32 
AnswerRe: Database Modeling - Conditional Relationships Pin
jschell14-May-12 9:24
jschell14-May-12 9:24 
Questionhow to design base class? Pin
wan.rui@qq.com10-May-12 17:09
wan.rui@qq.com10-May-12 17:09 
AnswerRe: how to design base class? Pin
walterhevedeich10-May-12 19:29
professionalwalterhevedeich10-May-12 19:29 
AnswerRe: how to design base class? Pin
Pete O'Hanlon10-May-12 21:52
subeditorPete O'Hanlon10-May-12 21:52 
GeneralRe: how to design base class? Pin
wan.rui@qq.com10-May-12 22:11
wan.rui@qq.com10-May-12 22:11 
GeneralRe: how to design base class? Pin
BobJanova15-May-12 0:48
BobJanova15-May-12 0:48 
GeneralRe: how to design base class? Pin
wan.rui@qq.com10-May-12 22:15
wan.rui@qq.com10-May-12 22:15 
GeneralRe: how to design base class? Pin
TorstenH.15-May-12 0:00
TorstenH.15-May-12 0:00 
QuestionActive Directory Pin
Franklin lloyd10-May-12 7:13
Franklin lloyd10-May-12 7:13 
AnswerRe: Active Directory Pin
jschell10-May-12 9:27
jschell10-May-12 9:27 
QuestionSingle web solution vs web app + mobile web app Pin
logicaldna8-May-12 22:56
logicaldna8-May-12 22:56 
AnswerRe: Single web solution vs web app + mobile web app Pin
Aniruddha Loya9-May-12 7:34
Aniruddha Loya9-May-12 7:34 
GeneralRe: Single web solution vs web app + mobile web app Pin
logicaldna9-May-12 17:22
logicaldna9-May-12 17:22 
SuggestionRe: Single web solution vs web app + mobile web app Pin
Aniruddha Loya10-May-12 10:50
Aniruddha 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.