GeekInterview.com
Series: Subject: Topic:
Question: 153 of 216

Explain normalization with examples?

Asked by: Beena | Member Since Sep-2005 | Asked on: Sep 19th, 2005

View all questions by Beena   View all answers by Beena

Showing Answers 1 - 5 of 5 Answers
p_kandukuri

Answered On : Sep 21st, 2005

View all answers by p_kandukuri

Normalization is a process of eleminating the redundancy and increasing the integrity.

Yes  1 User has rated as useful.
  
Login to rate this answer.
sarala

Answered On : Oct 27th, 2005

Go through the link:

http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html

  
Login to rate this answer.
vinoli

Answered On : Jul 11th, 2008

View all answers by vinoli

1NF: If any tables have a many to many relationship this must be broken out using a JOIN table. For example, Customers can have many Suppliers and Suppliers can supply to many Customers. This is known as a many to many relationship. You would need to create a JOIN table that would have a primary key made up of a foreign key reference to the Customers table and a foreign key reference to the suppliers table. Therefore the SuppliersPerCustomer table would be {SupplierID, CustomerID}. Now the Suppliers table will have a 1 to many relationship with the SuppliersPerCustomer table and the Customers table will also have a 1 to many relationship with the SuppliersPerCustomer table.

2NF: The database must meet all the requirements of the 1NF.

In addition, records should not depend on anything other than a table's primary key (a primary key can be made up of more than one field, only if absolutely necessary like in a JOIN table).

Example:

A customers address is needed by the Customers table, but also by the Orders, and Invoices tables. Instead of storing the customer's address as a separate entry in each of these tables, store it in one place, either in the Customers table or in a separate Addresses table.

3NF : The database must meet all the requirements of the 1NF and 2NF.

A relational table is in third normal form (3NF) if it is already in 2NF and every non-key column is non transitively dependent upon its primary key.

The Customer table contains information such as address, city, postcode imagine it also contained a column called shipping cost. The value of shipping cost changes in relation to which city the products are being delivered to, and therefore is not directly dependent on the customer even though the cost might not change per customer, but it is dependent on the city that the customer is in. Therefore we would need to create another separate table to hold the information about cities and shipping costs.


Yes  4 Users have rated as useful.
  
Login to rate this answer.
prabu

Answered On : Jul 13th, 2011

0NF

Code
  1. CUSTOMER ORDER (CustName, OrderNo, ProdNo, ProdDesc, Qty, CustAddress, DateOrdered)

1NF - remove multivalued attributes

Code
  1. CUSTOMER (CustName, CustAddress)
  2. CUSTOMER ORDER (CustName, OrderNo, ProdNo, ProdDesc, Qty, DateOrdered)
  3.  

2NF - remove partial dependencies

Code
  1. CUSTOMER (CustName, CustAddress)
  2. ORDER LINE (OrderNo, ProdNo, Qty, DateOrdered)
  3. PRODUCT (ProdNo, ProdDesc)
  4. ORDER (OrderNo, CustName)

3NF, BCNF As above Assumption: A customer can have multiple orders but an order can be for only 1 product. CustName and OrderNo preassigned as keys. 0NF

Code
  1. CUSTOMER ORDER (CustName, OrderNo, ProdNo, ProdDesc, Qty, CustAddress, DateOrdered)

1NF - remove multivalued dependencies

Code
  1. CUSTOMER (CustName, CustAddress)
  2. ORDER (CustName, OrderNo, ProdNo, ProdDesc, Qty, DateOrdered)

2NF - remove partial dependencies

Code
  1. CUSTOMER (CustName, CustAddress)
  2. CUSTOMER ORDER (CustName, OrderNo)
  3. ORDER (OrderNo, ProdNo, ProdDesc, Qty, DateOrdered)

3NF - remove transitive dependencies

Code
  1. CUSTOMER (CustName, CustAddress)
  2. CUSTOMER ORDER (CustName, OrderNo)
  3. ORDER (OrderNo, ProdNo, Qty, DateOrdered)
  4. PRODUCT (ProdNo, ProdDesc)

BCNF - resolve intrakey dependencies

Code
  1. CUSTOMER (CustName, CustAddress)
  2. CUSTOMER ORDER (CustName, OrderNo) - CustName becomes just a FOREIGN KEY
  3. ORDER (OrderNo, ProdNo, Qty, DateOrdered)
  4. PRODUCT (ProdNo, ProdDesc)

Yes  2 Users have rated as useful.
  
Login to rate this answer.
Rakesh

Answered On : Feb 7th, 2012

Normalization--To Reduce or to remove the redundancy in table we used Normalization and the normalization we can achieve by breaking of tables by this table is in Normalized.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.