Вы находитесь на странице: 1из 4

DATABASE DESIGN & NORMALIZATION: To design the database, collect the business requirements, identify the tables and

relationships, apply normalization and prepare the database diagrams etc. NORMALIZATION: It is the process of applying normal forms sequentially on the database design. Normal form is nothing but a rule. Normal forms: 1) First normal form 2) Second normal form 3) Third normal form 4) BCNF (Boyce Codd normal form) 5) Fourth normal form 6) Fifth normal form 7) Sixth normal form --| |--optional --|

Q) If it is not following first normal form? Ans) Table is not normalized. Q) If it is not following third normal form? Ans) Table is in 2nd normal form Sample Tables: Customers custno(p.k), custname, address Products proid(p.k), description, unit price, stock Orders orderno(p.k),prodid(p.k),quantity,price,order date,custno(f.k) |---------------| |- composite p.k.

1) First normal form : A table is said to be in first normal form if there are no multivalue columns. EX: In customers table, custname & address are multi value columns. So, this table is not in first normal form. To customize this table to first normal form, we need to convert multi value columns as single valued. Custname <-> firstname, lastname Address <-> H no, street, city, state Others tables products & orders are already in first normal form. 2) Second normal form: To say that a table is in second normal form, It should follow: first normal form Every non-key column should depend on complete primary key. No partial dependency. Cutomers, products tables satisfy above rules. Orders table doesnt satisfy. Because, we have composite p.k on orderno and prodid. But, orderdate depends only on orderno, not on prodid. So, depends on partial p.k. Partial dependency: A non key column depends on part of the composite primary key is called as partial dependency. To customize orders table, we need to split the table into two tables. | orderinfo orderno(pk), orderdate, custno(fk) orderproducts orderno(pk),prodid(pk),quantity, price

3) Third normal form: To say that, a table is in third normal form, it should follow second normal form no transitive dependency

Transitive dependency: - A non key column depending on other non key columns of same table is called as transitive dependency. EX: emp table empno(pk), ename, sal, deptno, deptname In this table deptname depends on deptno => transitive Dependency So, we have to customize the table into two tables. Emp table empno(pk), ename ,sal, deptnofk) Dept table deptno(pk), deptname Advantages of Normalization: normalization eliminates data redundancy ( occurs due to transitive dependency) normalization eliminates functional dependency problems like partial dependency, transitive dependency etc. faster index creation and sorting the data. Normalization improves the performance while performing insertion, deletion and updations into tables. Drawbacks of Normalization: normalization will degrade the performance while retrieving the data from multiple tables. Denormalization: The reverse process of normalization is known as denormalization

Advantages: Denormalization will improve the performance while retrieving the data from tables. Disadvantages: Denormalization redundancy. 4) BCNF: To say that a table is in BCNF, it should follow third normal form no overlap between candidate keys in the table introduces the problem called Data

candidate key: is collection of one/more columns used to identify a row. A table can have multiple candidate keys. EX: custmers table | custno(pk) ssn firstname lastname Hno Street City State Phoneno One of the candidate keys defined with P.K. constraint Other candidate keys generally defined with unique constraint. Unique constraint columns also called as Alternate Keys candidate keys | {custno} {ssn} {firstname,lastname,phoneno} {phoneno} x ---------------------| if phoneno column repeats again , then it is overlapping. Then doesnt satisfy BCNF

Note: Other normal forms are not used by companies.

Вам также может понравиться