Database Design and normalization new requirements?

Reply

Join Date: Jul 2007
Posts: 24
Reputation: atal is an unknown quantity at this point 
Solved Threads: 0
atal atal is offline Offline
Newbie Poster

Database Design and normalization new requirements?

 
0
  #1
Aug 1st, 2007
Dear All,
I have a [project] table which includes Project name,Startdate,EndDate,Location.and [SubContractor] table which includes id,subContractor_name. each project has one SubContractor at time and one SubContractor may have many projects at time.

There are cases in which the first SubContractor leaves the project for some reasons and the company give the project to a second SubContractor.

My question is what would be the best way to Normalize or Design these tables. shall I have a middle table(Many-to-Many) or shall include these two fields in [Project] Table called SubCont1_ID,SubCont2_ID(both of them linked to the [SubContractor]table)
Please help me in this issue.

thank you in advance
the above question was answered by Robert but Now:

New Requirements has been added please clear me

The project is going to be issued to a Contractor and that Contractor is going to give the project to another Sub-Contractors there is going to be many subcontractors for one project and one subcontractor may have many projects.

Now how would i maintain the realtionship between Projects,Contractors and SubContractor, Is it going to be Projects-To-Contractor(Many-to-Many),and Projects-to-SubContractor(Many-to-many), Contractor-to-SubContrator(one-to-many) or would be different?

Thank you.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Database Design and normalization new requirements?

 
0
  #2
Sep 13th, 2007
why many-to-many, when some subContactor leaves the team, update it with the new one (ID) -- One-to-many.
if you want to keep track on the subContactors you should use many-to-many but keep in you mind to include period in the bridge table.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 59
Reputation: Temmu is an unknown quantity at this point 
Solved Threads: 4
Temmu's Avatar
Temmu Temmu is offline Offline
Junior Poster in Training

Re: Database Design and normalization new requirements?

 
0
  #3
Sep 13th, 2007
it is (almost) always a bad idea to have fields like item1, item2, item3... etc. as 1, it is not normal, and 2, you either have to few or too many columns.

ramymahrous above, offers a practical solution.

however, if you wish to keep track of who did what project, you'd have to have that 3rd table and safeguards in place to prevent inadvertent row deletion.
(o) Yes, I'd like to reboot my computer now.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 15
Reputation: xyte is an unknown quantity at this point 
Solved Threads: 0
xyte xyte is offline Offline
Newbie Poster

Re: Database Design and normalization new requirements?

 
0
  #4
Sep 20th, 2007
Originally Posted by atal View Post
Dear All,
I have a [project] table which includes Project name,Startdate,EndDate,Location.and [SubContractor] table which includes id,subContractor_name. each project has one SubContractor at time and one SubContractor may have many projects at time.

There are cases in which the first SubContractor leaves the project for some reasons and the company give the project to a second SubContractor.

My question is what would be the best way to Normalize or Design these tables. shall I have a middle table(Many-to-Many) or shall include these two fields in [Project] Table called SubCont1_ID,SubCont2_ID(both of them linked to the [SubContractor]table)
Please help me in this issue.

thank you in advance
the above question was answered by Robert but Now:

New Requirements has been added please clear me

The project is going to be issued to a Contractor and that Contractor is going to give the project to another Sub-Contractors there is going to be many subcontractors for one project and one subcontractor may have many projects.

Now how would i maintain the realtionship between Projects,Contractors and SubContractor, Is it going to be Projects-To-Contractor(Many-to-Many),and Projects-to-SubContractor(Many-to-many), Contractor-to-SubContrator(one-to-many) or would be different?

Thank you.
In your [Project] table, you should include ProjectID field so that you can monitor and assign a Project using ProjectID field. With regards to the [SubContractor] table, you need contact information for the SubContractor.

To make it normal, you need another table with the following information [ProjectID, SubContractorID, AssignedDate], making a many-to-many relationship. The AssignedDate inside this table will help you determine in the future when the project was assigned to a SubContractor.

Maybe you can also add two more tables so that you can keep track of all the tasks or jobs done on a certain project.

The first table wiill have the following information [TaskID, TaskDescription, DateTaskStarted, DateTaskEnded].

The other table will have the following information [ProjectID, TaskID, Status] --> Status would be [In-Progress, Completed, Not-Completed].

Question: Is your SubContractor a company or just a single individual? If it is a company, then surely you assign a person to a certain task.

I hope this one helps?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC