Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2007
    Posts
    2

    Red face Unanswered: Major Design Concept

    Hi,

    I am trying to develop an online application like ebay using rubyonrails.
    now my problem is how to design my database to support all these different product types each having different attributes without actually creating a table for each product type. also bear in mind that a product type may have sub category and also the sub category might have another sub category and so on.
    did ebay actually created a model and a table for each of the product type because that's not very efficient ?

    can some one please help me ?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    no idea what ebay does

    this might help you -- Categories and Subcategories
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2007
    Posts
    2

    Red face 1 solve one more to go

    Thanks , the posting answer my first problem of how to store my data as a tree , now how can i represent each leaf as a product with different attributes. for example one leaf might be a computer desktop with a desktop attributes and one might be shoe do i need a separate table for each of these products ?

    Thanks

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    no, one table for the products

    if a product can belong to more than one category or subcategory, then you would need a many-to-many relationship table as well

    but if a product is found under only one (sub)category, no matter at what level of the category hierarchy, then all you need is a category foreign key in the product 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
  •