SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    Boston
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Lookup table practices

    Which is a better method to practice when using lookup tables:

    Code:
    CREATE TABLE articleauthorlookup (
      article_id int(11) NOT NULL,
      person_id int(11) NOT NULL,
      PRIMARY KEY (article_id, person_id)
    );
    
    CREATE TABLE articlecategorylookup (
      category_id int(11) NOT NULL,
      article_id int(11) NOT NULL,
      PRIMARY KEY (category_id, article_id)
    );
    or...
    Code:
    CREATE TABLE articlelookup (
      article_id int(11) NOT NULL,
      category_id int(11) NOT NULL,
      person_id int(11) NOT NULL,
      PRIMARY KEY (article_id)
    );
    Thanks for your input!
    -Lewis

  2. #2
    Database Jedi MattR's Avatar
    Join Date
    Jan 2001
    Location
    buried in the database shell (Washington, DC)
    Posts
    1,107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's impossible to answer without explanation of the relationships between articles, persons, and categories. But, if it's "typical" then only the first solution would make any sense.


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
  •