Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > General > Database Concepts & Design > DB Design Question - Want to create a DB similar to classmates/classreunion.com

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-10-03, 22:03
highvo1tage highvo1tage is offline
Registered User
 
Join Date: Jun 2003
Posts: 4
DB Design Question - Want to create a DB similar to classmates/classreunion.com

Hey everyone! I'm working on a project similar to classmates.com and classreunion.com and I'm having trouble working out the relationships between the tables. Here's what I've come up with so far.

Tables:

1. Users
-- Username
-- Password
-- Firstname
-- Lastname
-- Email

2. States
-- State ID
-- State

3. Cities
-- City ID
-- State
-- State ID

4. Schools
-- School ID
-- School Name
-- City ID

Here's the problem: I'm unable to resolve which table should have a column for graduation year, or if it should be a separate table altogether.
My understanding is that ONE user has ONE grad year, but MANY schools have MANY grad years. Also, ONE school has MANY students (users).

Knowing this, does it make sense to include a column for grad year under the Users table? Or would populating this grad year column under the users table create redundant data that would excessively increase the size of the DB?

Is it a better decision to make a separate table for graduation years which would look something like the following?

5. Grad Years
-- Grad year ID
-- Grad Year

Would this Grad Years table then be linked to the Users and Schools tables?

Or is there a better solution altogether?

I hope this all makes sense.....if not, write back and I'll try to clarify any questions you may about my questions.

Thanks for your help!

Shak
Reply With Quote
  #2 (permalink)  
Old 06-11-03, 09:01
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 4,874
Re: DB Design Question - Want to create a DB similar to classmates/classreunion.com

A user may have "graduated" from many schools - certainly will have attended more than one anyway, which is what counts. So you need an intersection entity for the m:m relationship:

User Schools
-- Username }
-- School ID } PK
-- From Year }
-- To Year

Adding From Year to the PK allows for people who left school A, went to school B, then back to school A - though not if it all happened in the same year.
__________________
Tony Andrews
http://tonyandrews.blogspot.com
Reply With Quote
  #3 (permalink)  
Old 06-11-03, 20:21
highvo1tage highvo1tage is offline
Registered User
 
Join Date: Jun 2003
Posts: 4
Thanks Tony! That possibility had never even occured to me! I'll try implementing it and see what I can come up with.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On