Jump to content

Archived

This topic is now archived and is closed to further replies.

beans

databse design question

Recommended Posts

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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.