SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member rodin7's Avatar
    Join Date
    Mar 2004
    Location
    ohio
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    not sure on this database design

    I am trying to make this content management site and I am a little unsure about the database design.

    I have one table called menu.
    Columns are
    id
    name
    description
    price
    cat

    I thought next would be menu_display
    columns are
    id_main
    main_menu
    special_menu
    dont_display

    this would allow for 2 different pages to display these items on but allow the data from them to be edited at the same content page.

    Next I figured menu_order
    columns are
    id_main
    here I am not sure because I need a way to sort the records so that if the newest item sould go first or just to move things around

    next menu_cat
    columns are
    and I figured some way to make different categories like salads, sandwiches, desserts etc. and just figured I would reference this number in the menu table.
    l
    Ok there is the background.

    My main question is how do I get the id_main columns to be the same as the id column from the menu table. I know i would use a join but does that mean that I will have to use a join on each query? Jut a little unsure on some of this stuff it is kind of new to me. Is this even the way to go with the tables or should this all be one or maybe two large tables.

    Thanks
    rodin

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    TX
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rodin7
    My main question is how do I get the id_main columns to be the same as the id column from the menu table. I know i would use a join but does that mean that I will have to use a join on each query? Jut a little unsure on some of this stuff it is kind of new to me. Is this even the way to go with the tables or should this all be one or maybe two large tables.

    rodin
    It really depends on the kinds of relations the entities share. About setting the id_main to = Menu.ID...@ the design level you can set up the ID in the menu table as a primary key, and the id_main in the other 2 tables as foriegn keys....but ya, when it gets to the query level, unless a design change permits just jumbling those 3 tables into 1 big one, you'll have to write a join everytime you want to access data from those 2 tables where id_main = Menu.ID is applicable. Wish I could be of more help, I really don't understand what the tables are holding, how they're related, etc...good luck.


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
  •