Jump to content


Photo

relationships question


  • Please log in to reply
1 reply to this topic

#1 scottybwoy

scottybwoy
  • Members
  • PipPipPip
  • Advanced Member
  • 532 posts
  • LocationUK

Posted 24 August 2006 - 10:52 AM

Hi all,

Am working on a database project for my company and have pretty much everything set up.  However I am unsure whether a relationship is needed here.  Let me explain :

We have different types of customers and have a table  holding these that is related to the customers table.  When a customer makes a sale the cust ID is related to that sale carrying with it the customer type.  Then our products are given as a different price depending on their type.  Do I need a relationship between the Cutomers table, value type to the Product table, value type?

Does this make sense, the Sales table is connected to the Product table via Purchase Order key.

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 08 September 2006 - 11:42 PM

I'd set the relationship to the cust_type table type field. IF you print a price list, say, you need that one.

[pre]
cust_type    customer    sales        product      price
----------  ---------    --------      ---------    ---------
cust_type -+  cust_id -+  purch_ord  +- prod_id  --- prod_id
type_desc  |  name    |  prod_id  -+  prod_desc  +- cust_type
          +- type    +- cust_id                  |  price
          |                                      |
          +---------------------------------------+[/pre]
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users