Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSimon Morris
16,250 PointsHow do i make a Database for a hosted menu manager for a restaurant?
Hi i plan on making a site that will host a menu manager for a restaurant, I'm struggling on how i should have the database, whether i should just do a user table for each account which then is related to all the other tables or should i create a database for each hosted account.
can anyone give me guidance on which is the best way to go about this?
2 Answers
Kevin Korte
28,149 PointsI'm not 100% sure what you're ultimate goal is, but just in general, if this is going to be one a web service, than I think I'd recommend you only have one database. Managing numerous databases will become a nightmare.
I'd set everything up with the tables you need inside of one database. Depending on all the information you'll need to store, you should only need a finite number of tables too. All of the data you collect should fit into these tables, and as your user count grows, so will your tables, but not the number of tables.
Increasing tables should be based on new types of data and features that rely on data, not the number of users or items you're trying to store.
Robyn Cantrell
7,603 PointsAs Kevin stated, the databses course is excellent. To maintain manageability, you will want to have one database for all with separate tables. One for users, one for menu items, one for allergens, etc. Having seperate table will reduce the likelihood of having orphan information floating around which in a small application is no big deal but as your app grows, could bring the system to a halt.
Hope this helped!
Simon Morris
16,250 PointsThanks Guys
Simon Morris
16,250 PointsSimon Morris
16,250 PointsI plan on making a web application that basically manages menus for restaurants and gives allergen and ingredient information, was just wondering whether i should do it on an account base or a completely separate database for each restaurant, however i think you have answered my question thank you Kevin!
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsOkay, yeah that sounds very manageable. I'm not a great DB guy by any mean, but I think my initial approach to this would be one database only, than store every new restaurant or user in a "user" table, and you could store the allergen information in an "allergen" table, and the ingredient information in an "information" table, and relate that data in those tables to the user or restaurant in this case.
Much like anything else, our goal here it to be DRY. (Don't Repeat Yourself). The more DRY your database can be, the leaner and faster your web application can be. Try not to store the same data twice, instead relate data.
If you haven't done the database courses here, I highly recommend it. Good luck!