Database Setup Question

Results 1 to 2 of 2

Thread: Database Setup Question

  1. #1
    Join Date
    Dec 1969

    Default Database Setup Question

    I am setting up a MySQL database for our online store. Customers have a huge list of products they can buy from. How would you suggest I set the table up? Do I add a new row for each product the customer buys? It would obviously be very inefficient to have a column for each product. Any other ways? Also, would I set this up in just one table or would multiple tables be more efficent? Any suggestions would be appreciated. Thanks - Trevor Hartman

  2. #2
    Join Date
    Dec 1969

    Default RE: Database Setup Question

    Your would probably have the following tables:<BR><BR>Product(ProdID, Desc, UnitPrice)<BR><BR>Orders(OrderID, OrderDate, CustID, Comments)<BR>OrderLines(OrderID, OrderLine, Qty, UnitCost)<BR><BR>Customers(CustID, Name, Address, Town, State, Country, Zip)<BR><BR>Note that I have duplicated the UnitPrice in the OrderLines table. This is because the price of a product may change. So when the product is added to an order you capture the current price. You may also need to add fields for tax, and postage and handling.

Posting Permissions

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