Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. convert many to many to one to many

convert many to many to one to many

Scheduled Pinned Locked Moved Database
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    minkowski
    wrote on last edited by
    #1

    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.

    P S 2 Replies Last reply
    0
    • M minkowski

      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.

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • M minkowski

        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.

        S Offline
        S Offline
        SilimSayo
        wrote on last edited by
        #3

        When you break down a many-to-many relationship, you get two one-to-many relationships.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups