SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jun 2011
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Design of Product within SubProducts (MySQL)

    Hi,

    I have a Product, which consist of SubProducts of different types.

    For example,
    Product = SubProductA&SubProductB, or
    Product = SubProductA&SubProductA&SubProductB, etc.

    Each SubProduct has different structure, one SubProduct is dominant (there are much more records of that product, then others), but still it is possible to build some kind of 'universal' structure. But I don't like this idea:
    - mess with the names,
    - 'extra empty' rows,
    - bad understanding,
    - possible problems with adding new SubProducts, etc.

    I like the idea to separate each SubProduct to different tables, make SuperSubProduct table with ProductId and type of SubProduct. And table for each SubProduct with SuperSubProductId in it. So Product consists many SuperSubProduct, each is connected with SubProduct.

    The problem I see is with operations on DB in that case: for SELECT on current Product I need to join it with SubProducts tables somehow, but in 'universal' case I don't need to do joints. Also, if one SubProduct changed, I need to update 'update time' of Product, in 'universal' case I can take a MAX on one table.

    So it is seems 'slower' for me to separate. Even I like this idea. And speed is important, on other hand.

    What are your design suggestions for my case?

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,251
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by krom84 View Post
    For example,
    Product = SubProductA&SubProductB, or
    Product = SubProductA&SubProductA&SubProductB, etc.
    could you please give some actual examples
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


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
  •