Sunday, February 19, 2012

Createing tables

I am trying to make a customer management database and need some help. I have two tables, customer and equipment. I want to have a unique value that is in both tables such as custid. I feel I need this to be able to search for all equipment belonging to a specific customer. Help please.Not sure what exactly you are asking, your approach of having a key that identified a customer and of using that the identify the equipment sounds like a fine one.|||

If an equipment can only belong to one customer this would be something like this:

Customers
=======

CustomeriD
(OtherColumns)

Equipment
=========
EquipmentD
(OtherColumns)
CustomerID

If one Equipment can belong to more than one customer you have a N-M relation:

Customers
=======
CustomeriD
(OtherColumns)

Equipment
=========
EquipmentD
(OtherColumns)

CustomerEquipment
================
EquipmentD
CustomeriD

HTH, jens Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment