954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

expandable tables?

Hi,

I'm creating a web database as a bit of learning project.

In short it's going to a on-line menu viewer, where people can upload (type in) their food/takeaway food menus.

The problem I'm having is with the design and as each outlet can have a differing number of starters/mains/deserts etc..

inital thoughts were:

Menus
------
Menu_id
Menu_outlet
Starter1
Starter2
Starter3
Starter4
etc...

but what if an outlet has more that 4 starters?

Can anyone point me in the right direction please?

thanks jinx

jinx_uk_98
Newbie Poster
8 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

Do some research on normalization.

You might want to consider a simple setup where you have three tables.

Menu
MenuID (Primary Key)
MenuOutlet

Starter
StarterID (Primary Key)
StarterDescription

MenuStarter
MenuID (Primary Key - 1)
StarterID (Primary Key - 2)

This setup allows you to have as many starters as you want for each menu. The MenuStarter table would just use a concatenated primary key that could link those two tables. Hope this makes sense...

Again, some research on normalization would probably help.

bcasp
Light Poster
46 posts since Apr 2008
Reputation Points: 23
Solved Threads: 10
 

bcasp is pointing you in the right direction. As a further enlightenment, any time you ask yourself the question 'what if column X has more than Y choices' is an indication that that column should be broken out into a separate table.

trudge
Junior Poster
178 posts since Sep 2007
Reputation Points: 18
Solved Threads: 20
 

thats great guys, many thanks

jinx_uk_98
Newbie Poster
8 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You