0

I was a little miffed about the one-to-one relationship explanation on the 'I Think You Mean A Many To One' article.

In this instance for example, a product has one price because the business in question is small, niche, localized and supports only a single currency. Multiple prices per product make no sense in this case? I'm doubtful I'm grasping the concept correctly though, because everywhere I read says it will probably be a many-to-one even if you think it isn't?

Can somebody enlighten me please? :)

stakx - no longer contributing
  • 83,039
  • 20
  • 168
  • 268
Kiada
  • 679
  • 3
  • 15
  • 24
  • Where is the article as the one another edited in here http://www.jagregory.com/writings/i-think-you-mean-a-many-to-one-sir/ does not have price in it – mmmmmm Aug 20 '12 at 19:42
  • Ah, I understand the articles example (and that was the article I meant) - multiple customers can have the same address, a customer can have multiple addresses - but most bits of information I've read generally state that one-to-one relationships are the exception to the rule. I'm trying to figure out whether the above theoretical would indeed be a one-to-one or a one-to-many - and why. Trying to make it 'click' in my head I guess! – Kiada Aug 20 '12 at 19:48
  • @Mark thanks for editing out my correct edit! – Giovanni B Aug 21 '12 at 14:39
  • @Giovanni - the link you had does nopt have price in it at all and the question says "a product has one price" so cannot be the one – mmmmmm Aug 21 '12 at 14:44
  • @Mark well according to the comment above by the OP, "that was the article I meant" soooooo..... you're wrong. – Giovanni B Aug 21 '12 at 16:06
  • Then the question makes no sense as it asks about prices in this case and this case does not have prices – mmmmmm Aug 21 '12 at 19:52

2 Answers2

3

In an attempt to gain more reputation so that I can help in comments instead of an "answer" The one-to-many vs one-to-one is this

View a one-to-one as an extension of the table you are looking at.

Table B extends Table A. Meaning the information wasn't necessarily relevant enough to include in the table directly, but has a bidirectional relationship with each other. Basically meaning that As Table A, I am not dependent on the information in Table B, but Table B's information is very dependent on me. For the price example it means that Table A has a row related to a row in table B. So if you entering unique information in your Price table around every item to match in Table A, then this would be useful. As in say you had a description column about the item in your price table. Otherwise the price table in this case may just be irrelevant to have in the schema.

in a one-to-many relationship Table B usually has no reference back to Table A. So in the case of price, the items you are looking at do have a price, but prices aren't exclusive to items. So to better define, A number of things may have the price 9.99, but 9.99 only needs to exist in your pricing table once.

MattB
  • 585
  • 4
  • 17
0

I am not familiar with the article you refer to. However, price is a classic example of a slowly changing dimension. Price may be constant at any point in time, but over time, the price changes.

Such dimensions are typically implemented by having effective and end dates for the period in question.

Now, at a given point in time, a product probably does have only one price. Things that affect the price -- coupons, discounts for the purchaser, volume discounts, for example -- are not properties of the product. These are properties of the transaction.

That said, there may be circumstances where a fixed volume discount does not make sense. So, the "price" for a product might include volume, as well as time.

In any case, I would agree with you that price is not a good example of a 1-1 relationship. There are other factors such as time and volume that affect it.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786