If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > database design questions

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-06-06, 14:22
fiXXXerMet fiXXXerMet is offline
Registered User
 
Join Date: May 2006
Posts: 2
database design questions

Hi,
I'm designing a website for a local Sub Shop and I need some help with the database layout.
There are ten categories of food: Subs, Footlongs, Sandwiches, Platters, Soups, Chineese Food, Eggrolls, Side Orders, Drink and Extras.
Each item in each category has a price, but some has more than one, for example:
Cheese Steak Sub: 6" price and 12" price.
Shrimp Fried Rice: Pint price and Quart price.
Drinks: Small Price, Medium Price, Large Price.
While Platters, Sandiches, Soups and some others have only one size/price.

How should I handle this? Throw everything into one table with a bunch of columns? I could use an example if that's not asking for too much.

Thanks,
Kyle
Reply With Quote
  #2 (permalink)  
Old 05-06-06, 15:51
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
make each item unique

i.e. 6" sub is not the same item as 12" sub

give these items separate primary keys

you can have a separate categories table, if you wish, and place a foreign key into the items table that references the category the item belongs to
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On