Jump to content
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!

Edited by beans

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.

Edited by CroNiX

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.