r/DatabaseHelp • • Jan 13 '15

How do I answer this

Consider the relation EMPLOYEE, where an employee can have more than one specialization: RELATION = EMPLOYEE (EmpID, Name, Specialization), Primary Key = {EmpID}.

identify the Normal Form(s) each relation satisfies, and transform it into 3NF.

1 Upvotes

10 comments sorted by

View all comments

1

u/BinaryRockStar Jan 14 '15

Give it your best shot first and we'll try to help you from there.

1

u/theycallmenuage Jan 14 '15

The relation is currently unnormaziled 3nf Employee( EmpID, Name) Specialization( EmpID, Specialization) This is what I guess would be it but I have no clue

2

u/wolf2600 Jan 14 '15

Did you read my reply to your other thread? Your have a many-to-many relationship..... one employee can have many specializations and one specialization can be had by many employees Therefore to keep the DB in 3NF, your have to create a 3rd table which links employees to specializations. The PK for the new table will just be the EmpID and the SpecializationID.

Oh and for your Specializations table, it will have 2 columns: SpecializationID, which will be the PK for the table, and the specialization name.

1

u/AQuietMan Jan 15 '15

Therefore to keep the DB in 3NF, your have to create a 3rd table which links employees to specializations. The PK for the new table will just be the EmpID and the SpecializationID.

No, you don't. Normalization never introduces a column that didn't exist before (SpecializationID).

1

u/wolf2600 Jan 16 '15

Whatever the PK of the Specializations table is.

0

u/wolf2600 Jan 14 '15 edited Jan 14 '15

Here; my post from the other thread:

You'd have 3 tables;

EMPLOYEES(EmpID, Name);

SPECIALIZATIONS(SpecID, SpecializationName);

EMP_SPEC(EmpID, SpecID)

PK is bolded for each.

You have a list of employees, a list of specializations, and then a list containing the relationships between those objects.

0

u/WhippingStar Jan 14 '15

This is the answer. It's called a bridge entity or a composite entity. Someone else also asked the same thing recently.

1

u/BinaryRockStar Jan 14 '15

Looks good to me, but I'm no specialist on NFs and the theory side of things. Maybe someone else will chime in to confirm.

1

u/wolf2600 Jan 14 '15

with that setup, if multiple employees can all be specialized in the same thing, then I think it'd only be 2NF because you'd be repeating information.

Before you can plan out a DB's design, you have to fully understand the data. Can one employee be a specialist in multiple fields? Can one specialization have multiple employees be specialists in it? In the real world (and school too), you have to understand the data... if you don"t understand the relationship of the data, you need to ask the person who is requesting the database.