Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Computer Networking, Database Normalization, Routing, Schemes and Mind Maps of Software Engineering

Computer Networking, Database Normalization, Routing

Typology: Schemes and Mind Maps

2020/2021

Uploaded on 10/04/2021

berhane-kifle-1
berhane-kifle-1 🇺🇸

1 document

1 / 7

Toggle sidebar

Related documents


Partial preview of the text

Download Computer Networking, Database Normalization, Routing and more Schemes and Mind Maps Software Engineering in PDF only on Docsity! Chapter 12 Normalization ADRIENNE WATT Normalization should be part of the database design process. However, it is difficult to separate the normalization process from the ER modeling process so the two techniques should be used concurrently. Use an entity relation diagram (ERD) to provide the big picture, or macro view, of an organization’s data requirements and operations. This is created through an iterative process that involves identifying relevant entities, their attributes and their relationships. Normalization procedure focuses on characteristics of specific entities and represents the micro view of entities within the ERD. What Is Normalization? Normalization is the branch of relational theory that provides design insights. It is the process of determining how much redundancy exists in a table. The goals of normalization are to: Be able to characterize the level of redundancy in a relational schema Provide mechanisms for transforming schemas in order to remove redundancy Normalization theory draws heavily on the theory of functional dependencies. Normalization theory defines six normal forms (NF). Each normal form involves a set of dependency properties that a schema must satisfy and each normal form gives guarantees about the presence and/or absence of update anomalies. This means that higher normal forms have less redundancy, and as a result, fewer update problems. Normal Forms All the tables in any database can be in one of the normal forms we will discuss next. Ideally we only want minimal redundancy for PK to FK. Everything else should be derived from other tables. There are six normal forms, but we will only look at the first four, which are: First normal form (1NF) Second normal form (2NF) Third normal form (3NF) Boyce-Codd normal form (BCNF) BCNF is rarely used. First Normal Form (1NF) In the first normal form, only single values are permitted at the intersection of each row and column; hence, there are no repeating groups. To normalize a relation that contains a repeating group, remove the repeating group and form two new relations. The PK of the new relation is a combination of the PK of the original relation plus an attribute from the newly created relation for unique identification. Process for INF We will use the Student_Grade_Report table below, from a School database, as our example to explain the process for INF. Student_Grade_Report (StudentNo, StudentName, Major, CourseNo, CourseName, InstructorNo, InstructorName, InstructorLocation, Grade) In the Student Grade Report table, the repeating group is the course information. A student can take many courses. Remove the repeating group. In this case, it’s the course information for each student. Identify the PK for your new table. The PK must uniquely identify the attribute value (StudentNo and CourseNo). After removing all the attributes related to the course and student, you are left with the student course table (StudentCourse). The Student table (Student) is now in first normal form with the repeating group removed. The two new tables are shown below. Student (StudentNo, StudentName, Major) StudentCourse (StudentNo, CourseNo, CourseName, InstructorNo, InstructorName, InstructorLocation, Grade) How to update 1NF anomalies StudentCourse (StudentNo, CourseNo, CourseName, InstructorNo, InstructorName, InstructorLocation, Grade) To add a new course, we need a student. When course information needs to be updated, we may have inconsistencies. To delete a student, we might also delete critical information about a course. Second Normal Form (2NF) For the second normal form, the relation must first be in 1NF. The relation is automatically in 2NF if, and only if, the PK comprises a single attribute. If the relation has a composite PK, then each non-key attribute must be fully dependent on the entire PK and not on a subset of the PK (i.e., there must be no partial dependency or augmentation). Process for 2NF To move to 2NF, a table must first be in 1NF. The Student table is already in 2NF because it has a single-column PK. When examining the Student Course table, we see that not all the attributes are fully dependent on the PK; specifically, all course information. The only attribute that is fully dependent is grade. Identify the new table that contains the course information. Identify the PK for the new table. The three new tables are shown below. Student (StudentNo, StudentName, Major) d 111 Smith 114 Chan 320 Dobbs 671 White 803 Smith Adv_Maj table Advisor Major Smith Physics Chan Music Dobbs Math White Physics BCNF Example 2 Consider the following table (Client_Interview). ClientNo | InterviewDate | InterviewTime | StaffNo | RoomNo CR76 13-May-02 10.30 SG5 G101 CR56 13-May-02 12.00 SG5 G101 CR74 13-May-02 12.00 $G37 G102 CR56 AJuly-02 10.30 SG5 G102 FD1 —ClientNo, InterviewDate —> InterviewTime, StaffNo, RoomNo (PK) FD2 — staffNo, interviewDate, interviewTime —> clientNO (candidate key: CK) FD3 —roomN6o, interviewDate, interviewTime —> staffNo, clientNo (CK) FD4 — staffNo, interviewDate —> roomNo A relation is in BCNF if, and only if, every determinant is a candidate key. We need to create a table that incorporates the first three FDs (Client_Interview2 table) and another table (StaffRoom table) for the fourth FD. Client_Interview2 table ClientN | InterviewDate | InterViewTim | StaffNo ° e CR76 13-May-02 10.30 SG5 CR56 13-May-02 12.00 SG5 CR74 13-May-02 12.00 S$G37 CR56 AJuly-02 10.30 SG5 StaffRoom table StaffNo | InterviewDate | RoomNo SG5 13-May-02 G101 SG37 13-May-02 G102 SG5 1-July-02 G102 Normalization and Database Design During the normalization process of database design, make sure that proposed entities meet required normal form before table structures are created. Many real-world databases have been improperly designed or burdened with anomalies if improperly modified during the course of time. You may be asked to redesign and modify existing databases. This can be a large undertaking if the tables are not properly normalized. Complete chapters 11 and 12 before doing these exercises. . What is normalization? . When is a table in 1NF? . When is a table in 2NF? . When is a table in 3NF? Identify and discuss each of the indicated dependencies in the dependency diagram shown in Figure 12.2. | cl C2 C3 C4 Os | it | if Figure 12.2 For question 5, by A. Watt. . To keep track of students and courses, a new college uses the table structure in Figure 12.3. Draw the dependency diagram for this table. Attribute Name Sample Value Sample Value Sample Value StudentiD 1 2 3 StudentName John Smith Sandy Law Sue Rogers CourselD 2 2 3 CourseName Programming Level 1 | Programming Level _ Business Grade 75% 61% 81% CourseDate Jan S*, 2014 Jan 5, 2014 Jan 7, 2014 Figure 12.3 For question 6, by A. Watt. Using the dependency diagram you just drew, show the tables (in their third normal form) you would create to fix the problems you encountered. Draw the dependency diagram for the fixed table. An agency called Instant Cover supplies part-time/temporary staff to hotels in Scotland. Figure 12.4 lists the time spent by agency staff working at various hotels. The national insurance number (NIN) is unique for every member of staff. Use Figure 12.4 to answer questions (a) and (b). NIN ContractNo Hours eName hNo | hLoc 1135 C1024 16 Smith J. 1125 _| East Killbride 1057 C1024 24 Tlocine D. | 1125 | East Killbride 1068 C1025 28 White 1. H4 Glasgow 11335 C1025 15 Smith. [Ad __| Glasgow Figure 12.4 For question 8, by A. Watt. 1. This table is susceptible to update anomalies. Provide examples of insertion, deletion and update anomalies.
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved