Results 1 to 4 of 4

Thread: newbie question

  1. #1
    Join Date
    Mar 2010
    Posts
    1

    Unanswered: newbie question

    Im trying to create a messaging service in java which uses a mysql database, i have 2 tables a person table and a message table which consist of:

    Table Person:
    PersonId
    Name

    Table Message:
    MessageId
    SourceId
    DestinationId
    Subject
    Message

    PersonId and MessageId are both primary keys SourceId and DestinationId will both be the id of a person so what kind of relationship would this be?

    Thanks in advanced.

  2. #2
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    foriegn key

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    one-to-many
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by thewebhosting View Post
    I suggest you to add 'PersonId' in Table 'MessageId' as Foreign Key.
    this is, like, about the third thread recently where you just don't get what's going on

    there already are ~two~ foreign keys to the person table in the message table
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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