SlideShare uma empresa Scribd logo
1 de 27
•   Introduction
•   Characteristics Of “BAD” Schema
•   What Is Functional Dependency?
•   Armstrong’s Reference Rules
•   Equivalence & Minimal Cover
•   Normalization
•   Normalization Types And Details
•   BCNF
•   Higher Normal Forms
•   De-Normalization
•   Multi-valued Dependencies(MVD)
•   Join Dependencies
•   Inclusion Dependencies
•   Conclusion
•   References
• The main aim for Database Design is coming up with “GOOD” schema.
• Problem-
      1.How do we characterize the “GOODNESS” of a schema?

     2.If two or more alternative schemas are available ,
       how do we compare them?

     3.What are the problems with “BAD” schema?

• An example-
• Redundant storage of DATA
     - Office Phone & HOD info – stored redundantly-wastage of disk space

• A program that updates Office Phone of a department must change it at
several places
     - more running time & error prone

ANOMALIES-

 a. Insertion anomaly - No way of inserting info about a new department
unless we also enter details of a (dummy) student in department.

 b. Deletion anomaly – If all students of a certain department leave and we
delete their tuples , information about department itself is lost .

 c. Update anomaly – Updating office phone of a department
                 1. value in several tuples need to be changed
                 2.if a tuple is missed-inconsistency in data
• Functional dependencies (FDs) are used to specify formal measures of the
"goodness" of relational designs
• FDs and keys are used to define normal forms for relations.

NORMAL FORMS -
   1. Each NF specifies certain conditions.
   2. If the conditions are satisfied by the schema certain kind of problems
      are avoided
                                               Consider the schema
                                               Student(s.name,rollno.,gender,dept,
                                               h.name,roomno.}

                                                 Since rollno. Is a key,
                                                 Rollno. →{s.name,gender,dept,
                                                            h.name,roomno.}

                                                 Let each student is given a hostel room,
                                                 Then h.name,roomno. → rollno.
•Armstrong shows that
 Rules 1,2,3 are
sound &
 Complete.

•These are called
Armstrong’s
Axioms(AA)

SOUNDNESS-

•Every new FD X → Y
 Derived from a given
set of FDs
 F using AA is such
that F ╞ {X → Y)
COMPLETENESS-

• Any FD X→Y logically implied by F (i.e. F╞ {X→Y} ) can be derived from F
  using AA

CLOSURE OF A SET OF FDs-

• Closure of a set of FDs is the set F+ of all the FDs that can be inferred from F.
• Closure of a set of attributes X w.r.t F is the set of X + of all attributes that are
  Functionally determined by X
Ex- P{a, b, c, d, e, f}
      set of FDs F on it, as follows:
      F={a → d, b →{e, f}, {a, b }→ c}
     F+ :the closure of F
     a + ={a, d}
     b + ={b, e, f}
     {a, b} + ={a, b, c, d, e, f}
• EQUIVALENCE of sets of FDs:
   Two sets of FDs F & G are equivalent if F =G i.e. Every FD in F can be
   inferred from G & every FD in G can be inferred from F.

• EXTRANEOUS ATTRIBUTE:
   The removal of which attribute doesn’t change F + .
   Ex- Given F={A → C, AB → C}
   B is extraneous in AB → C as A → C logically implies AB → C .

• MINIMAL COVER:
 A minimal cover of a set of FDs G is a minimal set of dependencies F
   that is equivalent to E.
 Here F + =G +, if we modify G by deleting an FD or by deleting attribute
   From an FD in G, the closure changes.
 RHS of each FD in G is a single attribute.

Ex-{A → B, ABCD → E, EF → GH, ACDF → EG} has the following
   minimal Cover: {A → B, ACD → E, EF → G, EF → H}
Functional
                            dependency
 No transitive
                            of nonkey
 dependency
                            attributes on
 between
                            the primary
 nonkey
 attributes
                  Boyce-    key - Atomic
                            values only
                 Codd and
                  Higher    Full
All
determinants                Functional
are candidate               dependency
keys - Single               of nonkey
multivalued                 attributes on
dependency                  the primary
                            key
• Un-normalized relations:
   First step in normalization is to convert the data into 2D table.
   Data can be repeated within a column.

• First Normal Form (1 NF)
   Only atomic values at each row and column.

• Second Normal Form (2 NF)
 A relation is said to be in Second Normal Form when every non-key
attribute is fully functionally dependent on the primary key.

 Applicable for composite key & when there is composite key , there
may exist partial FD, which 2NF denies, So to get 2NF we have to
Decompose it into Relation schema.

   After Decomposition , it is Lossless or NOT should be verified.
•   Full Functional Dependency:

A FD X → Y is said to be a FULL FD if after removal of any attribute from
X, the FD doesn’t hold good anymore.

•   Partial Functional Dependency:

A FD X → Y is partial FD if {X-A} → Y is also true.

•   Decomposition:

 Let R=(A,B,C,D)

     X=(P,Q,S,T) st. R= P υ Q υ S υ T

 Replacing R by P,Q,S,T- process of decomposing R
DESIRABLE PROPERTIES OF DECOMPOSITION:

•   Not all Decomposition of a schema are useful.
•   We require two properties to be satisfied.

    Lossless join property- The information in an instance r of R
      must be preserved in the instances .

* If R is decomposed into P , Q and P ∩ Q ≠ Φ , then it is lossless.

    Dependency preserving property:- if a set F of dependencies
      hold on R it should be possible to enforcing appropriate
      dependencies on each r.
• EID → Name, Address, Birthdate
• EID, Pname → StartDate
• Candidate key is {EID, PName}.
• The nonprime attributes are Name, Address, Birthdate, StartDate.
• Nonprime attributes Name, Address, Birthdate violate 2NF because they
are functionally dependent
• 2NF, plus no transitive functional dependencies.
• Given three attributes in a relation A, B, C, if A  B and B  C, this
forms a transitive functional dependency.
• Avoid transitive dependencies for 3NF
Ex-


                                                            Here,
                                                            Customer_ID
                                                            
                                                             Salesperson,
                                                            and
                                                            Salesperson
                                                            Region,
                                                            cause a
                                                            transitive
                                                            dependency
Solution:
• Most 3NF relations are also BCNF relations.
• A 3NF relation is NOT in BCNF if:
     Candidate keys in the relation are composite keys (they are not
    single attributes)
     There is more than one candidate key in the relation, and
     The keys are not disjoint, that is, some attributes in the keys are
    common
    Patient # Patient Name Patient Address
                          15 New St. New
         1111 John White York, NY
                          10 Main St. Rye,
         1234 Mary Jones NY
              Charles     Dogwood Lane
         2345 Brown       Harrison, NY
                          55 Boston Post
         4876 Hal Kane    Road, Chester,
                          Blind Brook
         5123 Paul Kosher Mamaroneck, NY
                          Hilton Road
         6845 Ann Hood    Larchmont, NY
Fourth Normal Form ( 4 NF)
• Any relation is in Fourth Normal Form if it is BCNF and any multi-valued dependencies are
   trivial
• Eliminate non-trivial multi-valued dependencies by projecting into simpler tables

JOIN DEPENDENCIES
• A join dependency denoted by JD (R1,R2,R3,……Rn), specified on relational 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
 NOTE - An MVD is a special case of JD where n=2
         i.e. a JD denoted as JD (R1,R2)
               implies an MVD (R1∩R2) →→(R1-R2)

Fifth Normal Form
• A relation is in 5NF if every join dependency in the relation is implied by the keys of the
  relation.
• Implies that relations that have been decomposed in previous NF can be recombined
   via natural joins to recreate the original relation
• De-normalization is the process of modifying a
perfectly normalized database design for performance
reasons.

• It is a natural and necessary part of database
design, but must follow proper normalization.

• It always makes your system potentially less
efficient and flexible.

  So de-normalize as needed, but not frivolously.
Customer        After:    Customer
Before:
            ID                        ID
            Address                   Address
            Name                      Name
            Telephone                 Telephone


          Order                      Order
          Order No                   Order No
          Date Taken                 Date Taken
          Date Dispatched            Date Dispatched
          Date Invoiced              Date Invoiced
          Cust ID                    Cust ID
                                     Cust Name
• The foreign key(or referential integrity)constraint can not be specified as
a functional or multi-valued dependency because it relates attributes across
relations.

• An ID R.X<S.Y between two sets of attributes – X of relation schema R &
y of relation schema S – specifies the constraint that at any specific time
when r is a relation state of R and s a relation state of S , we have

                        ╥y(s(S)) ⊇ ╥x(r(R))

 Condition

• X of R and Y of S must have same no. of attribute.
• The domains for each pair of corresponding attribute should be
compatible.

 So far no normal form have been developed based on ID
• After we have the ER diagrams each relation in the schema must be
independently reviewed and normalized when needed.

• Functional dependencies are the building blocks that enable the
analysis of data redundancy and the elimination of anomalies caused
by data redundancy through the process of normalization

• Normalization is a technique that facilitates systematic validation
of participation of attributes in a relation schema from a perspective
of data redundancy.

• This process gives us the final opportunity to correct errors and
establish a robust design before implementing the database system
• Fundamentals of Database systems,5th edition by Ramez Elmasari,
Shamkant B. Navathe

• Database system concepts by A. Seilberschatz, H. korth, S
Sudersan

•    An introduction to Database system by C.J. Date

• Lotito, J. (2001). Concepts of Database Design and Management.
Retrived September 2007 from
http://www.sitepoint.com/article/database-design-management

•    Scamell, R.W., & Umanath N.S. (2007). Data Modeling and
    Database Design: Boston, MA: Thomson
Theory of dependencies in relational database
Theory of dependencies in relational database

Mais conteúdo relacionado

Mais procurados

SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries InformationNishant Munjal
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationBIT Durg
 
Hashing algorithms and its uses
Hashing algorithms and its usesHashing algorithms and its uses
Hashing algorithms and its usesJawad Khan
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalizationdaxesh chauhan
 
Decomposition methods in DBMS
Decomposition methods in DBMSDecomposition methods in DBMS
Decomposition methods in DBMSsoniyagoyal3
 
Linked List - Insertion & Deletion
Linked List - Insertion & DeletionLinked List - Insertion & Deletion
Linked List - Insertion & DeletionAfaq Mansoor Khan
 
B trees in Data Structure
B trees in Data StructureB trees in Data Structure
B trees in Data StructureAnuj Modi
 
Functions oracle (pl/sql)
Functions oracle (pl/sql)Functions oracle (pl/sql)
Functions oracle (pl/sql)harman kaur
 
Algorithm: Quick-Sort
Algorithm: Quick-SortAlgorithm: Quick-Sort
Algorithm: Quick-SortTareq Hasan
 

Mais procurados (20)

SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
 
Hashing algorithms and its uses
Hashing algorithms and its usesHashing algorithms and its uses
Hashing algorithms and its uses
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalization
 
Joins And Its Types
Joins And Its TypesJoins And Its Types
Joins And Its Types
 
Decomposition methods in DBMS
Decomposition methods in DBMSDecomposition methods in DBMS
Decomposition methods in DBMS
 
Stacks
StacksStacks
Stacks
 
Lossless decomposition
Lossless decompositionLossless decomposition
Lossless decomposition
 
Singly & Circular Linked list
Singly & Circular Linked listSingly & Circular Linked list
Singly & Circular Linked list
 
Rehashing
RehashingRehashing
Rehashing
 
Merge sort algorithm
Merge sort algorithmMerge sort algorithm
Merge sort algorithm
 
Linked List - Insertion & Deletion
Linked List - Insertion & DeletionLinked List - Insertion & Deletion
Linked List - Insertion & Deletion
 
B trees dbms
B trees dbmsB trees dbms
B trees dbms
 
Advanced sql
Advanced sqlAdvanced sql
Advanced sql
 
B trees in Data Structure
B trees in Data StructureB trees in Data Structure
B trees in Data Structure
 
Queues in C++
Queues in C++Queues in C++
Queues in C++
 
Functions oracle (pl/sql)
Functions oracle (pl/sql)Functions oracle (pl/sql)
Functions oracle (pl/sql)
 
Create table
Create tableCreate table
Create table
 
Algorithm: Quick-Sort
Algorithm: Quick-SortAlgorithm: Quick-Sort
Algorithm: Quick-Sort
 
Join
JoinJoin
Join
 

Destaque

functional dependencies with example
functional dependencies with examplefunctional dependencies with example
functional dependencies with exampleSiddhi Viradiya
 
Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management SystemDrishti Bhalla
 
Functional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databasesFunctional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databasesJafar Nesargi
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLEVraj Patel
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Jargalsaikhan Alyeksandr
 
Databaseconcepts
DatabaseconceptsDatabaseconcepts
Databaseconceptskissumadanu
 
Bsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalizationBsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalizationRai University
 
Shashi DATABASE FUNCTIONAL DEPENDENCY QUESTION
Shashi  DATABASE FUNCTIONAL DEPENDENCY QUESTIONShashi  DATABASE FUNCTIONAL DEPENDENCY QUESTION
Shashi DATABASE FUNCTIONAL DEPENDENCY QUESTIONShashi Kumar
 
Multivalued dependency
Multivalued dependencyMultivalued dependency
Multivalued dependencyavniS
 
Ism normalization pine valley 2012
Ism normalization pine valley 2012Ism normalization pine valley 2012
Ism normalization pine valley 2012Akshit R Shah
 
NORMALIZATION - BIS 1204: Data and Information Management I
NORMALIZATION - BIS 1204: Data and Information Management I NORMALIZATION - BIS 1204: Data and Information Management I
NORMALIZATION - BIS 1204: Data and Information Management I Mukalele Rogers
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in DatabaseRoshni Singh
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Oum Saokosal
 

Destaque (20)

functional dependencies with example
functional dependencies with examplefunctional dependencies with example
functional dependencies with example
 
Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management System
 
Functional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databasesFunctional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databases
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
 
Databaseconcepts
DatabaseconceptsDatabaseconcepts
Databaseconcepts
 
Bsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalizationBsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalization
 
Normalization
NormalizationNormalization
Normalization
 
1 fn dependency
1 fn dependency1 fn dependency
1 fn dependency
 
Shashi DATABASE FUNCTIONAL DEPENDENCY QUESTION
Shashi  DATABASE FUNCTIONAL DEPENDENCY QUESTIONShashi  DATABASE FUNCTIONAL DEPENDENCY QUESTION
Shashi DATABASE FUNCTIONAL DEPENDENCY QUESTION
 
Multivalued dependency
Multivalued dependencyMultivalued dependency
Multivalued dependency
 
Ism normalization pine valley 2012
Ism normalization pine valley 2012Ism normalization pine valley 2012
Ism normalization pine valley 2012
 
Ch7
Ch7Ch7
Ch7
 
Normalization
NormalizationNormalization
Normalization
 
Normlaization
NormlaizationNormlaization
Normlaization
 
NORMALIZATION - BIS 1204: Data and Information Management I
NORMALIZATION - BIS 1204: Data and Information Management I NORMALIZATION - BIS 1204: Data and Information Management I
NORMALIZATION - BIS 1204: Data and Information Management I
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)
 
Anomalies in database
Anomalies in databaseAnomalies in database
Anomalies in database
 

Semelhante a Theory of dependencies in relational database

Semelhante a Theory of dependencies in relational database (20)

chapter_8.pptx
chapter_8.pptxchapter_8.pptx
chapter_8.pptx
 
Normalization
NormalizationNormalization
Normalization
 
Normalisation
NormalisationNormalisation
Normalisation
 
Normal forms & Normalization.pptx
Normal forms & Normalization.pptxNormal forms & Normalization.pptx
Normal forms & Normalization.pptx
 
UNIT-IV.ppt
UNIT-IV.pptUNIT-IV.ppt
UNIT-IV.ppt
 
Normalization
NormalizationNormalization
Normalization
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Normalization1
Normalization1Normalization1
Normalization1
 
Database Systems - Normalization of Relations(Chapter 4/3)
Database Systems - Normalization of Relations(Chapter 4/3)Database Systems - Normalization of Relations(Chapter 4/3)
Database Systems - Normalization of Relations(Chapter 4/3)
 
functional dependency in engineering.pptx
functional dependency in engineering.pptxfunctional dependency in engineering.pptx
functional dependency in engineering.pptx
 
Functional dependancy
Functional dependancyFunctional dependancy
Functional dependancy
 
Normalization
NormalizationNormalization
Normalization
 
Database Presentation
Database PresentationDatabase Presentation
Database Presentation
 
Chapter10
Chapter10Chapter10
Chapter10
 
DBMS 3.pdf
DBMS 3.pdfDBMS 3.pdf
DBMS 3.pdf
 
Normalization
NormalizationNormalization
Normalization
 
Normalization
NormalizationNormalization
Normalization
 
chapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdfchapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdf
 
Distributed DBMS - Unit 2 - Overview of RDBMS
Distributed DBMS - Unit 2 - Overview of RDBMSDistributed DBMS - Unit 2 - Overview of RDBMS
Distributed DBMS - Unit 2 - Overview of RDBMS
 
Normal forms.ppt
Normal forms.pptNormal forms.ppt
Normal forms.ppt
 

Último

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 

Último (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Theory of dependencies in relational database

  • 1.
  • 2. Introduction • Characteristics Of “BAD” Schema • What Is Functional Dependency? • Armstrong’s Reference Rules • Equivalence & Minimal Cover • Normalization • Normalization Types And Details • BCNF • Higher Normal Forms • De-Normalization • Multi-valued Dependencies(MVD) • Join Dependencies • Inclusion Dependencies • Conclusion • References
  • 3. • The main aim for Database Design is coming up with “GOOD” schema. • Problem- 1.How do we characterize the “GOODNESS” of a schema? 2.If two or more alternative schemas are available , how do we compare them? 3.What are the problems with “BAD” schema? • An example-
  • 4. • Redundant storage of DATA - Office Phone & HOD info – stored redundantly-wastage of disk space • A program that updates Office Phone of a department must change it at several places - more running time & error prone ANOMALIES- a. Insertion anomaly - No way of inserting info about a new department unless we also enter details of a (dummy) student in department. b. Deletion anomaly – If all students of a certain department leave and we delete their tuples , information about department itself is lost . c. Update anomaly – Updating office phone of a department 1. value in several tuples need to be changed 2.if a tuple is missed-inconsistency in data
  • 5. • Functional dependencies (FDs) are used to specify formal measures of the "goodness" of relational designs • FDs and keys are used to define normal forms for relations. NORMAL FORMS - 1. Each NF specifies certain conditions. 2. If the conditions are satisfied by the schema certain kind of problems are avoided Consider the schema Student(s.name,rollno.,gender,dept, h.name,roomno.} Since rollno. Is a key, Rollno. →{s.name,gender,dept, h.name,roomno.} Let each student is given a hostel room, Then h.name,roomno. → rollno.
  • 6.
  • 7.
  • 8. •Armstrong shows that Rules 1,2,3 are sound & Complete. •These are called Armstrong’s Axioms(AA) SOUNDNESS- •Every new FD X → Y Derived from a given set of FDs F using AA is such that F ╞ {X → Y)
  • 9. COMPLETENESS- • Any FD X→Y logically implied by F (i.e. F╞ {X→Y} ) can be derived from F using AA CLOSURE OF A SET OF FDs- • Closure of a set of FDs is the set F+ of all the FDs that can be inferred from F. • Closure of a set of attributes X w.r.t F is the set of X + of all attributes that are Functionally determined by X Ex- P{a, b, c, d, e, f} set of FDs F on it, as follows: F={a → d, b →{e, f}, {a, b }→ c} F+ :the closure of F a + ={a, d} b + ={b, e, f} {a, b} + ={a, b, c, d, e, f}
  • 10. • EQUIVALENCE of sets of FDs: Two sets of FDs F & G are equivalent if F =G i.e. Every FD in F can be inferred from G & every FD in G can be inferred from F. • EXTRANEOUS ATTRIBUTE: The removal of which attribute doesn’t change F + . Ex- Given F={A → C, AB → C} B is extraneous in AB → C as A → C logically implies AB → C . • MINIMAL COVER:  A minimal cover of a set of FDs G is a minimal set of dependencies F that is equivalent to E.  Here F + =G +, if we modify G by deleting an FD or by deleting attribute From an FD in G, the closure changes.  RHS of each FD in G is a single attribute. Ex-{A → B, ABCD → E, EF → GH, ACDF → EG} has the following minimal Cover: {A → B, ACD → E, EF → G, EF → H}
  • 11. Functional dependency No transitive of nonkey dependency attributes on between the primary nonkey attributes Boyce- key - Atomic values only Codd and Higher Full All determinants Functional are candidate dependency keys - Single of nonkey multivalued attributes on dependency the primary key
  • 12. • Un-normalized relations: First step in normalization is to convert the data into 2D table. Data can be repeated within a column. • First Normal Form (1 NF) Only atomic values at each row and column. • Second Normal Form (2 NF)  A relation is said to be in Second Normal Form when every non-key attribute is fully functionally dependent on the primary key.  Applicable for composite key & when there is composite key , there may exist partial FD, which 2NF denies, So to get 2NF we have to Decompose it into Relation schema.  After Decomposition , it is Lossless or NOT should be verified.
  • 13. Full Functional Dependency: A FD X → Y is said to be a FULL FD if after removal of any attribute from X, the FD doesn’t hold good anymore. • Partial Functional Dependency: A FD X → Y is partial FD if {X-A} → Y is also true. • Decomposition:  Let R=(A,B,C,D) X=(P,Q,S,T) st. R= P υ Q υ S υ T  Replacing R by P,Q,S,T- process of decomposing R
  • 14. DESIRABLE PROPERTIES OF DECOMPOSITION: • Not all Decomposition of a schema are useful. • We require two properties to be satisfied.  Lossless join property- The information in an instance r of R must be preserved in the instances . * If R is decomposed into P , Q and P ∩ Q ≠ Φ , then it is lossless.  Dependency preserving property:- if a set F of dependencies hold on R it should be possible to enforcing appropriate dependencies on each r.
  • 15. • EID → Name, Address, Birthdate • EID, Pname → StartDate • Candidate key is {EID, PName}. • The nonprime attributes are Name, Address, Birthdate, StartDate. • Nonprime attributes Name, Address, Birthdate violate 2NF because they are functionally dependent
  • 16. • 2NF, plus no transitive functional dependencies. • Given three attributes in a relation A, B, C, if A  B and B  C, this forms a transitive functional dependency. • Avoid transitive dependencies for 3NF Ex- Here, Customer_ID  Salesperson, and Salesperson Region, cause a transitive dependency
  • 18. • Most 3NF relations are also BCNF relations. • A 3NF relation is NOT in BCNF if:  Candidate keys in the relation are composite keys (they are not single attributes)  There is more than one candidate key in the relation, and  The keys are not disjoint, that is, some attributes in the keys are common Patient # Patient Name Patient Address 15 New St. New 1111 John White York, NY 10 Main St. Rye, 1234 Mary Jones NY Charles Dogwood Lane 2345 Brown Harrison, NY 55 Boston Post 4876 Hal Kane Road, Chester, Blind Brook 5123 Paul Kosher Mamaroneck, NY Hilton Road 6845 Ann Hood Larchmont, NY
  • 19.
  • 20. Fourth Normal Form ( 4 NF) • Any relation is in Fourth Normal Form if it is BCNF and any multi-valued dependencies are trivial • Eliminate non-trivial multi-valued dependencies by projecting into simpler tables JOIN DEPENDENCIES • A join dependency denoted by JD (R1,R2,R3,……Rn), specified on relational 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 NOTE - An MVD is a special case of JD where n=2 i.e. a JD denoted as JD (R1,R2) implies an MVD (R1∩R2) →→(R1-R2) Fifth Normal Form • A relation is in 5NF if every join dependency in the relation is implied by the keys of the relation. • Implies that relations that have been decomposed in previous NF can be recombined via natural joins to recreate the original relation
  • 21. • De-normalization is the process of modifying a perfectly normalized database design for performance reasons. • It is a natural and necessary part of database design, but must follow proper normalization. • It always makes your system potentially less efficient and flexible. So de-normalize as needed, but not frivolously.
  • 22. Customer After: Customer Before: ID ID Address Address Name Name Telephone Telephone Order Order Order No Order No Date Taken Date Taken Date Dispatched Date Dispatched Date Invoiced Date Invoiced Cust ID Cust ID Cust Name
  • 23. • The foreign key(or referential integrity)constraint can not be specified as a functional or multi-valued dependency because it relates attributes across relations. • An ID R.X<S.Y between two sets of attributes – X of relation schema R & y of relation schema S – specifies the constraint that at any specific time when r is a relation state of R and s a relation state of S , we have ╥y(s(S)) ⊇ ╥x(r(R))  Condition • X of R and Y of S must have same no. of attribute. • The domains for each pair of corresponding attribute should be compatible.  So far no normal form have been developed based on ID
  • 24. • After we have the ER diagrams each relation in the schema must be independently reviewed and normalized when needed. • Functional dependencies are the building blocks that enable the analysis of data redundancy and the elimination of anomalies caused by data redundancy through the process of normalization • Normalization is a technique that facilitates systematic validation of participation of attributes in a relation schema from a perspective of data redundancy. • This process gives us the final opportunity to correct errors and establish a robust design before implementing the database system
  • 25. • Fundamentals of Database systems,5th edition by Ramez Elmasari, Shamkant B. Navathe • Database system concepts by A. Seilberschatz, H. korth, S Sudersan • An introduction to Database system by C.J. Date • Lotito, J. (2001). Concepts of Database Design and Management. Retrived September 2007 from http://www.sitepoint.com/article/database-design-management • Scamell, R.W., & Umanath N.S. (2007). Data Modeling and Database Design: Boston, MA: Thomson