View Full Version : Simple relationships problem (easy for the experts)


PTRACER
02-18-2008, 04:09 AM
Hi there,

I'm creating a database for my computer repair business and it's going to store details on my customers, their computers, and any repairs I carry out on them.

I've created some tables, but I'm unable to create the relationships I require between the tables. Here's what I have:

http://img352.imageshack.us/img352/4724/helpbk3.jpg

I want to create a one-to-many relationship between the tables left to right, excluding the Engineer table, which I will talk about in a moment.

The idea is - One customer has "many" computers, one computer has "many" repairs, one repair has "many" problems. Each repair has just ONE engineer assigned to it, although the engineer will be assigned to many repairs.

I can link the Customer and Computer tables, via the CustomerID, but when I try to connect the other tables, I get the "Relationship Type: Indeterminate" error.

Can anyone help me with what fields I need in each table, and what relationships I need to achieve what I need?

Many thanks :)
Paul

tehNellie
02-18-2008, 05:05 AM
Your diagram suggests you've got composite primary keys defined (multiple columns combined into a single key/index) and I suspect this is causing the problem.
You only need the customerID, ComputerID, RepairID, problemID and engineerID respectively defined as the primary keys in your tables.

PTRACER
02-18-2008, 05:57 AM
Ah ha, thanks. It's all so obvious now...I was defining foreign keys as primary keys and that's where my problem was.