SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru D-flyer's Avatar
    Join Date
    Jan 2001
    Location
    Near a computer
    Posts
    782
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is it "good db design"to have the same Id in two different tables??

    Hello,

    In my db design i got the following:
    tblParty
    partyID
    ..
    ..
    lID

    tblLocation
    locId
    ..
    ..
    ..
    pID

    tblOrganisation
    orgID
    ...
    ...
    ...
    pID

    tblPlaces
    placeID
    placeName
    stateID

    tblStates
    stateID
    statename

    Is it "good db design"to have the pID(=placeId) in two different tables??

    Any suggetions or comments are welcome.

    Greetz,
    D-flyer
    Last edited by D-flyer; Sep 5, 2001 at 04:32.

  2. #2
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if i remember my normalization rules, placing similar columns in 2 tables is good if you need to perform joins on those 2 tables.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  3. #3
    SitePoint Guru D-flyer's Avatar
    Join Date
    Jan 2001
    Location
    Near a computer
    Posts
    782
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry but my aim is not to join the 2 tables

    I just thought the location of a party can be different from the location of the organisation and by placing the place-names in a seperate table i can reuse some of those place-names.

    Btw: The table that join the whole db is the tblParty

  4. #4
    SitePoint Enthusiast
    Join Date
    Mar 2000
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well since the two PID:s have different meaning ( place for organisation and place for organisation ) then you have no redundant data - instead as you say by doing this you can reuse the placenames = good design!

    Another comment ( not because anyone would care ): It is considered correct to have a table name in singularis ( not tblPlaces but tblPlace )
    Stefan
    http://www.aspcode.net - articles on ASP/ASP.NET
    http://www.findfreefonts.net - jquery/ajax experiment site

  5. #5
    SitePoint Guru D-flyer's Avatar
    Join Date
    Jan 2001
    Location
    Near a computer
    Posts
    782
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx, stefan


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •