If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Database Efficiency/Normalization help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-21-04, 14:15
gemster gemster is offline
Registered User
 
Join Date: Jun 2004
Posts: 2
Database Efficiency/Normalization help

I am trying to figure out the best way to put certain data into a database. Here is the situation:

There can be N number of projects at any time.
Each project has 5 phases.
For each of those 5 phases, M number of people are assigned to it.
Within each of those assignments, the time spent by the people is recorded.

Here's my proposed solution:

Project Table (with proj_id)
Person Table (with mem_id)
Phase Table (with phase_id)

And a Time spent Table which goes like this:
proj_id|| phase_id || mem_id || timespent
1 1 1 2
1 1 2 1
1 1 3 3
1 2 1 7
1 2 2 4
1 2 3 10
1 3 1 12
1 4 1 10
1 5 1 6
1 5 2 3
1 5 3 5
2 1 1 8
2 1 2 2

etc. As you can see, it can get very long if there are many members working on each phase of a project. Also, the project number is repeated over and over again. Would a better solution be to create a table for the allocation for each project, instead of having one big table? Or would the need to create a table be even less efficient? I'm looking for a) normalization and b) efficiency. Any advice would be appreciated.

Thanks,
Gemmy
Reply With Quote
  #2 (permalink)  
Old 06-21-04, 15:05
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
Did the instructor post any notes on the board, or mention any special requirements in class? There appear to be at least two small but significant points missing from your assignment.

-PatP
Reply With Quote
  #3 (permalink)  
Old 06-21-04, 15:43
gemster gemster is offline
Registered User
 
Join Date: Jun 2004
Posts: 2
It's actually just a project I'm helping out my friend with. What other information do you need?
Reply With Quote
  #4 (permalink)  
Old 06-23-04, 18:09
Cipherlad Cipherlad is offline
Registered User
 
Join Date: Dec 2003
Location: Inland Empire
Posts: 18
I don't think you need a Phase table, unless they're actually named phases, and even then you may not need it in the database that way, just create a constraint on the TimeSpent table to limit the entry possibilities.

Anyway, on to the meat of the matter. I can think of a couple of different ways for you to do this - but no, I would definitely not create a seperate table for each project. Yes, the TimeSpent table can get long, but databases are designed to handle large amounts of data, that's what they're for.

Depending on the requirements, you have four options for recording time:

1) Record a begin and start datetime for each person in the TimeSpent table, and calculate the total time spent when needed.

2) Record just the time spent for each period, calculating the total time spent when needed.

3) Keep a running total for each person on time spent during each phase.

4) Like #2, except at the end of each phase, you can do a summary on each member to delete unecessary rows.

And again, depending on which option you go with, you may need another table just to record the members that are assigned to each phase of the project (what if a member is assigned, but ends up spending no time on that phase).
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

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