beans Posted February 6, 2015 Share Posted February 6, 2015 (edited) I would like to design an application that allows users to sign up under a specific group, this group being the college they are from. I will be able to group people based on the college email address domain they sign up with. Once signed up they will be able to post topics in specific categories. Possibly something along the lines of "math" or "science". What would be a good way to set up a database for this? Would it be a bad idea to have all users in one database under a table called "users" with a field for their school name or would this be inneficient? I want to keep the school separate. I've been considering creating a database called users with a table for each of the schools. Users from certain schools would go into their respective table. Then I would have a database for each of the schools. The tables in each of these databases would correspond to the categories (math, science, etc.). Then each user made post would be a row in the corresponding school database and category table. Is this a bad idea? Is it bad to have lots of databases like this? Sorry if this is a noobish question but I'm relatively new to PHP and SQL. If anybody can suggest a good book / resource on the topic that would be great. Edit: Typo in the title but I can't change it Thanks! Edited February 6, 2015 by beans Quote Link to comment https://forums.phpfreaks.com/topic/294436-databse-design-question/ Share on other sites More sharing options...
CroNiX Posted February 6, 2015 Share Posted February 6, 2015 (edited) For what you gave, you'd have 2 tables. Users and Schools. Each user would belong to a school. Schools -id -name Users -id -first_name -last_name -username -password -email -school_id (references "id" in Schools table) You wouldn't store the school name in the Users table like you suggested. You'd store it in the Schools table, and reference that schools ID in the Users table. Edited February 6, 2015 by CroNiX Quote Link to comment https://forums.phpfreaks.com/topic/294436-databse-design-question/#findComment-1505116 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.