Question

In: Computer Science

Consider following table - Convert it to 3NF StdSSN StdCity StdClass OfferNo OffTerm OffYear EnrGrade CourseNo...

Consider following table - Convert it to 3NF

StdSSN

StdCity

StdClass

OfferNo

OffTerm

OffYear

EnrGrade

CourseNo

CrsDesc

S1

SEATTLE

JUN

O1

FALL

2006

3.5

C1

DB

S1

SEATTLE

JUN

O2

FALL

2006

3.3

C2

VB

S2

BOTHELL

JUN

O3

SPRING

2007

3.1

C3

OO

S2

BOTHELL

JUN

O2

FALL

2006

3.4

C2

VB

Solutions

Expert Solution

The given table is as follow :

StdSSN StdCity StdClass OfferNo OffTerm OffYear EnrGrade CourseNo CrsDesc
S1 SEATTLE JUN O1 FALL 2006 3.5 C1 DB
S1 SEATTLE JUN 02 FALL 2006 3.3 C2 VB
S2 BOTHELL JUN 03 SPRING 2007 3.1 C3 OO
S2 BOTHELL JUN 02 FALL 2006 3.4 C2 VB

You can clearly see that the above table is not normalized. We will see the problems that we face when a table is not normalized.

As you know if a table is not normalized then we face the following problems :

1. Update anomaly

2. Insert anomaly

3. Delete anomaly

So, we are going to convert the given table into 3rd normal form step by step. We will do this by using the following steps :

1. First we will check whether the given table is in 1st normal form or not if the table is not in the first normal form then we will convert it to the first normal form.

2. Second we will check whether the table which we will get from step 1 is in second normal form or not. If the table is not in the second normal form then we will convert it to the second normal form.

3. Final step, we will check whether the table which we will get from step 2 is in third normal form or not. If the table is not in the third normal form then we will convert it to the third normal form.

Let's begin with step 1 :

As you know, as per the rule of the first normal form, an attribute (column) of a table cannot hold multiple values. It should hold only atomic values. There can't be a group of columns representing similar information and there should be a key that uniquely identifies each row of the database table. So currently the given table is not in  1 NF. Why? because it has a group of columns representing similar information. Like (StdSSN , StdCity , StdClass ) , (OfferNo , OffTerm , Offyear) and (EnrGrade , CourseNO , CrsDesc). So, in order to achieve 1NF, we will divide the given table into three tables. So we will separate out the student information into another table. Similarly, we will separate out the course information into another table.

Student Table :

StdSSN StdCity StdClass
S1 SEATTLE JUN
S1 SEATTLE JUN
S2 BOTHELL JUN
S2 BOTHELL JUN

Offer table :

OfferNO OffTerm OffYear
01 FALL 2006
02 FALL 2006
03 SPRING 2007
02 FALL 2006

Course Table :

EnrGrade CourseNo CrsDesc
3.5 C1 DB
3.3 C2 VB
3.1 C3 OO
3.4 C2 VB


Step 2 :

In order to attain 2 NF, we should adhere to all the rules of 1NF plus all non-key columns should be dependent on the primary key.

-> In the Student table (StdSSN,StdCity) is the primary key and StdClass is the non-key attributes.

-> In Offer table (OfferNo, OffTerm) is a primary key and Offyear is a non-key attribute.

-> In the course table (EnrGrade, CourseNo) is a primary key and CrsDesc is a non-key attribute.

In order to check whether the above tables are in 2NF or not, we know that these tables are already in 1NF now just we have to check on things that are

Do the non-key columns describe what this primary key identifies? So if the answer is yes then that information should be in that table. If the answer is no then that information should not be in that table.

In the case of our tables, the non-key columns describe the primary key identifies. So the above tables are in 2NF.

Step 3 :

All the rules of 2NF pulse all the non-key columns should be NON-TRANSITIVLY depend on the primary key.

Actually , our table already is in 3NF too.

The final normalized form of our table is as follow.

Student Table :

StdSSN StdCity StdClass
S1 SEATTLE JUN
S1 SEATTLE JUN
S2 BOTHELL JUN
S2 BOTHELL JUN

Offer table :

OfferNO OffTerm OffYear
01 FALL 2006
02 FALL 2006
03 SPRING 2007
02 FALL 2006

Course Table :

EnrGrade CourseNo CrsDesc
3.5 C1 DB
3.3 C2 VB
3.1 C3 OO
3.4 C2 VB

Hope you got your answer!

if you still have any doubts please let me know in the comment box . Thanks! happy learning ;)


Related Solutions

Can a table that is already in 1NF be in 2NF and 3NF without making any...
Can a table that is already in 1NF be in 2NF and 3NF without making any changes? Explain and give one specific example of such table.
Normalize the following table into 1NF, 2NF and 3NF. Salesperson name Sales area Customer Number Customer...
Normalize the following table into 1NF, 2NF and 3NF. Salesperson name Sales area Customer Number Customer Name Warehouse Number Warehouse Location Sales Amount 76458 Hariharan East 17658 Asani 3 Govandi 13545 17645 Madhuram 6 Vasai 10600 17623 Sumit 6 Vasai 9700 76567 Dheerendra North 18190 Dhanram 4 Thane 11560 18173 Toshi 4 Thane 2590 18150 Ganesh 1 Kalyan 8090
For this question, normalize the table to 3NF and draw the relational schema showing cardinalities. UCLA...
For this question, normalize the table to 3NF and draw the relational schema showing cardinalities. UCLA just purchased several servers that are to be used for enterprise resource planning (ERP). The individual servers were purchased from different suppliers and these servers are running different software applications. UCLA also trained several of its staff to use these servers and each trained staff has an authentication code that allows the staff to use a specific software application on a specific server for...
Convert the following C program into the RISC-V assembly code. You should look up a table...
Convert the following C program into the RISC-V assembly code. You should look up a table to convert the lines manually and you can use "ecall" when appropriate (Don't make it too complicated than it needs to be): #include int main() { int x = 30, y = 17; printf("x * y = "); printf("%d\n", x*y); return 0; }
Problem: Convert the following binary number to decimal. 1. 110101.101 Problem: Convert the following decimal number...
Problem: Convert the following binary number to decimal. 1. 110101.101 Problem: Convert the following decimal number to fractional binary representation. 1. 103.5625
/ File: temperature.cxx // This program prints a table to convert numbers from one unit to...
/ File: temperature.cxx // This program prints a table to convert numbers from one unit to another. // The program illustrases some implementation techniques. #include // Provides cout #include // Provides setw function for setting output width #include // Provides EXIT_SUCCESS #include // Provides assert function using namespace std; // Allows all standard library items to be used double celsius_to_fahrenheit(double c) // Precondition: c is a Celsius temperature no less than absolute // zero (-273.16). // Postcondition: The return value...
Consider the following hypotheses and the sample data in the accompanying table. Answer the following questions...
Consider the following hypotheses and the sample data in the accompanying table. Answer the following questions using aα ​= 0.01. 8 9 10 8 7 8 10 9 11 6 5 9 9 10 10 H0​: μ=10 H1​: μ≠10 a. What conclusion should be​ drawn? b. Use technology to determine the​ p-value for this test. a. Determine the critical​ value(s). The critical​ value(s) is(are) . ​(Round to three decimal places as needed. Use a comma to separate answers as​ needed.)...
Consider the following table definitions create table node( node_id integer primary key, node_color varchar(10)); create table...
Consider the following table definitions create table node( node_id integer primary key, node_color varchar(10)); create table edge( edge_id integer primary key, origin_id integer, destination_id integer, foreign key (origin_id) references node(node_id), foreign key (destination_id) references node(node_id)); What is the result of the following query? select node_id, node_color, destination_id from node, edge; An inner join of the tables node and edge that lists origin node_id and node_color together with the node_id of the destination node for all those nodes that have outgoing...
Can someone explain how to use z table? How to convert and use it in Stats?
Can someone explain how to use z table? How to convert and use it in Stats?
I'm not clear with decompose to 3NF for database. Can someone explain to me with example...
I'm not clear with decompose to 3NF for database. Can someone explain to me with example please?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT