12,349,911 members (23,445 online)

# Design and Architecture

 Re: Simple composition - Your thoughts? Pete O'Hanlon15-May-12 1:57 Pete O'Hanlon 15-May-12 1:57
 Re: Simple composition - Your thoughts? Marc Clifton15-May-12 2:45 Marc Clifton 15-May-12 2:45
 Re: Simple composition - Your thoughts? Pete O'Hanlon15-May-12 3:25 Pete O'Hanlon 15-May-12 3:25
 Re: Simple composition - Your thoughts? Marc Clifton15-May-12 4:57 Marc Clifton 15-May-12 4:57
 Re: Simple composition - Your thoughts? VuNic15-May-12 4:41 VuNic 15-May-12 4:41
 Re: Simple composition - Your thoughts? Marc Clifton15-May-12 5:06 Marc Clifton 15-May-12 5:06
 Re: Simple composition - Your thoughts? VuNic15-May-12 18:32 VuNic 15-May-12 18:32
 Database Modeling - Conditional Relationships Leslie Sanford11-May-12 8:34 Leslie Sanford 11-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.
 Re: Database Modeling - Conditional Relationships mark merrens11-May-12 9:49 mark merrens 11-May-12 9:49
 Re: Database Modeling - Conditional Relationships Leslie Sanford12-May-12 8:42 Leslie Sanford 12-May-12 8:42
 Re: Database Modeling - Conditional Relationships Eddy Vluggen13-May-12 4:32 Eddy Vluggen 13-May-12 4:32
 Re: Database Modeling - Conditional Relationships jschell14-May-12 9:24 jschell 14-May-12 9:24
 how to design base class? wan.rui@qq.com10-May-12 17:09 wan.rui@qq.com 10-May-12 17:09
 Re: how to design base class? walterhevedeich10-May-12 19:29 walterhevedeich 10-May-12 19:29
 Re: how to design base class? Pete O'Hanlon10-May-12 21:52 Pete O'Hanlon 10-May-12 21:52
 Re: how to design base class? wan.rui@qq.com10-May-12 22:11 wan.rui@qq.com 10-May-12 22:11
 Re: how to design base class? BobJanova15-May-12 0:48 BobJanova 15-May-12 0:48
 Re: how to design base class? wan.rui@qq.com10-May-12 22:15 wan.rui@qq.com 10-May-12 22:15
 Re: how to design base class? TorstenH.15-May-12 0:00 TorstenH. 15-May-12 0:00
 Active Directory Franklin lloyd10-May-12 7:13 Franklin lloyd 10-May-12 7:13
 Re: Active Directory jschell10-May-12 9:27 jschell 10-May-12 9:27
 Single web solution vs web app + mobile web app logicaldna8-May-12 22:56 logicaldna 8-May-12 22:56
 Re: Single web solution vs web app + mobile web app Aniruddha Loya9-May-12 7:34 Aniruddha Loya 9-May-12 7:34
 Re: Single web solution vs web app + mobile web app logicaldna9-May-12 17:22 logicaldna 9-May-12 17:22
 Re: Single web solution vs web app + mobile web app Aniruddha Loya10-May-12 10:50 Aniruddha Loya 10-May-12 10:50
 Last Visit: 31-Dec-99 18:00     Last Update: 25-Jun-16 16:01 Refresh « Prev1...56575859606162636465 Next »