Setting-up a good db structure

Results 1 to 2 of 2

Thread: Setting-up a good db structure

  1. #1
    cemtex Guest

    Default Setting-up a good db structure

    hi,<BR><BR>I have been asked to setup a shopping-cart-model site, its not really the same but it looks like it and i&#039;m really lost..<BR><BR>To give you an idea of what information it will hold i&#039;ll give you a short description:<BR><BR>Mainly there are several products in several categories, but a product has his own specific size, with his own specific price ..<BR>so this is what i thought :<BR><BR>tbl_products<BR>id (primary key)<BR>product_name<BR>product_rel (relationship with<BR>categorie_id (relationship with<BR><BR>tbl_product<BR>id (primary key)<BR>size<BR>price_us<BR>price_euro<BR><BR>tbl_ categories<BR>id (primary key)<BR>name<BR><BR>Okay linking the tbl_categories to the tbl_products gave me no problems but the other does. For example what query do i have to write to update a recordset that has several relationships.<BR><BR><BR>The main reason i post this question here is because i know i can do it without all the relation ships, but the db has to store 15000 or more records, so i thought it would be wise to maken good use of the build in capabilities of relational database.<BR><BR>If anyone could help i&#039;ll sure appreciate it very much, a link , email address or hint would do ..<BR><BR>thnx, <BR>cemtex<BR>

  2. #2
    Jeremy_D Guest

    Default RE: Setting-up a good db structure

    If you want to keep your design neatly conforming to 3rd Normal Form (which is generally considered to be a &#039;Good Thing&#039; in OLTP systems), you would only use one products table. Something like this:<BR><BR>tbl_product (product_id, name, category_id, size, price_us, price_euro)<BR>tbl_category (category_id, name)<BR><BR>I would seriously reconsider the two price columns though, as these are likely to change often depending on exchange rates. Even if your company uses a fixed exchange rate, the Euro price can easily be calculated from the Dollar price, like:<BR><BR>SELECT price_us, price_us / &#060;dollar/euro exchange rate&#062; AS price_euro<BR> FROM tbl_product<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts