Either, its major uses within a database and associated applications are such that it need not be divided further
Or, a type exists for that attribute within the database engine such that component parts of the attribute can be treated as distinct and indivisible attributes.
Examples
The attribute courseID, with values like ECE208, ECE250, ECE356, is not atomic in the context of a university database, since there are other departmental prefixes, such as SE, CS and MATH. However, in the context of a departmental database, where the only departmental prefix is ECE, the attribute courseID is atomic, since the division into course prefixes and course codes does not serve a major purpose given the context of the database.
Additionally, a datetime object in the MySQL database engine can be described as atomic. While it is divisible into second, minute, hour, day, month and year, this object type is defined in the MySQL database and is made up of distinct, indivisible attributes. Hence it can be considered atomic.
Simple Functions
A function is a simple function if and only if it is computable without the use of explicit mapping.
Examples
is a simple function.
as defined by the table
0
0
1
1
2
4
3
9
is not a simple function.
Non-Redundancy
An attribute is non-redundant if and only if it is neither an input to, nor the result of, a simple function.
In contrast, an attribute is redundant if and only if it is either an input to, or the result of, a simple function.
Examples
Consider a section relation defined with attributes as follows:
The attribute semester is a term code combined with the last two digits of the year. For eg. W21 represents "winter 2021".
Hence, there exists a simple function that can extract the year out of the semester.
This means neither of the attributes semester or year are non-redundant.
Lossless Decomposition
A decomposition of relation into relations and is lossless if and only if
In other words, it is a lossless decomposition if and only if joining relations and using all the attributes that are common in both results in the relation .
More specifically, if relation is has attributes for :
then, relations and derived from the lossless decomposition of relation are defined as:
where some attributes are in both and (i.e. ) and some attributes are in only (i.e. ) or in only (i.e. ). Note that there are no attributes that are not in either of and .
Functional Dependencies
Given attributes in a relation, a functional dependency is a function that uniquely maps the values of a set of attributes to the values of another set of attributes. The notation for functional dependencies is as follows:
Formal Definition
Consider a relation schema , and , as subsets of attributes of :
Then, the functional dependency,
holds if and only if, for any relation , whenever any two tuples and agree on attributes , they also agree on attributes . That is,
Examples
Because everyone in Canada has a Social Insurance Number (SIN), there exists a functional dependency such that SINName. This is because a person's social insurance number functionally determines their name. In other words, if we know the SIN, we know their name.
Properties
Identity
Reflexivity
Augmentation
Transitivity
Closures
Given a set of functional dependencies , the closure of , denoted as is defined as the set of all possible functional dependencies logically implied by using the properties of functional dependencies. This also implies
Attribute-Set Closures
Given a relation , a set of functional dependencies and a set of attributes , the attribute-set closure is defined as the set of all attributes that can be logically determined using the attributes in .
Extraneous Attributes
Given a set of functional dependencies , functional dependency , an attribute is extraneous in if and only if,
In other words, is not a necessary attribute in the functional dependency .
Examples
Consider a set of functional dependencies :
Here, is an extraneous attribute in , since we already know that . Hence is not needed in that functional dependency.
Canonical Covers
Given a set of functional dependencies , the canonical cover of , is a minimal set of functional dependencies such that
there exists no functional dependency such that is implied by the set of functional dependencies
there exists functional dependency with extraneous attributes.
Examples
Consider a set of functional dependencies :
We know that,
Hence, is a redundant functional dependency, which means is not a canonical cover. However, defined as,
is a canonical cover.
Keys
Super Keys
Consider the set of all attributes in relation , and set of attributes . Then, is a super key of if and only if .
In other words, in order for to be a super key, all the attributes in must be logically determinable by the attributes in .
Candidate Keys
If is a super key of , and there exists no that is also a super key, then is a candidate key of .
In other words, is a candidate key if and only if removing any attribute from will result in it losing its super key status.
Determining Candidate Key Attributes
Consider the set of all attributes in relation and a canonical cover . We can make the following statements about candidate keys for .
Required Present
Any attribute that does not appear on the right-hand side of any functional dependency must be present in every candidate key of .
Required Absent 1
Any attribute that does not appear on the left-hand side of any functional dependency but appears on the right-hand side of at least one functional dependency must be absent in every candidate key of .
Required Absent 2
Any attribute that appears on the right-hand side of any functional dependency where all the attributes on the left-hand side are required, must be absent in every candidate key of .
Maybe Present
Any attribute that appears on the left-hand side of some functional dependency and the right hand-side of some other functional dependency must be absent in at least one candidate key of .
First Normal Form
Given a relation with the set of all attributes , is in first normal form if and only if every attribute in is atomic. In other words, if any of the attributes can be divided into multiple attributes for major uses within the context of the database and is not a type that is supported as multiple values in the database engine, the relation is not in first normal form.
Third Normal Form
Given a relation with the set of all attributes and a set of functional dependencies , is in third normal form if and only if, for every functional dependency in , at least one of the following is true:
is a super key for
is an attribute that exists in some candidate key.
Intuitively, third normal form is just enforcing a table to describe a single entity. By requiring every functional dependency to either have as a super key or have every attribute in in at least one candidate key, it is enforcing that every attribute in this relation is a part of the same entity and cannot be neatly broken down into multiple entities.
Third Normal Form Decomposition
The steps for decomposing relation to multiple relations that are in third normal form are as follows:
For each functional dependency , create relation and add it to the schema
If any attributes are left out, add them in a relation with a candidate key
Optimize the relations to get rid of relations that are redundant
Boyce-Codd Normal Form
Given a relation with the set of all attributes and a set of functional dependencies , is in Boyce-Codd normal form if and only if, for every functional dependency in , at least one of the following is true:
is a super key for
Boyce-Codd Normal Form Decomposition
The steps for decomposing relation to multiple relations that are in Boyce-Codd normal form are as follows:
For each functional dependency that is not BCNF compliant, create relations and