SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Many-to-many relationship entity (was "Please help me")

    Hi everybody,

    Please help me. Following is my problem:

    When an Entity relates to another entity by relationship(n - n).
    For example, an Entity "A" has many Entities "B", and an Entity "B" has many
    Entities "A", so this relationship creates an Entity "C" between them.
    Besides, Entity "C" may have some properties.

    My question is that can Entity "C" play as primary key or
    foreign key for another Entity.

    Please help me soon and send to my email address: ngtthong@yahoo.com

    Thank in advance,

    Best wishes,
    Thong.

  2. #2
    SitePoint Guru asterix's Avatar
    Join Date
    Jun 2003
    Posts
    847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Answer: No.

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,336
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    entity A -- person

    entity B -- forum

    entity C -- post

    entity C's natural primary key is the composite of three columns -- the two foreign keys to A and B, as well as a datetime

    entity C can have a child relationship (related posts)

    so the answer is Yes
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    SitePoint Guru asterix's Avatar
    Join Date
    Jun 2003
    Posts
    847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When he said

    My question is that can Entity "C" play as primary key or
    foreign key for another Entity.
    I understood "another Entity" to be Entity D or E or F or something.


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
  •