Noida Institute of Engineering and Technology,
Greater Noida
              Database Design &
                Normalization
  Unit: 3
Database Management System
         (New Code)
                                      Manu Sharma
      Course Details                    Assistant
     (B Tech 5th Sem)
                                       Professor
                                         (CSE)
               Brief Introduction of Faculty
                          member
Name:         Ms. Manu Sharma
Designation: Assistant Professor, CSE Department
Qualification: M.Tech From Shobhit University, Meerut
                B.Tech From UPTU, Lucknow
Teaching Experience: 8 Years
                           Manu Sharma            DBMS
 09/24/22                                                2
                                         Unit-1
                                                 Content
     •     Brief Introduction about me
     •     Evaluation Scheme
     •     Syllabus
     •     Introduction to the subject
     •     Branchwise Application
     •     Course Objective
     •     Course Outcomes
     •     Program Outcome
     •     Program Specific Outcomes
     •     CO-PO Mapping
     •     CO-PSO Mapping
     •     CO-PEO Mapping
     •     Previous Result Analysis
     •     Question Paper Template
     •     Unit Content with objective and Mapping with Cos
     •     Faculty Video Links, Youtube & NPTEL Video Links and Online Courses Details
     •     Daily Quiz
     •     Weekly Assignments
     •     Old university papers
     •     Sessional paper template
                                  Manu Sharma        DBMS
09/24/22                                                                                 3
                                                Unit-3
           Evaluation Scheme
09/24/22    Manu Sharma   DBMS   Unit-1   4
           Subject Syllabus
09/24/22   Manu Sharma   DBMS   Unit-1   5
           Subject Syllabus
09/24/22   Manu Sharma   DBMS   Unit-1   6
                            Course Objective
       Present an introduction to database management systems,
       with an emphasis on how to organize, maintain and retrieve -
       efficiently, and effectively - information from a DBMS.
       Differentiate between database system and file system.
       Knowledge of the different models like database modeling,
       relational, hierarchical and network models.
       Explain basic issues of transaction processing and
       concurrency control.
                       Manu Sharma        DBMS
09/24/22                                                         7
                                     Unit-3
                         Brief Introduction about
                                  Subject
   A database management system (DBMS) refers to the technology for creating and managing
   databases. DBMS is a software tool to organize (create, retrieve, update, and manage) data in
   a database.
   The main aim of a DBMS is to supply a way to store up and retrieve database information that
   is both convenient and efficient. By data, we mean known facts that can be recorded and that
   have embedded meaning. Usually, people use software such as DBASE IV or V, Microsoft
   ACCESS, or EXCEL to store data in the form of a database. A datum is a unit of data.
   Meaningful data combined to form information. Hence, information is interpreted data - data
   provided with semantics. MS. ACCESS is one of the most common examples of database
   management software.
                       Video link: https://www.youtube.com/watch?
             v=kBdlM6hNDAE&list=PLxCzCOWd7aiFAN6I8CuViBuCdJgiOkT2Y
                               Manu Sharma        DBMS
09/24/22                                                                                       8
                                             Unit-3
               Branch wise Applications
There are various application of DBMS in different fields like Railway
Reservation System, Library Management System, Banking,
Universities and colleges, Credit card transactions etc
09/24/22                 Manu Sharma        DBMS       Unit-1        9
                              Course Outcome
           S. NO.                 Course Outcomes                   Blooms’
                                                                    Taxonom
                                                                       y
                                                                      K3
                    Apply knowledge of database for real life
            .1
                    applications.
                    Apply query processing techniques         to    K3, K4
            .2      automate the real time problems           of
                    databases.
                                                                    K2, K3
                    Identify and solve the redundancy problem
            .3
                    in database tables using normalization
                    Understand the concepts of transactions,        K2, K4
                    their processing so they will familiar with
            .4      broad range of database management
                    issues including data integrity, security and
                    recovery.
09/24/22            Design, develop      and DBMS
                               Manu Sharma    implementUnit-1
                                                          a small   K3, K610
            .5
                      Program Outcomes (POs)
Engineering Graduates will be able to:
  1. Engineering knowledge: Apply the knowledge of
  mathematics, science, engineering fundamentals, and an
  engineering specialization to the solution of complex engineering
  problems.
  2. Problem analysis: Identify, formulate, review research
  literature, and analyze complex engineering problems reaching
  substantiated conclusions using first principles of mathematics,
  natural sciences, and engineering sciences.
  3. Design/development of solutions: Design solutions for
  complex engineering problems and design system components or
  processes that meet the specified needs with appropriate
  consideration for the public health and safety, and the cultural,
  societal, and environmental considerations.
  4. Conduct investigations of complex problems: Use
  research-based knowledge and research methods including design
  of  experiments, analysis
  09/24/22
                            and
                         Manu     interpretation
                              Sharma      DBMS   of data, and synthesis11
                                     Unit-3
  of the information to provide valid conclusions.
                     Program Outcomes (POs)
Contd..
 5. Modern tool usage: Create, select, and apply
 appropriate techniques, resources, and modern engineering
 and IT tools including prediction and modeling to complex
 engineering activities with an understanding of the
 limitations.
 6. The engineer and society: Apply reasoning informed
 by the contextual knowledge to assess societal, health,
 safety, legal and cultural issues and the consequent
 responsibilities relevant to the professional engineering
 practice.
 7. Environment and sustainability: Understand the
 impact of the professional engineering solutions in societal
 and environmental contexts, and demonstrate the
 knowledge of, and need for sustainable development.
 8. Ethics: Apply ethical
09/24/22                   principles
                     Manu Sharma
                                         and commit to
                                      DBMS
                                 Unit-3
                                                                12
                     Program Outcomes (POs)
Contd..
 9. Individual and team work: Function effectively as an
 individual, and as a member or leader in diverse teams, and in
 multidisciplinary settings.
 10. Communication: Communicate effectively on complex
 engineering activities with the engineering community and with
 society at large, such as, being able to comprehend and write
 effective reports and design documentation, make effective
 presentations, and give and receive clear instructions.
 11. Project management and finance: Demonstrate
 knowledge and understanding of the engineering and
 management principles and apply these to one’s own work, as a
 member and leader in a team, to manage projects and in
 multidisciplinary environments.
 12. Life-long learning: Recognize the need for, and have the
 preparation and ability
09/24/22
                         to Sharma
                       Manu  engage in    independent and life-long
                                        DBMS
                                                                      13
                                   Unit-3
 learning in the broadest context of technological change.
                 Program Specific Outcomes
 On successful completion of graduation degree the Computer Science
 & Engineering graduates will be able to:
       Work as a software developer, database administrator,
 PSO1: tester or networking engineer for providing solutions to the
       real world and industrial problems. 
       Apply core subjects of information technology related to
       data structure and algorithm, software engineering, web
 PSO2: technology, operating system, database and networking to
       solve complex IT problems. 
       Practice    multi-disciplinary and   modern     computing
 PSO3: techniques by lifelong learning to establish innovative
       career.
       Work in a team or individual to manage projects with
 PSO4: ethical concern to be a successful employee or employer in
       IT industry.
                      Manu Sharma        DBMS
09/24/22                                                         14
                                    Unit-3
             Program Educational Objectives
                        (PEOs)
PEO1: Able to apply sound knowledge in the field of information technology to fulfill the
needs of IT industry.
PEO2: Able to design innovative and interdisciplinary systems through latest digital
technologies.
PEO3: Able to inculcate professional ethics, team work and leadership for serving the
society.
PEO4: Able to inculcate lifelong learning in the field of computing for successful career
in organizations and R&D sectors.
  09/24/22                   Manu Sharma           DBMS        Unit-1             15
                     COs and POs Mapping
                                                             PO1               PO1
           PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9                          PO11
                                                             0                 2
.1
            2    2    3    3     3       2    3     2   2         2      2      3
.2
            3    3    3    2     2       2    2     2   2         2      2      3
.3
            2    3    3    3     3       2    2     2   2         2      2      2
.4
            2    3    2    2     2       2    2     2   2         3      2      2
.5
            2    3    2    2     2       3    2     2   3         2      2      2
     AVG
           2.20 2.80 2.60 2.40 2.40 2.20 2.20 2.00 2.20          2.20   2.00   2.40
09/24/22                   Manu Sharma       DBMS       Unit-1                       16
                 COs and PSOs Mapping
                                  Program Specific Outcomes
                     PSO1            PSO2       PSO3          PSO4
           .1
                       3              1           3            1
           .2
                       3              1           3            1
           .3
                       3              1           3            1
           .4
                       3              1           3            1
           .5
                       3              1           3            1
           AVG
                     3.00            1.00        3.00         1.00
09/24/22            Manu Sharma      DBMS       Unit-1               17
                 COs and PEOs Mapping
                                   Program Specific Outcomes
                      PEO1            PEO2       PEO3          PEO4
           .1
                        3               1          3            1
           .2
                        3               1          3            1
           .3
                        3               1          3            1
           .4
                        3               1          3            1
           .5
                        3               1          3            1
           AVG
                      3.00             1.00       3.00         1.00
                   Manu Sharma        DBMS
09/24/22                                                              18
                                 Unit-3
                Result Analysis
09/24/22   Manu Sharma   DBMS   Unit-1   19
           Question Paper Template
               Manu Sharma            DBMS
09/24/22                                     20
                             Unit-1
           Question Paper Template
09/24/22      Manu Sharma   DBMS   Unit-1   21
                     Syllabus of Unit 3
Database Design & Normalization:
Functional dependencies, normal forms, first, second, third
  normal forms, BCNF, inclusion dependence, loss less join
  decompositions, normalization using FD, MVD, and JDs,
  alternative approaches to database design.
Book References:
1. Korth, Silbertz, Sudarshan,” Database Concepts”, McGraw Hill
2. Date C J, “An Introduction to Database Systems”, Addision
   Wesley
3. Elmasri, Navathe, “ Fundamentals of Database Systems”,
   Addision Wesley
4.Bipin C. Desai, “ An Introduction to Database Systems”, Galgotia
   Publications
09/24/22               Manu Sharma   DBMS     Unit-3             22
                             Unit Objective
    Students will be able to learn Functional dependency
     that is a relationship that exists when one attribute
     uniquely determines another attribute.
    Normalization to minimizing redundancy from a relation
     or set of relations. It deals with insertion, deletion, and
     update anomalies. So, it helps to minimize the
     redundancy in relations that are used to eliminate or
     reduce redundancy in database tables to create a good
     database.
                      Manu Sharma        DBMS
09/24/22                                                           23
                                    Unit-3
                        Prerequisite and Recap
• A good background in DBMS fundamentals is required.
• Students should be comfortable with the relational
  model, SQL, and the basic functions of database
  systems.
• The proper understanding of data structures and
  algorithms will help you to understand the DBMS
  quickly.
• Recap
      In last unit we studied about
          • Relational Data Model
              – Relational Algebra Query
              – Relational Calculus Query
           • Structured Query Language
                        Manu Sharma        DBMS
09/24/22                                           24
                                      Unit-3
                             Content
                          Unit-3
•Functional Dependencies
•Normal forms
   – 1NF
   – 2NF
   – 3NF
   – BCNF
•Loss less join decompositions
•Multivalued dependencies
•Join dependencies
09/24/22            Manu Sharma    DBMS   Unit-3   25
                Topic 1 objective
 Informal Design Guidelines for Relational
  Databases
  1.1Semantics of the Relation Attributes
  1.2 Redundant Information in Tuples and Update
  Anomalies
  1.3 Null Values in Tuples
  1.4 Spurious Tuples
 Summary of Informal database Design
09/24/22          Manu Sharma   DBMS   Unit-3   26
               1.1Normalization (CO3)
• Normalization is the process of structuring and handling the
  relationship between data to minimize redundancy in the
  relational table.
• It avoids the unnecessary anomalies from the database like
  insertion, updation and deletion.
• It helps to divide large database tables into smaller tables and
  make a relationship between them.
• It can remove the redundant data and ease to add, manipulate
  or delete table fields.
09/24/22                Manu Sharma   DBMS     Unit-3          27
               1.1Normalization (CO3)
• A normalization defines rules for the relational table as to
  whether it satisfies the normal form.
• A normal form is a process that evaluates each relation
  against defined criteria and removes the multi-valued, joins,
  functional and trivial dependency from a relation.
• If any data is updated, deleted or inserted, it does not cause
  any problem for database tables and help to improve the
  relational table' integrity and efficiency.
09/24/22                Manu Sharma   DBMS    Unit-3         28
           1.1Purpose of Normalization
                     (CO3)
• It is used to remove the duplicate data and database anomalies
  from the relational table.
• Normalization helps to reduce redundancy and complexity by
  examining new data types used in the table.
• It is helpful to divide the large database table into smaller
  tables and link them using relationship.
• It avoids duplicate data or no repeating groups into a table.
• It reduces the chances for anomalies to occur in a database.
09/24/22                Manu Sharma   DBMS    Unit-3          29
                      1.1Anomalies (CO3)
• Student Table:
StudReg. CourseID StudName           Address             Course
205 6204 James           Los Angeles                     Economics
205   6247 James          Los Angeles                     Economics
224 6247 TrentBolt       New York                        Mathematics
230 6204   Ritchie Rich Egypt                             Computer
230   6208  Ritchie Rich    Egypt                          Accounts
 There are two students in the above table, 'James' and 'Ritchie Rich', whose
 records are repetitive when we enter a new CourseID. Hence it repeats the
 studRegistration, StudName and address attributes.
09/24/22                     Manu Sharma   DBMS        Unit-3             30
                        1.1Anomalies (CO3)
• Insert Anomaly: An insert anomaly occurs in the relational database when
  some attributes or data items are to be inserted into the database without
  existence of other attributes. For example, In the Student table, if we want
  to insert a new courseID, we need to wait until the student enrolled in a
  course. In this way, it is difficult to insert new record in the table. Hence, it
  is called insertion anomalies.
• Update Anomalies: The anomaly occurs when duplicate data is updated
  only in one place and not in all instances. Hence, it makes our data or table
  inconsistent state. For example, suppose there is a student 'James' who
  belongs to Student table. If we want to update the course in the Student, we
  need to update the same in the course table; otherwise, the data can
  be inconsistent. And it reflects the changes in a table with updated values
  where some of them will not.
09/24/22                       Manu Sharma     DBMS        Unit-3               31
                  1.1Anomalies (CO3)
• Delete Anomalies: An anomaly occurs in a database table
  when some records are lost or deleted from the database table
  due to the deletion of other records. For example, if we want
  to remove Trent Bolt from the Student table, it also removes
  his address, course and other details from the Student table.
  Therefore, we can say that deleting some attributes can
  remove other attributes of the database table.
• So, we need to avoid these types of anomalies from the tables
  and maintain the integrity, accuracy of the database table.
  Therefore, we use the normalization concept in the database
  management system.
09/24/22               Manu Sharma   DBMS    Unit-3         32
           A simplified COMPANY relational
               database schema (CO3)
09/24/22          Manu Sharma   DBMS   Unit-3   33
           Examples of Violating Guideline 1
                        (CO3)
 Attributes of different entities should not be mixed in
  the same relation
 Informally, each tuple in a relation should represent
  one entity or relationship instance.
 Design a schema that can be explained easily relation
  by relation. The semantics of attributes should be
  easy to interpret.
09/24/22             Manu Sharma   DBMS   Unit-3       34
           1.2 Redundant Information in Tuples and
                  Update Anomalies (CO3)
1.2. A      :- Redundant Information in Tuples
One goal of schema design is to minimize the
  storage space used by the base relations (and
  hence    the    corresponding   files). Grouping
  attributes into relation schemas has a significant
  effect on storage space.
09/24/22             Manu Sharma   DBMS   Unit-3   35
             Redundant Information in Tuples
                         (CO3)
 Mixing attributes of multiple entities may cause
  problems.
1. Information is stored redundantly wasting
  storage, compare the space used by the two base
  relations EMPLOYEE and DEPARTMENT in with that
  for an EMP_DEPT base relation . (Wastage of Space
  by Emp_Dept)
  09/24/22           Manu Sharma   DBMS   Unit-3   36
           1.2 A. Redundant Information in Tuples
                          (CO3)
Example :- Good database Design Approach
09/24/22            Manu Sharma   DBMS   Unit-3   37
             Problems with update
               anomalies (CO3)
Update Anomaly:- An update anomaly is a data
  inconsistency that results from data redundancy and
  a partial update.
Consider the relation:
Update Anomaly: Changing the name of project number 1
  from “ProductX” to “ProductABC” may cause this update
  to be made for all n employees working on project 1.
09/24/22            Manu Sharma   DBMS   Unit-3      38
           Problems with update anomalies
                       (CO3)
Problems with update anomalies
      – Insertion anomalies
      – Deletion anomalies
      – Modification anomalies
09/24/22              Manu Sharma   DBMS   Unit-3   39
                       Insertion
           anomalies (CO3)
1. To insert a new employee tuple into EMP_DEPT, we
  must include either the attribute values for the
  department that the employee works for, or NULLs (if
  the employee does not work for a department as yet).
Example
2. But, It is difficult to insert a new department that has
  no employees as yet in the EMP_DEPT relation. The
  only way to do this is to place NULL values in the
  attributes for employee. This violates the entity
  integrity for EMP_DEPT because its primary key Ssn
  cannot be null.
09/24/22             Manu Sharma   DBMS   Unit-3        40
                Deletion Anomalies (CO3)
• The problem of deletion anomalies is related to the second
  insertion anomaly situation just discussed. If we delete from
  table EMP_DEPT an employee tuple that happens to
  represent the last employee working for a particular
  department, the information concerning that department is
  lost accidentally from the database.
Example :- Emp_Dept
• When a department is deleted, it will result in deleting all the
  employees who work only on that project. Alternately, if an
  employee is the sole employee on a department, deleting that
  employee would result in deleting the corresponding project.
  09/24/22                Manu Sharma   DBMS    Unit-3         41
                Modification anomalies
           (CO3)
In EMP_DEPT, if we change the value of one of the
   attributes of a particular department—say, the
   manager of department 5—we must update the tuples
   of all employees who work in that department;
 otherwise, the database will become inconsistent. If we
   fail to update some tuples, the same department will
   be shown to have two different values for manager in
   different employee tuples, which would be wrong.
Example :- Emp_Dept
09/24/22             Manu Sharma   DBMS   Unit-3      42
           Guideline to Redundant Information in Tuples and
                        Update Anomalies(CO3)
• It is easy to see that these three anomalies are
  undesirable and cause difficulties to maintain
  consistency of data as well as require
  unnecessary updates that can be avoided; hence,
  we can state the next guideline as follows:-
Guideline 2. Design the base relation schemas so
 that no insertion, deletion, or modification
 anomalies are present in the relations. If any
 anomalies are present, note them clearly and
 make sure that the programs that update the
 database will operate correctly.
09/24/22                Manu Sharma   DBMS   Unit-3    43
           No Anomalies & No redundancy
                   Exists (CO3)
09/24/22          Manu Sharma   DBMS   Unit-3   44
           1.3 Null Values in Tuples(CO3)
In some schema designs we may group many attributes
   together into a “fat” relation. If many of the attributes
   do not apply to all tuples in the relation, we end up
   with many NULLs in those tuples.
Example
 This can waste space at the storage level and may
  also lead to problems with understanding the
  meaning of the attributes and with specifying JOIN
  operations at the logical level.
 Another problem with NULLs is how to account for
  them when aggregate operations such as COUNT or
  SUM are applied
Note :- If NULL values are present, the results may
  become unpredictable.
09/24/22              Manu Sharma   DBMS   Unit-3         45
              Guideline Null Values in
                   Tuples(CO3)
GUIDELINE    3:  As far as possible, avoid placing
    attributes in a base relation whose values may
    frequently be NULL. If NULLs are unavoidable,
    make sure that they apply in exceptional cases
    only and do not apply to a majority of tuples in the
    relation.
 Relations should be designed such that their tuples
  will have as few NULL values as possible (wastage
  of space in storage level and difficulties in JOIN
  operation with NULL values).
 Attributes that are NULL frequently could be
 placed in separate relations (with the primary key).
09/24/22              Manu Sharma   DBMS   Unit-3     46
           Summary of Informal database
                  Design(CO3)
The problems we pointed out, which can be detected
  without additional tools of analysis, are as follows:-
 Anomalies that cause redundant work to be done
  during insertion into and modification of a relation,
  and that may cause accidental loss of information
  during a deletion from a relation.
 Waste of storage space due to NULLs and the
  difficulty of performing selections, aggregation
  operations, and joins due to NULL values.
 Generation of invalid and spurious data during joins
  on base relations with matched attributes that may
  not represent a proper (foreign key, primary key)
  relationship
09/24/22              Manu Sharma   DBMS   Unit-3          47
           Summary of Informal database
                  Design(CO3)
we present informal concepts and theory that may
 be            used           to            define
 the goodness and badness of individual relation
 schemas more precisely.
Now we discuss functional dependency as a tool for
  analysis.
09/24/22          Manu Sharma   DBMS   Unit-3   48
           Faculty Video Links, Youtube & NPTEL Video
                 Links and Online Courses Details
 You tube /other Video Links
 •https://nptel.ac.in/courses/106/104/106104135/
 •https://nptel.ac.in/courses/106106220/
 •https://www.youtube.com/watch?v=1057YmExS-I
                    Manu Sharma        DBMS
09/24/22                                           49
                                  Unit-3
                        Weekly Assignment 1.1
1. What do you mean by BCNF ? Why it is used and how it differ from
   3 NF ? CO3
2. Discuss the various normal forms in normalization with suitable
   examples?
3. Why is concurrency control needed? Explain lost update, Inconsistent
   retrievals and uncommitted dependency anomalies. CO3
4. Explain the Codd’s Rule in detail. CO3
5. Explain Normalization with example. CO3
6. What are the rules of 1NF,2NF,3NF. CO3
7. Discuss Boyce Codd Normalization Form. CO3
                         Manu Sharma        DBMS
09/24/22                                                                  50
                                       Unit-3
                                     Recap
       1.1Semantics of the Relation Attributes
           1.2 Redundant Information in Tuples and Update
           Anomalies
           1.3 Null Values in Tuples
           1.4 Spurious Tuples
                     Manu Sharma        DBMS
09/24/22                                                    51
                                   Unit-3
                Topic 2 Objective
 Functional dependency
 Types of Functional dependency
09/24/22          Manu Sharma   DBMS   Unit-3   52
                  2.1 Functional
                Dependencies(CO3)
We now introduce a formal tool for analysis of relational
  schemas that enables us to detect and describe some of
  the above-mentioned problems in precise terms.
The single most important concept in relational schema
  design theory is that of a functional dependency.
Important points for FD are
1. Functional dependencies is a constraint between 2 sets
   of attributes
2. Functional dependencies (FDs) are used to specify
   formal measures       of the "goodness" of relational
   schema designs
3. FDs and keys are used to define normal forms for
   relations
4. FDs are constraints that are derived from the meaning
    and interrelationships of the data attributes.
09/24/22             Manu Sharma   DBMS   Unit-3       53
             Definition of Functional
               Dependency(CO3)
   A functional dependency, denoted by X → Y, between
  two sets of attributes X and Y that are subsets of R
  specifies a constraint on the possible tuples that can
  form a relation state r of R.
The constraint is that, for any two tuples t1 and t2 in r
  that have t1[X] = t2[X], they must also have t1[Y] =
  t2[Y].
This means that the values of the Y component of a
  tuple in r depend on, or are determined by, the
  values of the X component;
Alternatively, the values of the X Component of a tuple
  uniquely (or functionally) determine the values of the Y
  component. We also say that there is a functional
  dependency from X to Y, or that Y is functionally
  dependent on X.
09/24/22             Manu Sharma   DBMS   Unit-3        54
                  FD on Key and Non key
                      Attribute(CO3)
Functional dependency exists between the primary key
  and non-key attribute within a table.
FD on Non Key Attribute
Thus, X functionally determines Y in a relation schema R if,
  and only if, whenever two tuples of r(R) agree on their X-
  value, they must necessarily agree on their Y-value.
FD on Key Attribute
 If a constraint on R states that there cannot be more
  than one tuple with a given X-value in any relation
  instance r(R)—that is, X is a candidate key of R—this
  implies that X → Y for any subset of attributes Y of R
  (because the key constraint implies that no two tuples in
  any legal state r(R) will have the same value of X). If X is
  a candidate key of R, then X → R.
 If X → Y in R, this does not say whether or not Y → X in R.
 09/24/22               Manu Sharma   DBMS   Unit-3       55
                         Example
           Rollno   Name           Marks
           1        A              10
           2        B              20
           1        A              10
           4        B              20
           5        C              30
           6        D              30
09/24/22            Manu Sharma   DBMS     Unit-3   56
                             Example
Let us Consider the following table of data r(R) of the relation
  schema R(ABCDE) shown in
Since the values of A are unique (a1, a2, a3, etc.), it
   follows from the FD definition that:-
A → B, A → C, A → D, A → E,
Means A attribute uniquely identifies the B,C,D,E
   attribute of R relation because if we know the A we
   can tell the B,C,D,E associated with it.
This can be also write as A →BCDE.
From our understanding of primary keys, A is a primary
   key.
  09/24/22              Manu Sharma DBMS    Unit-3    57
           Diagrammatic notation for
              displaying FD(CO3)
• Consider the relation schema EMP_PROJ from the
  semantics of the attributes and the relation, we know
  that the following functional dependencies should
  hold:-
a. Pnumber → {Pname, Plocation}
b. Ssn → Ename
c. {Ssn, Pnumber} → Hours
 Pnumber uniquely determines Pname and Plocation.
 Ssn of an employee uniquely determines the Ename.
 Combination of Ssn & Pnumber uniquely determines
   the Hours
09/24/22            Manu Sharma   DBMS   Unit-3      58
            Types of Functional
             dependency(CO3)
There are mainly two types of Functional
  Dependency in DBMS.
Following are the types              of    Functional
  Dependencies in DBMS:
 Trivial Functional Dependency
 Non-Trivial Functional Dependency
09/24/22        Manu Sharma   DBMS    Unit-3       59
                     Trivial Functional
                     Dependency(CO3)
The Trivial dependency is a set of attributes which are called a
  trivial if the set of attributes are included in that attribute.
So, X -> Y is a trivial functional dependency if Y is a subset of X.
Let’s understand     with    a   Trivial   Functional     Dependency
  Example.
                            Emp_id            Emp_name
For example:
                            AS555               Harry
                            AS811              George
                            AS999               Kevin
{Emp_id, Emp_name} -> Emp_id is a trivial functional
  dependency as Emp_id is a subset of {Emp_id,Emp_name}.
09/24/22                 Manu Sharma   DBMS      Unit-3           60
                Non-Trivial Functional
                 Dependency(CO3)
 Non Trivial Functional Dependency in DBMS
 Functional dependency which also known as a nontrivial
   dependency occurs when A->B holds true where B is not
   a subset of A. In a relationship, if attribute B is not a
   subset of attribute A, then it is considered as a non-trivial
   dependency.
               Company            CEO            Age
 Example:
                Microsoft        Satya Nadella            51
                 Google          Sundar Pichai            46
                 Apple              Tim Cook              57
 (Company} -> {CEO} (if we know the Company, we knows
   the CEO name)
 But CEO is not a subset of Company, and hence it’s non-
   trivial functional dependency.
09/24/22                  Manu Sharma   DBMS     Unit-3        61
                            Recap
 Functional dependency
 Types of Functional dependency
            Manu Sharma        DBMS
09/24/22                              62
                          Unit-3
              Topic 3 Objective
Inference rules
09/24/22           Manu Sharma   DBMS   Unit-3   63
            Inference Rules for Functional
                 Dependencies(CO3)
An inference   rule is     an assertion that    we
  can apply to         a set          of functional
  dependencies to derive other functional
  dependencies.
 We denote by F the set of functional dependencies
  that are specified on relation schema R.
 Inference rules are sound meaning that they are an
  immediate consequence of the definition of FD and
  that only FD that can be derived from a relation from
  a given set of FD using them to true.
 So, inference rules can be used to find all the derived
  FD’s logically by a set of FD is true and complete.
 09/24/22             Manu Sharma   DBMS   Unit-3      64
                      Definition(CO3)
Definition:
An FD X → Y is inferred from or implied by a set of
  dependencies F specified on R if X → Y holds in every
  legal relation state r of R; that is, whenever r satisfies all
  the dependencies in F, X → Y also holds in r.
Inference rules basically based on Armstrong axiom.
Armstrong Axiom basic inference rules are :-
1. IR1 (reflexive rule) : If X ⊇ Y, then X →Y.
2. IR2 (augmentation rule) : {X → Y} |= XZ → YZ.
3. IR3 (transitive rule): {X → Y, Y → Z} |= X → Z.
IR1, IR2, IR3 form a sound and complete set of inference
  rules
09/24/22                Manu Sharma   DBMS    Unit-3         65
           Armstrong Axiom Rules(CO3)
There are three other inference rules that follow from IR1,
  IR2 and IR3.
They are as follows:
4. IR4 (decomposition, or projective, rule): {X → YZ} |=X →
  Y,
  X →Z
5. IR5 (union, or additive, rule): {X → Y, X → Z} |=X → YZ.
6 . IR6 (pseudotransitive rule): {X → Y, WY → Z} |=WX → Z.
Note:- Rules from IR1 to IR3 are known as Armstrong
 Axiom rules. These rules are mainly used in FD to find
 complete set of all possible dependencies.
09/24/22              Manu Sharma   DBMS   Unit-3        66
                    Exercise 3.1
Prove or disprove the following
   inference rules:-
      1. {WY,XZ} |= {WXY}
      2. {XZ,Y Z} |= {XY}
      3. {XY,Y W} |= {XZYW}
09/24/22           Manu Sharma   DBMS   Unit-3   67
                     Exercise 3.2
Prove or disprove the following
   inference rules
      1.   {WY,XZ} |= {WXY}
      2.   {XY,XW,WYZ} |= {XZ}
      3.   {XY} |= {XYZ}
      4.   {XY, Z Y} |= {XZY}
09/24/22            Manu Sharma   DBMS   Unit-3   68
                           Question(CO3)
Let us consider the Universal relation schema R =
  ( A, B, C, G, H, I ) and the set of functional
  dependencies F ={ A → B, A → C, CG → H, CG → I , B
  → H}.
Determines the other FD’s from given set of FD F.
Answer:-
Given F= { A → B, A → C, CG → H, CG → I , B → H}.
1. Since A → B and B → H hold, we apply the transitivity rule that A → H
2. Since CG → H and CG → I , the union rule implies that CG → HI.
3. Since A → C and CG → I , the pseudo-transitivity rule implies that AG
   → I holds
4. Since A → B and A→ C hold, we apply the union rules that A → BC
All possible FD are:-
F’= { A → B, A → C, CG → H, CG → I , B → H, A → H, CG → HI ,A
  →BC, AG → I }.
  09/24/22                   Manu Sharma   DBMS     Unit-3           69
           Conti…………                             (CO3)
Note:-
Armstrong axioms are complete. As for a given set
  F of functional dependencies, all FD implied by F
  can be inferred by using rules IR1 through IR3.
Armstrong axiomS are also sound as to no
  additional FD or incorrect FD’s can be deduced
  from F by using inference rules.
09/24/22           Manu Sharma   DBMS   Unit-3           70
                             Recap
 Inference rules
             Manu Sharma        DBMS
09/24/22                               71
                           Unit-3
             Topic 4,5 Objective
 Closure of Attribute set.
 Definitions of Keys
 Find the super key and candidate key from
  FD
09/24/22        Manu Sharma   DBMS   Unit-3   72
           Closure of a Attribute set(CO3)
 After finding a set of FD’s that are hold on a
  relation the next step is to find super key and
  candidate key for a relation and,
 Also to test whether a set X is a super key, we
  must devise an algorithm for computing the set of
  attributes functionally determined by X.
09/24/22           Manu Sharma   DBMS   Unit-3   73
                Algorithm for Closure of a
                   Attribute set(CO3)
The set of attribute that are functionally dependent on the
  attribute X is called attribute closure of X and it can be
  represented by X+.
Or
For each such set of attributes X, we determine the set X+ of
  attributes that are functionally determined by X based on F;
 X+ is called the closure of X under F.
Algorithm :- Determining X+, the Closure of X under F .
Input: A set F of FDs on a relation schema R, and a set of attributes X,
   which is a subset of R.
 X+ := X;
   repeat
old X+ := X+;
   for each functional dependency Y → Z in F do
   if X+ ⊇ Y then X+ := X+ ∪ Z;
until (X+ = old X+);
 09/24/22                   Manu Sharma   DBMS      Unit-3           74
                        Example
Question 1:-
To compute the closure for relation schema R
  ={A,B,C,G,H,I} and F= {A → B,A → C,CG → H, CG →
  I,B → H,C → G).
Find the closure of A under F . Or {A+ =}
Question 2:-
To compute the closure for relation schema R
  ={A,B,C,D,E} and F= {A → BC,CD → E,B → D, E → A}.
Find the closure of A and CD under F . or {A+ =} and
  { CD + =}
09/24/22           Manu Sharma   DBMS   Unit-3      75
           Definitions of Keys and Attributes Participating in Keys
 A super key of a relation schema R = {A1, A2, … , An} is a
  set of attributes S ⊆ R with the property that no two tuples
  t1 and t2 in any legal relation state r of R will have t1[S] =
  t2[S].
 If a relation schema has more than one key, each is called a
  candidate key.
 One of the candidate keys is designated to be the primary
  key, and the others are called secondary keys. In a practical
  relational database, each relation schema must have a
  primary key.
 If no candidate key is known for a relation, the entire
  relation can be treated as a default super key.
 An attribute of relation schema R is called a prime attribute
  of R if it is a member of some candidate key of R.
 An attribute is called nonprime if it is not a prime attribute—
  that is, if it is not a member of any candidate key.
09/24/22                  Manu Sharma   DBMS   Unit-3          76
           Find the super key and candidate key
                       from FD(CO3)
Definition :- The set of attribute whose closure of
 attribute is set of all attribute of a relation called
 super key of relation and if this is set of minimal of it
 is called of candidate key.
Formally say ,
• Let R is the relation and X is the set of attribute over
  R.
• If X+ determines all the attributes of R, then X is said
  to be super key, or candidate key of R.
• To find the candidate key first find all the super key of
  a relation. (because the candidate key is a minimal
  set of super key).
09/24/22              Manu Sharma   DBMS   Unit-3        77
              Step to find the super key and
                  candidate Key(CO3)
So To identify super key and candidate key, We need to follow
   some steps,
1. Compute the closure for the attribute that combination of
   attribute on The LHS of FD,
2. If any closure includes all the attribute of given relation, then
   that can be denoted as a key for the relation(This would be
   the set of super key and candidate key).
3. When we indentify the super key using FD’s and it has
   extraneous attribute in the super key then,
4. Now applying the given FD and reduced the set of LHS
   elements
5. Repeat Step-4,Apply till the of element of the super key when
   it is not functionally determines all FD, If fail Stop, otherwise
6. We determines all FD from a exclusive attribute of super key
   is true is called candidate key
 09/24/22                 Manu Sharma   DBMS    Unit-3          78
                       Example
Question 1-
To find the Keys of relation R={A,B,C,D,E} with
  FD’s F={A →BC,CD →E,E → A,B → D}.
Question 2-
To find the Keys of relation R={A,B,C,D,E,H} with
  FD’s F={A →BC,CD →E,E → C,C → AEH,AH →D,DH →
  BC}.
09/24/22          Manu Sharma   DBMS   Unit-3   79
                            Recap
 Closure of Attribute set.
 Definitions of Keys
 Find the super key and candidate key
  from FD
            Manu Sharma        DBMS
09/24/22                              80
                          Unit-3
            Topic 6 Objective
Equivalence set of FD
Minimal cover, Canonical cover of FD
09/24/22     Manu Sharma   DBMS   Unit-3   81
           Equivalence Sets of FDs(CO3)
Definition.
 A set of functional dependencies F is said to cover
  another set of functional dependencies E if every
  FD in E is also in F+; that is, if every dependency
  in E can be inferred from F; alternatively, we can
  say that E is covered by F.
Means,
Two sets of FDs F and E are equivalent if:
    - every FD in F can be inferred from E, and
    - every FD in E can be inferred from F
• Hence, F and E are equivalent if F + = E +
• F and E are equivalent if F covers E and E covers F
09/24/22                 Manu Sharma   DBMS       Unit-3   82
           Step to Equivalence Sets of
                    FDs(CO3)
I.  We can determine whether F covers E by calculating X+
    with respect to F for each FD X → Y in E,
II. And then checking whether this X+ includes the
    attributes in Y. If this is the case for every FD in E, then
    F covers E. We determine whether E and F are
    equivalent by checking that E covers F and F covers E.
Note
If F and G are the two sets of functional dependencies,
     then following 3 cases are possible-
1. If all FDs of E can be derived from FDs present in F, we
     can say that F ⊃ E.
2. If all FDs of F can be derived from FDs present in E, we
     can say that E ⊃ F.
3. If 1 and 2 both are true, F=E.
09/24/22                Manu Sharma   DBMS    Unit-3         83
                   Example(CO3)
Q 1: Given a relational schema R( X, Y, Z, W, V ) set
   of functional dependencies P and Q such that:
P = { X → Y, XY → Z, W → XZ, W → V} and Q = { X
   → YZ, W → XV }
 using FD sets P and Q which of the following
   options are
correct?
a) P is a subset of Q
b) Q is a subset of P
c) P = Q
d) P ≠ Q
09/24/22           Manu Sharma   DBMS   Unit-3     84
                       Example(CO3)
• Using definition of equivalence of FD set, let us determine
  the right-hand side of the FD set of P using FD set Q.
• Given P = { X → Y, XY → Z, W → XZ, W → V} and Q = { X →
  YZ, W → XV }
• Let's find closure of the left side of each FD of P using FD Q.
• X+ = XYZ (using X → YZ)
• XY+ = XYZ (using X → YZ)
• W+ = WXVYZ (using W → XV and X → YZ)
• W+ = WXVYZ (using W → XV and X → YZ)
Now compare closure of each X, XY, W and W calculated using
  FD
 Q with the right-hand side of FD P. Closure of each X, XY, W
  and W
 has all the attributes which are on the right-hand side of each
  FD of P. Hence, we can say P is a subset of Q----------1
09/24/22               Manu Sharma   DBMS    Unit-3          85
                      Example(CO3)
• Using definition of equivalence of FD set, let us determine
  the right-hand side of the FD set of Q using FD set P.
• Given P = { X → Y, XY → Z, W → XZ, W → V} and Q = { X
  → YZ, W → XV }
• Let us find closure of the left side of each FD of Q using
  FD P.
• X+ = XYZ (using X → Y and XY → Z)
• W+ = WXZVY (using W → XZ, W → V, and X → Y)
• Now compare closure of each X, W calculated using FD P
  with the right-hand side of FD Q. Closure of each X and W
  has all the attributes which are on the right-hand side of
  each FD of Q. Hence, we can say Q is a subset of
  P-----------2
• From 1 and 2 we can say that P = Q, hence option
  c) is correct.
09/24/22              Manu Sharma   DBMS   Unit-3         86
                    Example(CO3)
Q 2: Given a relational schema R( A, B, C, D ) set of
  functional dependencies P and Q such that:
P = { A → B, B → C, C → D } and Q = { A → BC, C →
  D } using FD
 sets P and Q which of the following options are
  correct?
a) P is a subset of Q
b) Q is a subset of P
c) P = Q
d) P ≠ Q
09/24/22            Manu Sharma   DBMS   Unit-3     87
                    Example(CO3)
Question 1:-
Let us consider a relation schema R ={A,B,C,D,E} having
  two functional dependency(FD) set E and F,
E= {A → B, AB → C, D → AC, D → E} and
F = {A → BC, D → AE}
Check wheteher two set are equivalent or not.
Question 2:-
Let us consider a relation schema R ={A,B,C,D,E,H}
  having two functional dependency(FD) set F and G,
F = {A → C, AC → D, E → AD, E → H}
G = {A → CD, E → AH}
Check wheteher two set are equivalent or not.
09/24/22            Manu Sharma   DBMS   Unit-3      88
        Minimal cover, Canonical
    cover of FD
09/24/22     Manu Sharma   DBMS   Unit-3   89
           Need of minimal cover of Functional
                  Dependencies(CO3)
 Whenever a user updates database the system must check
  whether any FD are getting violated in the process, if there
  is a violation of dependencies in the new database state
  the system must rollback. If working with a huge set of FD
  can cause unnecessary added computational time .
 Remove the extraneous attribute in FD set and also
  remove the redundant FD in F and get standard from of FD.
So we can reduce the effort spent in checking for violation by
  testing a simplified set of FDs, canonical cover comes to
  play big role for remove redundant FD and find the
  standard form of FD.
09/24/22               Manu Sharma   DBMS   Unit-3         90
           Continue……                            (CO3)
A minimal cover of a set of functional dependencies
  E is a set of functional dependencies F that
  satisfies the property that every dependency in E
  is in the closure F + of F.
In addition, this property is lost if any dependency
  from the set F is removed; F must have no
  redundancies in it, and the dependencies in F are
  in a standard form.
09/24/22           Manu Sharma   DBMS   Unit-3      91
           Definition of minimal cover(CO3)
Definition:- An attribute in a functional dependency is considered
  an extraneous attribute if we can remove it without changing
  the closure of the set of dependencies.
Formally, given F, the set of functional dependencies, and a
  functional dependency X → A in F, attribute Y is extraneous in X if
  Y ⊂ X, and F logically implies (F − (X → A) ∪ { (X − Y) → A } ).
We can formally define a set of functional dependencies
  F to be minimal if it satisfies the following conditions: -
1. Every dependency in F has a single attribute for its right-
   hand side.
2. We cannot replace any dependency X → A in F with a
   dependency Y → A, where Y is a proper subset of X, and still
   have a set of dependencies that is equivalent to F.
 3. We cannot remove any dependency from F and still have a
   set of dependencies that is equivalent to F.
09/24/22                 Manu Sharma   DBMS      Unit-3           92
                      Algorithm for Minimal
                           cover(CO3)
Algorithm:- Finding a Minimal Cover F for a Set of Functional
  Dependencies E
Input: A set of functional dependencies E.
1.  Set F := E.
2. Replace each functional dependency X → {A1, A2, … , An} in
  F by the n functional dependencies X →A1, X →A2, … , X → An.
3. For each functional dependency X → A in F for each attribute
  B that is an element of X if { {F − {X → A} } ∪ { (X − {B} ) →
  A} } is equivalent to F then replace X → A with (X − {B} ) → A
  in F.
(* The above constitutes a removal of the extraneous attribute B from X *)
4. For each remaining functional dependency X → A in F if {F −
 {X → A} } is equivalent to F, then remove X → A from F.
(*This constitutes removal of a redundant functional dependency X → A from
  F when possible*)
     09/24/22                 Manu Sharma    DBMS      Unit-3           93
                  Example(CO3)
Question 1:-
Given a relation schema R = {A,B,C,D,E,F}and a set
  of functional dependencies F= {AB → C, C → AB,
  B → C, ABC → AC, A→ C, AC → B }
To find the minimal cover for above given FD’s.
Sol.
Step 1: { AB → C, C → A, C → B, B → C, ABC→ A, ABC
  → C, A → C, AC → B }
Step 2: { B → C, C → A, C → B, B → C, A → C, A → B}
Step 3: {C → A, B → C, A → B }
09/24/22           Manu Sharma   DBMS   Unit-3   94
                  Example(CO3)
Question 1:-
Given a relation schema R = {A,B,C,D,E,F}and a set
  of functional dependencies F= {AB → C, C → A, BC
  → D, ACD → B, BE → C, EC → FA,CF → BD, D → E }
To find the minimal cover for above given FD’s.
Question 2:-
Given a relation schema R = {A,B,C,D,E}and a set of
  functional dependencies F= {A → BC, CD → E,B →
  D, E → A }
To find the minimal cover for above given FD’s.
09/24/22           Manu Sharma   DBMS   Unit-3   95
                            Recap
 Equivalence set of FD
 Minimal cover, Canonical cover of FD
            Manu Sharma        DBMS
09/24/22                              96
                          Unit-3
                Topic 7 Objective
 Definition of Normalization and Normal form
 Need of normalization
 Practical Use of Normal Forms
 Types of Normalization
1. First Normal Form(INF)
2. Second Normal Form (2NF)
3. Third Normal Form (3NF)
4. BCNF (Boyce Codd Normal Form)
5. Fourth normal Form (4NF)
6. Fifth Normal form (5NF)
09/24/22           Manu Sharma   DBMS   Unit-3   97
           Definition of Normalization and
                 Normal form(CO3)
Definition :- Normalization is a process of organization
the data in database with ensuring well-formed.
Or
 The process of decomposing unsatisfactory "bad"
relations by       breaking up their attributes into
smaller relations.
      Normal form: Condition using keys and FDs of
a relation to certify whether a relation schema is in a
particular normal form .
09/24/22             Manu Sharma   DBMS   Unit-3      98
           Need of Normalization(CO3)
It is the process of analyzing the given relation
schemas based on the FD’s and primary key to achieve
the desirable properties are :-
I.Minimizing redundancy
II.Eliminates the anomalies(for insuring the integrity
and consistency of the data).
III.Ensuring data dependencies make sense i.e. data
is logically stored (all prime attribute in a relation )
IV.Dependent on the primary key (Normalization
generally involving splitting existing table into
multiple ones).
09/24/22             Manu Sharma   DBMS   Unit-3      99
                Practical Use of Normal
                      Forms(CO3)
1. Normalization is carried out in practice so that
   the resulting designs are of high quality and meet
   the desirable properties.
2. The practical utility of these normal forms becomes
   questionable when the constraints on which they
   are based are hard to understand or to detect.
3. The database designers need not normalize to the
   highest possible normal form. (usually up to 3NF,
   BCNF or 4NF).
      De normalization: the process of storing the join
      of higher normal form relations as a base relation—
      which is in a lower normal form
09/24/22               Manu Sharma   DBMS   Unit-3    100
                         Content
Normal form
Types of Normalization
1. First Normal Form(1NF)
2. Second Normal Form (2NF)
3. Third Normal Form (3NF)
4. BCNF (Boyce Codd Normal Form)
5. Fourth normal Form (4NF)
6. Fifth Normal form (5NF)
09/24/22           Manu Sharma   DBMS   Unit-3   101
                        Procedure of
                     Normalization(CO3)
In normalization we use the degree of the normal forms in a
   relation.
The normal form of a relation refer highest normal form condition
   that it meets, and hence indicate the degree to which it has
   been normalized.
 The top-down process evaluates each relation against the
   criteria for normal forms and decomposing relations as
   necessary - relational design by analysis.
 Codd proposed 3 normal forms - first, second, and third. A
   stronger definition of 3NF—called Boyce-Codd normal form
   (BCNF) - proposed by Boyce and Codd.
 All these normal forms are based on a single analytical tool:
   the functional dependencies among the attributes of a relation.
Later, a fourth normal form (4NF) and a fifth normal form (5NF)
   were proposed, based on the concepts of multivalued
   dependencies and join dependencies
 09/24/22                 Manu Sharma   DBMS    Unit-3         102
                   Procedure of
                Normalization(CO3)
   Design the good database relation also consider
   two other properties.
1. Lossless join or additive join property – which is
   guarantee that no spurious tuples are generated after
   the decomposition to the relation reconstructed.
2. Dependency preservation property :- it is ensure
   that each FD’s represented in some individual relation
   resulting after decomposition.
Note :- In practice INF,2NF and 3NF are enough for
  database normalization.
09/24/22             Manu Sharma   DBMS   Unit-3      103
           1. First Normal Form (1NF)
                      (CO3)
• A relation will be 1NF if it contains an atomic value.
• It states that an attribute of a table cannot hold
  multiple values. It must hold only single-valued
  attribute.
• First normal form disallows the multi-valued attribute,
  composite attribute, and their combinations.
• EMPLOYEE table:
• EMP_ID EMP_NAME EMP_PHONE                  EMP_STATE
• 14          John          7272826385,              UP
                                 9064738238
• 20          Harry          8574783832             Bihar
• 12           Sam            7390372389,           Punjab
                                 8589830302
09/24/22              Manu Sharma   DBMS   Unit-3       104
           1. First Normal Form (1NF)
                      (CO3)
• The decomposition of the EMPLOYEE table into
  1NF has been shown below:
• EMP_ID   EMP_NAME       EMP_PHONE
  EMP_STATE
• 14            John         7272826385       UP
• 14            John            9064738238      UP
• 20            Harry           8574783832
  Bihar
• 12           Sam               7390372389
  Punjab
• 12            Sam             8589830302
  Punjab
09/24/22          Manu Sharma   DBMS   Unit-3    105
             Normalization nested relations
                     into 1NF(CO3)
1. Let us Consider following relation Schema EMP_PROJ.
  2. Sample State of relation schema EMP_PROJ.
3. Solution 1NF version relation EMP_PROJ
  09/24/22                    Manu Sharma   DBMS         Unit-3   106
            2. Second Normal Form (2NF)
                       (CO3)
• In the 2NF, relation must be in 1NF.
• There should not be any partial dependency present.
• In the second normal form, all non-key attributes are fully
   functional dependent on the primary key.
• TEACHER table
• TEACHER_ID            SUBJECT              TEACHER_AGE
• 25                  Chemistry            30
• 25                  Biology               30
• 47                  English              35
• 83                  Math                38
• 83                  Computer            38
• In the given table, non-prime attribute TEACHER_AGE is
   dependent on TEACHER_ID which is a proper subset of a
   candidate key. That's why
  09/24/22                    it Sharma
                           Manu  violates the
                                           DBMSrule forUnit-3
                                                        2NF.    107
                2. Second Normal Form (2NF)
                           (CO3)
•    To convert the given table into 2NF, we decompose it into two tables:
•    TEACHER_DETAIL table:
•    TEACHER_ID               TEACHER_AGE
•    25                        30
•    47                        35
•    83                        38
•    TEACHER_SUBJECT table:
•    TEACHER_ID                     SUBJECT
•    25                           Chemistry
•    25                            Biology
•    47                            English
•    83                            Math
•    83                           Computer
    09/24/22                     Manu Sharma    DBMS        Unit-3           108
             2. Second Normal Form (2NF)
                        (CO3)
• 1NF meets the relationship, and no partial functional dependencies are
  present.
• Partial Dependency occurs when a non-prime attribute is functionally
  dependent on part of a candidate key.
• The 2nd Normal Form (2NF) eliminates the Partial Dependency.
• Example
• <StudentProject>
• StudentID ProjectNo StudentName ProjectName
  S01           199         Katie             Geo Location
  S02           120         Ollie             Cluster Exploration
  In the above table, we have partial dependency; let us see how −
• The prime key attributes are StudentID and ProjectNo, and
• StudentID = Unique ID of the student
  StudentName = Name of the student
  ProjectNo = Unique ID of the project
  ProjectName = Name of the project
 09/24/22                   Manu Sharma   DBMS      Unit-3          109
                 2. Second Normal Form (2NF)
                            (CO3)
•    As stated, the non-prime attributes i.e. StudentName and ProjectName should be
     functionally dependent on part of a candidate key, to be Partial Dependent.
•    The StudentName can be determined by StudentID, which makes the relation Partial
     Dependent.
•    The ProjectName can be determined by ProjectNo, which makes the relation Partial
     Dependent.
•    Therefore, the <StudentProject> relation violates the 2NF in Normalization and is
     considered a bad database design.
•    To remove Partial Dependency and violation on 2NF, decompose the tables −
•    <StudentInfo>
•    StudentID ProjectNo            StudentName
     S01            199              Katie
     S02            120             Ollie
     <ProjectInfo>
•    ProjectNo        ProjectName
     199             Geo Location
     120             Cluster Exploration
     Now the relation is in 2nd Normal form of Database Normalization.
    09/24/22                        Manu Sharma     DBMS         Unit-3             110
            2. Second Normal Form (2NF)
                       (CO3)
  Definition :-
  A FD X -> Y is full functional dependency, if removal
  of any attribute A from X, the dependency does not
  hold any more.
  That is for any attribute A ∈ X,(X-{A}) does not
  functionally determines Y, else it is partial FD. :- (X-
  {A}) -> Y(NOT hold )
Examples:-
  {SSN, PNUMBER} -> HOURS is a full FD since neither
  SSN -> HOURS nor PNUMBER -> HOURS hold .
  Partial Function Dependency :- A FD X -> Y, is a
  partial functional dependency if some attribute A ∈
  X, can be removed from X and dependency still hold.
            A ∈ X, (X-{A}) -> Y(hold )
 09/24/22              Manu Sharma   DBMS   Unit-3     111
           2. Second Normal Form (2NF)(CO3)
    A relation schema R is in second normal form (2NF)
    if every non-prime attribute A in R is fully functionally
    dependent on the primary key or candidate key of R.
    (means all non key attribute cannot be dependent on
    a subset of the primary key or candidate key ).
    Otherwise ,
    R can be decomposed into 2NF relations via the
    process of 2NF normalization .
    Note :- The test for 2NF involves testing for functional
    dependencies whose left-hand side attributes are part
    of the primary key. If the primary key contains a
    single attribute, the test need not be applied at all.
    If a primary key is not a composite primary key, such
    case all non key attribute are always fully dependent
    on the primary key .
09/24/22               Manu Sharma   DBMS   Unit-3        112
                 Example 2NF (CO3)
  Let us Consider the following relation schema
  EMP_PROJ
  {SSN,Pnumber,hours,ename,pname,plocation}
with FD Set F=
FD1= {SSN,Pnumber} -> hours
FD2= {SSN} -> ename
FD3={Pnumber} -> {Pname,plocation}
  Check for 2NF,if it is not in 2NF then converted into
  2NF.(Relation have composite primary key {SSN,
  Pnumber}).
 09/24/22            Manu Sharma   DBMS   Unit-3   113
                     Example 2NF(CO3)
     FD1= {SSN,Pnumber} -> hours
     FD2= {SSN} -> ename
     FD3={Pnumber} -> {Pname,plocation}
FD1= {SSN,Pnumber} -> hours        (Fully Functional dependency)
FD2= {SSN} -> ename                  (Partial Functional dependency)
  Therefore ename is partial dependent on SSN, which is only the
  part of the primary key. Therefore FD2 is not satisfied second
  normal form.
FD3={Pnumber} -> {Pname, plocation} (Partial Functional
  dependency)
  {Pname,Plocation } is also partial dependent on Pnumber, which
  is only the part of the primary key. Therefore FD3 is not satisfied
  second normal form
09/24/22                  Manu Sharma   DBMS     Unit-3          114
                     Example(CO3)
Solution :-
  To bring relation EMP_PROJ into second normal form, We
  decompose the relation
 09/24/22            Manu Sharma   DBMS   Unit-3    115
           3. Third Normal Form (3NF)
                      (CO3)
•          Third Normal Form (3NF):
    A relation is in third normal form, if there is no
    transitive dependency for non-prime attributes as
    well as it is in second normal form.
•   A relation is in 3NF if at least one of the following
    condition holds in every non-trivial function
    dependency X –> Y:
•   X is a super key.
•   Y is a prime attribute (each element of Y is part of
    some candidate key).
•   In relation STUDENT given in Table 4,
09/24/22              Manu Sharma   DBMS   Unit-3     116
                3. Third Normal Form (3NF)
                           (CO3)
FD set:
{STUD_NO -> STUD_NAME, STUD_NO -> STUD_STATE, STUD_STATE -
> STUD_COUNTRY, STUD_NO -> STUD_AGE}
Candidate Key:
{STUD_NO}
For this relation in table 4, STUD_NO -> STUD_STATE and STUD_STATE -
> STUD_COUNTRY are true. So STUD_COUNTRY is transitively
dependent on STUD_NO.
It violates the third normal form. To convert it in third normal form, we will
decompose the relation STUDENT (STUD_NO, STUD_NAME,
STUD_STATE, STUD_COUNTRY_STUD_AGE) as:
STUDENT (STUD_NO, STUD_NAME, STUD_STATE, STUD_AGE)
STATE_COUNTRY (STUD_STATE, STUD_COUNTRY)
09/24/22                       Manu Sharma     DBMS        Unit-3                117
           General Definitions of 1NF,2NF
                   and 3NF(CO3)
09/24/22           Manu Sharma   DBMS   Unit-3   118
           4. Boyce Codd Normal Form (BCNF)
                     OR 3.5NF (CO3)
  BCNF (Boyce Codd Normal Form) is the advanced version of 3NF.
  A table is in BCNF if every functional dependency X->Y, X is the
  super key of the table. For BCNF, the table should be in 3NF, and
  for every FD, LHS is super key.
• Consider a relation R with attributes (student, subject, teacher).
• Student           Teacher          Subject
   Jhansi            P.Naresh       Database
   Jhansi            K.Das           C
  Subbu             P.Naresh       Database
   Subbu            R.Prasad        C
F: { (student, Teacher) -> subject (student, subject) -> Teacher
   Teacher -> subject}
• Candidate keys are (student, teacher) and (student, subject).
• The above relation is in 3NF [since there is no transitive
   dependency]. A relation R is in BCNF if for every non-trivial FD X-
   >Y, X must be a key.
09/24/22                  Manu Sharma   DBMS      Unit-3           119
           4. Boyce Codd Normal Form (BCNF)
                     OR 3.5NF (CO3)
•   The above relation is not in BCNF, because in the FD (teacher-
    >subject), teacher is not a key. This relation suffers with anomalies
    −
•   For example, if we try to delete the student Subbu, we will lose the
    information that R. Prasad teaches C. These difficulties are caused
    by the fact the teacher is determinant but not a candidate key.
•   Decomposition for BCNF
•   Teacher-> subject violates BCNF [since teacher is not a candidate
    key].
•   If X->Y violates BCNF then divide R into R1(X, Y) and R2(R-Y).
•   So R is divided into two relations R1(Teacher, subject) and
    R2(student, Teacher).
•   R1                                                R2
•   Teacher     Subject                     Student      Teacher
•   P.Naresh database                        Jhansi       P.Naresh
•   K.DAS        C                             Jhansi       K.DAS
•   R.Prasad C                                Subbu         P.Naresh
•                                               Subbu        R.Prasad
09/24/22                    Manu Sharma   DBMS       Unit-3            120
           Lossless Join Decomposition (CO3)
• Lossless-join decomposition is a process in which a relation is decomposed
  into two or more relations. This property guarantees that the extra or less
  tuple generation problem does not occur and no information is lost from
  the original relation during the decomposition. It is also known as non-
  additive join decomposition.
• When the sub relations combine again then the new relation must be the
  same as the original relation was before decomposition.
• Consider a relation R if we decomposed it into sub-parts relation R1 and
  relation R2.
• The decomposition is lossless when it satisfies the following statement −
• If we union the sub Relation R1 and R2 then it must contain all the
  attributes that are available in the original relation R before decomposition.
• Intersections of R1 and R2 cannot be Null. The sub relation must contain a
  common attribute. The common attribute must contain unique data.
09/24/22                      Manu Sharma    DBMS        Unit-3             121
           Lossless Join Decomposition (CO3)
• The common attribute must be a super key of sub relations
  either R1 or R2.
• Here,
• R = (A, B, C)
• R1 = (A, B)
• R2 = (B, C)
• The relation R has three attributes A, B, and C. The relation R is
  decomposed into two relation R1 and R2. . R1 and R2 both have
  2-2 attributes. The common attribute is B.
• The Value in Column B must be unique. if it contains a duplicate
  value then the Lossless-join decomposition is not possible.
• R (A, B, C)
• A    B      C
• 12 25      34
• 10 36      09
• 12 42      30
09/24/22                 Manu Sharma   DBMS      Unit-3          122
             Lossless Join Decomposition (CO3)
•   It decomposes into the two sub relations −
•   R1 (A, B)
•   A    B
•   12 25
•   10 36
•   12 42
•   R2 (B, C)
•   B     C
•   25 34
•   36 09
•   42 30
•   Now, we can check the first condition for Lossless-join decomposition.
•   The union of sub relation R1 and R2 is the same as relation R.
•   R1 U R 2 = R
•   A      B  C
•   12     25 34
•   10     36 09
•   12     42 30
09/24/22                    Manu Sharma   DBMS       Unit-3           123
                        Continue….
    The formal definition of BCNF differs from the
    definition of 3NF in that clause (b) of 3NF, which
    allows functional dependency having the RHS as
    a prime attribute, is absent from BCNF. That
    makes BCNF a stronger normal form compared to
    3NF.
    (LHS of every functional dependency must be
    super key or candidate key and RHS prime
    attribute condition not allowed in BCNF)
Note:- Every relation in BCNF is in 3NF,but it is not
 necessary that every relation in 3NF is in BCNF.
09/24/22             Manu Sharma   DBMS   Unit-3   124
                         Example
    Let us consider the following relation TEACH=
    {student,Course,Instructor}
with the following dependencies: -
FD1: {Student, Course} → Instructor
 FD2: Instructor → Course
  {Student, Course}. Check this relation in
  BCNF or not. is a candidate key for this
  relation
09/24/22           Manu Sharma   DBMS   Unit-3   125
                          Example
    Instructor is not super keys but determines
    course. So student relation in 3NF.
    But student relation is not in BCNF because in
    FD Instructor → Course, Instructor is not
    super key or candidate key or primary key.
 Solution :-
 Therefore the relation Teach decompose in
 1. Teach1 {Student, Instructor}
 2. Teach 2 {Instructor, Course}
           Teach1                                 Teach 2
09/24/22            Manu Sharma   DBMS   Unit-3        126
                         Continue…
    All three decompositions will lose functional
    dependency . We have to settle for sacrificing the
    functional dependency preservation. But we cannot
    sacrifice   the  non-additivity    property   after
    decomposition.
    Out of the above three, only the 3rd decomposition
    will not generate spurious tuples after join.(and
    hence has the non-additivity property).
09/24/22             Manu Sharma   DBMS   Unit-3    127
                    5. Multi-valued
                   Dependency(CO3)
Multi-valued dependency (MVD)
- Consequence of first normal form (1NF) which
  diasallow an attribute in a tuple to have a set of
  values.
- A multivalued dependency always requires at least
  three attributes because it consists of at least two
  attributes that are dependent on a third attribute .
-    Let us consider a relation R =(A,B,C) and value of A
    there is a set of value of B & a set of value of C.
    However the set of value for B & C are independent of
    each other.
    We write A →→ B and
          A →→ C.
09/24/22              Manu Sharma   DBMS   Unit-3     128
                          Example
    Example :- Employee whose name is ename work on
    project Pname and has dependent dname. An employee
    may work on      several projects and have several
    dependents & both project and dependents are
    independent from each other.
    problem
    Multivalued dependencies (MVDs) express          a
    condition among tuples of a relation that exists
    when the relation is trying to represent more than
    one to many or many to many relationship.
09/24/22             Manu Sharma   DBMS   Unit-3   129
           Formal Definition of Multivalued
                 Dependency(CO3)
    A multivalued dependency X →→ Y specified on
    relation schema R, where X and Y are both subsets of
    R, specifies the following constraint on any relation
    state r of R:
    If two tuples t1 and t2 exist in r such that t1[X] =
    t2[X], then two tuples t3 and t4 should also exist in r
    with the following properties,
     t1[X] = t2[X] = t3[X] = t4[X]
    t1[Y] = t3[Y] and t2[Y] = t4[Y]
    t1[Z] = t4[Z] and t3[Z] = t2[Z]
    Where X →→ Y holds, we say that X multi-determines
    Y, or Y is multi-dependent on X.
09/24/22               Manu Sharma   DBMS   Unit-3      130
           Forth Normal Form (4NF)(CO3)
The official qualification for 4NF are:-
1. A table is already in BCNF.
2. A table contain no          multi-valued  functional
  dependency .
Example :- Let us consider following relation student:-
Key:- {s_id,course,hobby}
MVD, s_id →→ course,hobby
To check relation is in 4NF or not.
09/24/22             Manu Sharma   DBMS   Unit-3    131
                             Example
    As you can see in the above table , student with s_id 1 has
    opted for two courses, Science and Maths, and has two
    hobbies, Cricket and Hockey.
    You must be thinking what problem this can lead to, right?
    Problem:- Well the two records for student with s_id 1& 2,
    will give rise to two more records, because for one student,
    two hobbies exists, hence along with both the courses,
    these hobbies should be specified.
09/24/22                Manu Sharma   DBMS    Unit-3         132
                          Continue
In the above table , there is no relationship between
the     columns course and hobby.         They    are
independent of each other.
So there is multi-value dependency, which leads to
un-necessary repetition of data and other anomalies
as well.
09/24/22            Manu Sharma   DBMS   Unit-3   133
                                Solution
Solution:- To make the above relation satisfy the 4th
  normal form, we can decompose the table into 2 tables.
•   Now this relation satisfies the fourth normal form.
09/24/22                  Manu Sharma   DBMS    Unit-3    134
           6. Fifth Normal Form (5NF)(CO3)
   The 5NF (Fifth Normal Form) is also known as project-
   join normal form (PJNF).
   A relation is in Fifth Normal Form (5NF), if
1. it is in 4NF, and
2. won’t have lossless decomposition into smaller tables.
   Definition:-      A join dependency (JD), denoted by
   JD(R1, R2, … , Rn), specified on relation schema R,
   specifies a constraint on the states r of R.
   The constraint states that every legal state r of R
   should have a non-additive join decomposition into R1,
   R2, … , Rn.
    Hence, for every such r we have * (πR1 (r), πR2 (r), … ,
   πRn (r)) = r
09/24/22              Manu Sharma   DBMS   Unit-3        135
           6. Fifth Normal Form (5NF)(CO3)
    5NF     is    of     little practical     use    to
    the database designer, but it is of interest from a
    theoretical point of view.
    In all of the further normal forms discussed so far,
    no loss decomposition was achieved by the
    decomposing of a single table into two separate
    tables.
    Note :- In considering 5NF, consideration must
    be given to tables where this non-loss
    decomposition can only be achieved by
    decomposition into three or more separate tables.
09/24/22              Manu Sharma   DBMS   Unit-3    136
                            Example
    Let us consider the following relation person with
    attribute ((Agent, Company, Product _Name))
    The table is in 4NF because it contains no multi-
    valued dependency.
    It does, however, contain an element of redundancy
    in that it records the fact that Suneet is an agent for
    ABC twice. But there is no way of eliminating this
    redundancy without losing information.
09/24/22               Manu Sharma   DBMS   Unit-3      137
                         Continue
• Suppose that the Relation Person      is decomposed
  into two relation P1 and P2.
• The redundancy has been eliminated, but the
  information about which companies make which
  products and which of these products they supply to
  which agents has been lost.
09/24/22           Manu Sharma   DBMS   Unit-3    138
                            Continue..
The natural join of these projections over the ‘agent’
  columns is:
    The table resulting from this join is spurious, since the
    asterisked row of the table contains incorrect information.
    Solution :- When we decompose the relation such case
    common attribute must be a candidate key.
09/24/22                Manu Sharma   DBMS   Unit-3         139
                         Cont……..
Now suppose that the original table were to be
decomposed into three tables, the two projections,
P1 (agent,company)and P2(agent,procduct) which
have already shown, and the final, possible
projection, P3 (company,product).
                                       P3 Product_na
                                   Company
                                                   me
                                         ABC       Nut
                                         ABC       Scew
                                         CDE       Bolt
                                         ABC       Bolt
09/24/22            Manu Sharma   DBMS    Unit-3          140
                                  Conti….
 If a join is taken of all three projections, first of P1 and P2 with the
 (spurious) result shown above, and then of this result with P3 over
 the ‘Company’ and ‘Product name’ column, the following table is
 obtained:-
           Agent            Company             Product_Name
           Suneet           ABC                 Nut
           Suneet           ABC                 Screw
           Suneet           ABC                 Bolt
           Suneet           CDE                 Bolt
           Raj              ABC                 Bolt
   This still contains a spurious row. The order in which the joins are
 performed makes no difference to the final result. It is not simply
 possible of decompose the ‘AGENT_COMPANY_PRODUCT’ table,
 populated as shown, without losing information. Thus, it has to be
 accepted that it is not possible to eliminate all redundancies using
 normalization techniques, because it cannot be assumed that all
 decompositions will be non-loss.
09/24/22                   Manu Sharma   DBMS          Unit-3        141
                      Content
Lecture 8:-
Decomposition of relation Schema
Properties of decomposition
09/24/22       Manu Sharma   DBMS   Unit-3   142
             Decomposition of relation
                  Schema(CO3)
    Decomposition of relation schema R consists of
    replacing the relation schema by two or more sub
    relations schemas. So that each contain subset of
    attributes of relation schema R and which together
    include all attribute or R.
    Decomposition of relation R= {A1,A2,A3,…….An} is the
    replacement of R by a collection D={R1,R2…….Rm}
    where Ri is subset of R such that R={ R1 U R2 U…….RN}
    Example :- R= { Eid,position,salary}
    D1= {Eid,position}
    D2= {Postion,Salary}
    Using the functional dependencies we can decompose a
    given relation schema R= {A1,A2,……AN} into a set of
    relation schema represented by D={R1,R2…..RN} to
    remove anomalies present in a database(Relations).
09/24/22              Manu Sharma   DBMS   Unit-3     143
                  Properties of
               decomposition(CO3)
There are three properties of decomposition of relation
   are
1. Attribute Preservation
2. Dependency Preservation
3. Lossless Join decomposition
09/24/22            Manu Sharma   DBMS   Unit-3      144
           1.Attribute Preservation(CO3)
    We must make sure that each attribute in R will
    appear in at least one relation schema Ri in the
    decomposition so that no attributes are lost; formally,
    we say this is called attribute preservation.
    Example :- R={A,B,C,D,E,F}
    Decompose relation are
    R1={A,B,C,D}
    R2={A,E,F}
    Note :- Union of all decompose relation will give all
    attribute of universal relation R.
                       R1 U R2= R{A,B,C,D,E,F}.
09/24/22               Manu Sharma   DBMS   Unit-3      145
                   2. Dependency
                 Preservation(CO3)
• It would be useful if each functional dependency X →
  Y specified in F either appeared directly in one of the
  relation schemas Ri in the decomposition D or could
  be inferred from the dependencies that appear in
  some Ri. Informally, this is the dependency
  preservation condition.
• We want to preserve the dependencies because
  each dependency in F represents a constraint
  on the database. If one of the dependencies is not
  represented in some individual relation Ri of the
  decomposition, we cannot enforce this constraint by
  dealing with an individual relation.
09/24/22             Manu Sharma   DBMS   Unit-3      146
                Cont…..                 (CO3)
    If we decompose a relation R into relations R1
    and R2, All dependencies of R either must be a
    part of R1 or R2 or must be derivable from
    combination of FD’s of R1 and R2.
    A Decomposition D = { R1, R2, R3….Rn } of R is
    dependency preserving write E a set F of
    Functional dependency if
                (F1 ∪ F2 ∪ … ∪ Fm) + = F+ .
09/24/22           Manu Sharma   DBMS    Unit-3   147
                           Example
    Question 1 :- Let a relation R (A, B, C, D ) and
    functional dependency {AB –> C, C –> D, D –> A}.
    Relation R is decomposed into R1( A, B, C) and R2(C,
    D).
    Check    whether    decomposition   is   dependency
    preserving or   not.
    Question 2:- Let us consider a relation R (A, B, C,
    D,E,F ) with functional dependency set F= {D –> AB,
    C–> EF,}and relation R is decomposed into R1( A,C,D),
    R2(A,D,B), R3(D,E,F), R4(C,E,F).
      Check whether decomposition is dependency
    preserving or   not.
09/24/22              Manu Sharma   DBMS   Unit-3     148
           Nonadditive (Lossless) Join Property of a
           Decomposition(CO3)
 Another property that a decomposition D
  should possess is the nonadditive join
  property, which ensures that no spurious tuples are
  generated when a NATURAL JOIN operation is applied
  to the relations resulting from the decomposition.
    Definition. Formally, a decomposition D = {R1, R2,
    … , Rm} of R has the lossless (nonadditive) join
    property with respect to the set of dependencies F
    on R if, for every relation state r of R that satisfies F,
    the following holds, where * is the NATURAL JOIN of
    all the relations in D: *(πR1(r), … , πRm(r)) = r.
09/24/22                Manu Sharma   DBMS   Unit-3        149
                    Procedure(CO3)
• Procedure :- Decomposition of R into R1 and R2 from a
   lossless join decomposition if at least one of the
   following dependencies in F+
1. First condition) = (ABC) U (AD) = (ABCD) = Att(R). holds
   true as Att(R1) U Att(R2
2. R1 ∩ R2= R1 , that is: all attributes common to both R1
   and R2 functionally determine ALL the attributes in R1.
OR
    R1 ∩ R2= R2 that is: all attributes common to both R1
   and R2 functionally determine ALL the attributes in R2
  3. In other word R1 ∩ R2 from a super key or candidate
    key of either R1 or R2 or both , The decomposition of R
    is a lossless join decomposition.
09/24/22              Manu Sharma   DBMS   Unit-3       150
                              Example
    Question 1 :- Let a relation R (A, B, C, D ,E) and functional
    dependency {A –> BC, CD –> E, B –> D, E> A}.
    Relation R is decomposed into R1( A, B, C) and R2(A, D,E).
    Check whether decomposition is lossless or lossy
    decomposition.
    Question 2 :- Let a relation R (A,B,C,D,E,F) and functional
    dependency {AB –> C, C –> D, D –> EF, F -> A,D ->B}.
    Relation   R   is  decomposed      into   R1(    A,B,C)   ,
    R2(C,D,E),R3(E,F).
    Check whether decomposition is lossless or lossy
    decomposition.
09/24/22                 Manu Sharma   DBMS    Unit-3         151
            Testing for Non additive join
                      property
    A Universal relation R , decomposition D {R1,R2,……
    Rm} of R and a set of Functional dependencies
    Step 1:- Create a matrix by the given set of FD’s
    (initially matrix will one row i for each relation Ri in D,
    and one column J for each attribute Aj in R ).
    Step 2:- Set s(i,j) = by for all matrix entries:-
      – Put the symbol ‘a’ for those element which are present
        in the given set D. And
      – Put the symbol ‘b’ for those element which are not
        present in the given set D.
      Setp3:- Now apply the given FD’s and developed
        new matrix by changing the symbol ‘b’ to ‘a’ if the
        element functionally dependent.
      Step 4:- Check whether any raw is filled with all ‘a’.
      Step 5:- if any raw is filled with all ‘a’ element then It
        is lossless join decomposition otherwise lossy
        decomposition.
09/24/22                 Manu Sharma   DBMS   Unit-3         152
                       Example
  Question 1:- Let us consider a relation Schema R
  ={SSN, PNumber, PName, PLocation,Hours} and
  functional dependency set f=
 SSN –> Ename,
 Pnumber –> {Pname,Plocation}
 {SSN,Number} –> Hours } and
  Decompose a relation D = {R1,R2,R3} where R1=
  {SSN, Ename}, R2= {Pnumber, Pname,Plocation}
  and R3= {SSN, Pnumber, Hours} .
  show whether decomposition is lossy or lossless
  join decomposition .
09/24/22          Manu Sharma   DBMS   Unit-3   153
Question 2:- Let us consider a relation Schema R
  ={A,B,C,D,E,} and functional dependency set f=
 AB –> CD,
 A –> E
 C –> D } and
  Decompose a relation D = {R1,R2,R3} where
  R1= {A,B,C}, R2= {B,C,D}, and R3= {C,D,E} .
  show whether decomposition is lossy or lossless
  join decomposition .
09/24/22          Manu Sharma   DBMS   Unit-3   154
           Inclusion Dependencies(CO3)
 • MVDs and JDs can be used to guide database design,
   as we have seen, although they are less common than
   FDs and harder to recognize and reason about.
 • In contrast, inclusion dependencies are very intuitive
   and quite common. However, they typically have little
   influence on database design
 • The main point to bear in mind is that we should not
   split groups of attributes that participate in an
   inclusion dependency.
 • Most inclusion dependencies in practice are key-
   based, that is, involve only keys.
09/24/22           Manu Sharma   DBMS   Unit-3       155
           Faculty Video Links, Youtube & NPTEL Video
                Links and Online Courses Details
•Youtube/other Video Links
•https://www.youtube.com/watch?v=1yUkun2r0N4
•https://www.youtube.com/watch?v=EFdvRm5nse0
09/24/22            Manu Sharma   DBMS   Unit-3   156
                           Daily Quiz
•   What is functional dependency?
•   Explain normal forms.
•   What is multi valued dependency?
•   Explain BCNF.
•   Explain redundancy.
09/24/22            Manu Sharma   DBMS   Unit-3   157
                                     Quiz
Question 1:- When you normalize a relation by breaking it into
   two smaller relations, what must you do to maintain data
   integrity?
Please select all the correct answers.
A. Link the relations by a common field
B.Remove any functional dependencies from both relations
C .Assign both relations the same primary key field(s)
D .Create a primary key(s) for the new relation
Question 2:- A relation is in 1NF if it doesn't contain any
   ____________?
A. Determinants
B. Repeating groups
C. Null values in primary key fields
D. Functional dependencies
09/24/22               Manu Sharma    DBMS   Unit-3        158
                                   Quiz
Question 3:A functional dependency that exist between
   two non-key attributes is called _____
(a) Non-transitive dependency        (b) Transitive
   dependency
(c) Partial transitive dependency (d) None of the above
Question 4:-In the __________ normal form, a composite
  attribute is converted to individual attributes.
  a) First
  b) Second
  c) Third
  d) Fourth
09/24/22             Manu Sharma    DBMS   Unit-3        159
                           Daily Quiz
• Relation R has eight attributes ABCDEFGH. Fields of R
  contain only atomic values. F = {CH -> G, A -> BC, B ->
  CFH, E -> A, F -> EG} is a set of functional
  dependencies (FDs) so that F+ is exactly the set of FDs
  that hold for R. How many candidate keys does the
  relation R have? Gate 2013
• Answer: (B)
    Explanation: A+ is ABCEFGH which is all attributes
    except D.
•   B+ is also ABCEFGH which is all attributes except D.
•   E+ is also ABCEFGH which is all attributes except D.
•   F+ is also ABCEFGH which is all attributes except D.
•   So there are total 4 candidate keys AD, BD, ED and FD
09/24/22               Manu Sharma   DBMS   Unit-3     160
                        Glossary Questions
1. What are advantages and disadvantages of Distributed DBMS.
2. What are the features of DDBMS?
3. Explain the basic Timestamp Ordering Algorithm.
4. What are the objectives of Distributed Query Processing?
5. What is horizontal and vertical fragmentation? What are the types of
horizontal fragmentation. Perform horizontal Fragmentation for student
relation as given below.
Also give the corrextness criteria for it.
Students (studentrollno., Student Name, Course Name, Course Name,
Course fees, year)
6. What are the various kinds of transparencies in distributed database
design? Explain each with the help of example.
  09/24/22                 Manu Sharma   DBMS        Unit-1               161
                Weekly Assignment
• What do you mean by BCNF ? Why it is used and how
  it differ from 3 NF ? CO3
• Discuss the various normal forms in normalization with
  suitable examples? Why is concurrency control
  needed? Explain lost update, Inconsistent retrievals
  and uncommitted dependency anomalies. CO3
• Explain the Codd’s Rule in detail. CO3
• Explain Normalization with example. CO3
• What are the rules of 1NF,2NF,3NF. CO3
• Discuss Boyce Codd Normalization Form. CO3
09/24/22           Manu Sharma   DBMS   Unit-3       162
                                 MCQ s
• Which forms simplifies and ensures that there are
  minimal data aggregates and repetitive groups:
  a) 1NF
  b) 2NF
  c) 3NF
  d) All of the mentioned
• For any pincode, there is only one city and state. Also,
  for given street, city and state, there is just one
  pincode. In normalization terms, empdt1 is a relation
  in
  a) 1 NF only
  b) 2 NF and hence also in 1 NF
  c) 3NF and hence also in 2NF and 1NF
  d) BCNF and hence also in 3NF, 2NF and 1NF
09/24/22           Manu Sharma    DBMS   Unit-3         163
                                   MCQ s
•    In the __________ normal form, a composite attribute is
    converted to individual attributes.
    a) First
    b) Second
    c) Third
    d) Fourth
• Functional Dependencies are the types of constraints
  that are based on______
  a) Key
  b) Key revisited
  c) Superset key
  d) None of the mentioned
09/24/22             Manu Sharma    DBMS   Unit-3        164
           Sessional paper Template
              Manu Sharma        DBMS
09/24/22                                165
                            Unit-1
              Old Question Papers
• http://www.aktuonline.com/papers/btech-cs-5-sem-
  data-base-management-system-rcs501-2020.pdf
• http://www.aktuonline.com/papers/btech-cs-5-sem-
  database-management-system-KCS501-2018-19.pdf
• http://www.aktuonline.com/papers/btech-cs-5-sem-
  database-management-system-ncs-502-2017-18.pdf
• http://www.aktuonline.com/papers/btech-cs-5-sem-
  database-management-system-ncs-502-2016-17.pdf
09/24/22         Manu Sharma   DBMS   Unit-3     166
              Expected Questions for
                 University Exam
• Explain normalization. What is normal form?
• Describe the following terms :
   (i) Multivalued dependency
   (ii) Trigger
• Why do we normalize database?
• Define partial functional dependency. Consider the
  following two sets of functional dependencies F= {A -
  >C, AC ->D, E ->AD, E ->H} and G = {A ->CD, E -
  >AH}. Check whether or not they are equivalent.
• What is Trigger? Explain different trigger with example.
• Write difference between BCNF Vs 3 NF.
09/24/22           Manu Sharma   DBMS   Unit-3         167
                          Summary
• Knowledge of database design.
• Knowledge of functional dependencies.
• Knowledge of Normal forms.
• Knowledge    of  Loss   less   join  decomposition,
  Multivalued dependency and join dependency
09/24/22           Manu Sharma   DBMS   Unit-3     168
                          References
• Korth, Silbertz, Sudarshan,” Database Concepts”, McGraw
  Hill
• Date C J, “An Introduction to Database Systems”, Addision
  Wesley
• Elmasri, Navathe, “ Fundamentals of Database Systems”,
  Addision Wesley
• O’Neil, Databases, Elsevier Pub.
• RAMAKRISHNAN"Database Management Systems",McGraw
  Hill
• Leon &Leon,”Database Management Systems”, Vikas
  Publishing House
• Bipin C. Desai, “ An Introduction to Database Systems”,
  Galgotia Publications
• Majumdar&       Bhattacharya,    “Database  Management
  System”, TMH
• R.P. Mahapatra, Database Management System, Khanna
  Publishing House
09/24/22            Manu Sharma   DBMS   Unit-3         169
09/24/22   Manu Sharma   DBMS   Unit-3   170