convert many to many to one to many
-
Hi, Lets say I have 2 tables, DEALER and CARS whereby DEALER describes the details of the car dealer and CARS describes the details of the cars that are for sale in a car dealer. So this implies that DEALER has many details of car dealers and CARS has many details of cars. So am I right in suggesting this is a many to many relationship since more than 1 dealer can sell the same car? If so how do I convert my tables so that I only have a one to many relationship? Thanks for any information.
-
Hi, Lets say I have 2 tables, DEALER and CARS whereby DEALER describes the details of the car dealer and CARS describes the details of the cars that are for sale in a car dealer. So this implies that DEALER has many details of car dealers and CARS has many details of cars. So am I right in suggesting this is a many to many relationship since more than 1 dealer can sell the same car? If so how do I convert my tables so that I only have a one to many relationship? Thanks for any information.
The normal method is to use a link table. Here's an example: (Table dealer) DealerID (PK) DealerName (Table car) CarID (PK) CarName (Table DealerCars) DealerID (FK to Dealer.DealerID) CarID (FK to Car.CarID) Note that these are really terrible field names, but they serve to get the point across. The car and dealer tables have no direct relationships. Instead, the link table describes the relationship between the two.
Deja View - the feeling that you've seen this post before.
-
Hi, Lets say I have 2 tables, DEALER and CARS whereby DEALER describes the details of the car dealer and CARS describes the details of the cars that are for sale in a car dealer. So this implies that DEALER has many details of car dealers and CARS has many details of cars. So am I right in suggesting this is a many to many relationship since more than 1 dealer can sell the same car? If so how do I convert my tables so that I only have a one to many relationship? Thanks for any information.