Вопрос

though after reading many articles online and I know this question have been asked quite a number of time. I'm still having problem identifying if a relation table is in 1NF, 2NF or 3NF

I've found an example as below

Students are involved in many project, and each project may have many employee working on it. The number of hours each Students works on a project, and the start date on which the students starts working on the project are saved in the following relational table.

StudProject (StudNum, ProjNum, HoursWork,
DateStartWorkOnProj)

I've tried breaking them into the following on my own which i'm not sure if i'm right

StudNum, ProjNum  --> HoursWork, DateStartWorkOnProj
         StudNum  --> ProNum
         ProNum   --> HoursWork, DateStartWorkOnProj

so it actually has a transitive dependency so in this case it should be under 2NF? or should it be 3NF since the hourswork and datestartworkonproj actually depends on StudNum and ProjNum..

Это было полезно?

Решение

if you have only these data for every project, i think this table is good.

StudProject (StudNum, ProjNum, HoursWork, DateStartWorkOnProj)

but if you want to store more information about project and work time, this table must be extended:

StudProject (StudNum, ProjNum)

projectWork (StudNum, ProjNum, workTime, startDateTime, endDateTime)

in the projectWork table, each record show a work day of student and difference of start, ned saved in workTime. sum(workTime) for each student in a project shows a total work of him.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top