









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Database Tables & Normalization:
and project name, employee assigned to it and soon. Each employee has employee number, employee name, classification etc. PROJ_NUM PROJ_NAME EMP_ NUM EMP_NAME JOB_CLASS CHG_HOUR HOURS Total_Charge 15 Evergreen 103 June E .Arbough Elect.Engineer 84.50 23.8 2011. 101 Swetha Database designer 105.00 19.4 2037 105 Lakshmi Database designer 105.00 35.7 3748. 106 Durga Programmer 35.75 12.6 450. 102 Ram Systems Analyst 96.75 20.8 2012. SubTotal 10259. 18 Amber wave 114 Harika Applications designer 48.10 25.6 (^) 1231. 118 Ganesh General support 18.36 45.3 831. 104 Sri Systems analyst 96.75 32.4 3134. 112 Hari DSS Analyst 45.95 44.0 2021. Sub Total 7219. 22 Rolling Tide 105 Sruthi Database designer 105.00 64.7 6793. 104 Raju Systems analyst 26.75 48.4 1294. 113 Ravi Application designer 48.10 23.6 (^) 1135. 111 Ramesh Clerical support 26.87 22.0 591. 106 Rao Programmer 35.75 12.8 457. Sub Total 10272. 25 Starflight 107 Rekha Programmer 35.75 24.6 879. 115 Rani System analyst 96.75 45.8 4431. 101 John Database designer 105.00 56.3` 5911. 114 Manikanta Applications designer 48.10 33.1 (^) 1592. 108 Nalini System analyst 96.75 23.6 2283. 118 James General secretary 18.36 30.5 559. 112 P J DSS Analyst 45.95 41.4 1902. Sub Total 17559. Total Amount 45310.
Deletion Anomalies: Suppose only one employee is associated with a project, if that employee leaves the company and the employee data are deleted, the project information will also be deleted. The above deficiency of table structure appears to work, the report gives different results depending on data. Normalization Process: The most common Normal forms and their characteristics are
1. First Normal Form (1NF): A Relation is said to be in first normal form if it is already in un normalized form and it has no repeating group. 2. Second Normal Form (2NF): A Relation is said to be in second normal form if it is already in first normal form and it has no partial dependency. 3. Third Normal Form (3NF): A Relation is said to be in third Normal form if it is already in second normal form and it has no transitive dependency. 4. Boyce code Normal Form(BCNF): A Relation is said to be in Boyce code Normal form if it is already in third normal form and every determinant is a candidate key. 5. Fourth Normal Form (4NF): A Relation is said to be in fourth normal form if it is already in Boyce code normal form and it has no multi valued dependency. 6. Fifth Normal Form(5NF): A Relation is said to be fifth normal form if it is already in fourth normal form and it has no loss less decompose. Eg: Normalization of construction company Report PROJ_NUM PROJ_NAME EMP_ NUM EMP_NAME JOB_CLASS CHG_HOUR HOURS Total_Charge 15 Evergreen 103 June E .Arbough Elect.Engineer 84.50 23.8 2011. 101 Swetha Database designer 105.00 19.4 2037 105 Lakshmi Database designer 105.00 35.7 3748. 106 Durga Programmer 35.75 12.6 450. 102 Ram Systems Analyst 96.75 20.8 2012. SubTotal 10259. 18 Amber wave 114 Harika Applications designer 48.10 25.6 (^) 1231. 118 Ganesh General support 18.36 45.3 831. 104 Sri Systems analyst 96.75 32.4 3134.
112 Hari DSS Analyst 45.95 44.0 2021. Sub Total 7219. 22 Rolling Tide 105 Sruthi Database designer 105.00 64.7 6793. 104 Raju Systems analyst 26.75 48.4 1294. 113 Ravi Application designer 48.10 23.6 (^) 1135. 111 Ramesh Clerical support 26.87 22.0 591. 106 Rao Programmer 35.75 12.8 457. Sub Total 10272. 25 Starflight 107 Rekha Programmer 35.75 24.6 879. 115 Rani System analyst 96.75 45.8 4431. 101 John Database designer 105.00 56.3` 5911. 114 Manikanta Applications designer 48.10 33.1 (^) 1592. 108 Nalini System analyst 96.75 23.6 2283. 118 James General secretary 18.36 30.5 559. 112 P J DSS Analyst 45.95 41.4 1902. Sub Total 17559. Total Amount 45310. The construction company report is represented in the form of relation. The relation named as CONSTRUCTION_COMPANY this is in un normalized form as shown below CONSTRUCTION_COMPANY(Proj_No,Proj_Name,(Emp_No,Emp_Name, Job_Classification, Charge_Per_Hour, Hours_ Billed)) ----- (1) The field Total charge, SUB TOTAL,GRAND TOTAL are not included in the relation because they are derived Attribute. First Normal Form: In Relation (1), the fields in the inner most set of parenthesis put together is known as repetating group. This will result in redundancy of data for the first two relations remove the repetating group. Hence the relation 1 is subdivided into two relations to remove repeating group PROJECT(proj_No,proj_Name) ----------> (2)
If one non prime attribute is determines the other non prime attribute then it is called as transitive dependency.. In Relation (2) there is only one non key field. This means that it has no transitive dependency. Hence Relation (2) can be treated as 3NF without any modification similarly in relation (4) there is only one non key field. This means that it has no transitive dependency. Hence relation (4) can be treated as 3Nf without any modification. In Relation(5) Charge_Per_Hour depends on Job_Classification this means that relation (5) has transitive dependency. The dependency diagram for the relation (5) is shown below. Diagram Hence relation (5) is sub divided into two relations. Relation (6) and relation (7) as shown below. Job(Job_Class, Charge_Per_Hour)-----------------(6) Emp(Emp_No,Emp_Name,Job_Class)------------(7) For a practical application it is sufficient to normalized up to either 2NF or 3NF Hence, the process of normalization is stopped and the final 3NF relations of construction company as shown below. Project(Proj_No,Proj_Name)---------------------------------(1) Assignment(Proj_No, Emp_No, Hours_Billed)------------(2)
Emp(Emp_No,Emp_Name,Job_Classification)------------(3) Job(Job_Classification, Charge_Per_Hour)----------------(4) Improving Design: How to improve the design of the database?
1. Evaluate primary key Assignment: Each time a new employee is entered into the employee table, A job class value must be entered. Unfortunately the data entry in the job class contains an error, that lead to referential integrity violation. For example entering “DB Designer”instead of Database Designer for the Job_class attribute in the Employee table will trigger such a violation. Therefore it is better to add job code attribute in job relation and employee relation. **Emp(Emp_No,Emp_Name,Job_Code) Job(Job_Code,Job_Classification,Charge_Per_Hour)
Assignment(Assign_No,Assign_Date,Proj_No,Emp_No,Assig_Hou r_Billed,Assign_Chg_Hour)
8. Evaluate using Derived Attribute: The derived attribute Assign_Charge is added to the Assignment relation and Assign_charge is updated by multiplying with Assign_Chg_Hour with the Assign_Hours_Billed. However the derived attribute Assign_Charge in the Assignment table makes easy to write reports or invoices. Boyce code Normal Form(BCNF): The BCNF can be violated only when the table contains more than one candidate key Candidate key: A key is said to be candidate key if the superkey that does not contain a subset of attributes i.e the key itself a superkey. These functional dependencies are shown below. A+B -------------C,D C ---------- B The table structure has no partial dependency and there is no transitive dependency. But the condition C ---B indicates that a nonkey attribute determines the part of key the primary key, causes the table to fail to meet the BCNF requirements. To convert the above table structure from 3NF to BCNF, first change the primary key to A+C. The dependency C---B means that C is in effect a superset of B. The Decomposition procedures to produce the results shown below.
Example for BCNF: Each Class_Code identifies a class iniquely. A student contains many classes and earning the grades respectively. A staff member can teach many classes. But each class is taught by only one staff member.
The above contains two sets of independent multi valued dependencies(i.e, Org_Code,Proj_Code).If volunteer-1 and Volunteer_2 two tables are implemented. The two tables contains null values. In volunteer-3 table has a primary key but it is composed of all attributes of the table. When you consider like this it produces many redundancies. To eliminate multi valued dependency by creating the assignment and service tables as shown below. In the Assignment table and service table does not contain multi valued dependency De Normalization: ( Under Construction..Ravindra)
Normalization is a very important in database design. Generally the higher normal forms the more the relational join operations required to produce a specific output. A successful design must also consider end user requirement for fast performance. Therefore occasionally we expected to de normalize some portions of the database design in order to meet performance require. De Normalization produces lower normal forms 3Nf will be converted to 2NF or 2Nf will be converted to 1NF. Eg: The need for de normalization due to generate evaluation of faculty report in which each row list the scores of obtaining during the last 4 semester taught. Faculty Evaluation Report: instruc tor Dep t. Se m- Mea n Se m- Mea n Se m- Mea n Se m- Mea n Last_se m avg We can generate easy above the report but the problem arises. The data are stored in a normalized table. In which each row represented a different score for a given faculty in a given semester. EVALDATA: ID Instructor DEPT. Mean Semistor It is some difficulty to generate faculty evaluation report the normalized table The other table FACHLST faculty history table contains the last four semester mean for each faculty .The faculty history table is a temporary table created from the evaldata as shown below.