SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 28 of 28
  1. #26
    SitePoint Guru risoknop's Avatar
    Join Date
    Feb 2008
    Location
    end($world)
    Posts
    834
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I didn't read the whole thread so maybe this has already been asked - why do you have two tables for categories and subcategories? Wouldn't it be easier to have just one table for categories and use either adjacency model or modified preorder tree traversal?

    About stores, if there is only a single store attached to every category and you are sure there won't be more stores per category in the future, just add a new column to the categories table with the store id (also make it a foreign key).

    Otherwise just use a many-to-many relationship table - probably better in terms of the future maintenance.

  2. #27
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by risoknop View Post
    ... just add a new column to the categories table with the store id
    actually, that would allow only one store per category

    you want it the other way around, the category id in the stores table, to allow one category per store

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #28
    SitePoint Guru risoknop's Avatar
    Join Date
    Feb 2008
    Location
    end($world)
    Posts
    834
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    actually, that would allow only one store per category

    you want it the other way around, the category id in the stores table, to allow one category per store

    Yeah thanks for correction.


Tags for this Thread

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
  •