Professional Documents
Culture Documents
Relvar R is in 4 NF if and only if, whenever there exist subsets A and B of the attributes
of R such that the nontrivial multi-valued dependency A multi-determines B is satisfied,
then all attributes of R are also functionally dependent on A
In the previous example, decompose course, teacher, text into two relvars: course teacher,
and course text
There exist relvars that cannot be nonloss-decomposed into two relvars, but can be
nonloss-decomposed into more than two
Ex.: supplier, part, project
A supplier supplies parts and projects, a project is supplied by suppliers and parts, but
from this you may not validly conclude that a particular supplier supplies a particular part
to a particular project
Let R be a relvar, and let A, B, … Z be subsets of the attributes of R. Then we say that R
satisfies the JD
* ( A, B, …. Z )
if and only if every legal value of R is equal to the join of its projections on A, B, … Z
Supplier, part, project can be said to satisfy this only if an additional constraint is included
to make the specific conclusion valid
A relvar R is in 5NF – also called projection-join normal form, if and only if every
nontrivial join dependency that is satisfied by R is implied by the candidate key(s) of R
In the general case, SPJ is not in 5NF, but SP, PJ, and JS are in 5NF
5NF is a generalization of 4NF, which is a generalization of 3NF
It is the most general form possible for projection-based normalization
Using a relvar in BCNF, take projections to eliminate MVDs that are not also FDs
In practice it is unlikely that you will need to do this, because you will have eliminated
independent relation valued attributes before you began
Take projections of 4NF relvars to eliminate JDs that are not implied by the candidate
keys, if you can find any
By definition 5NF is the final normal form for decompositions based on projection
All anomalies are a result of FDs or MVDs or JDs that are not implied by the candidate
keys
Mathematical relations are complete in 1NF; successive steps are needed because
database relations are semantic: they are based on the real world meaning of the data
If you design well from the top, the design will be normalized from the beginning
Within a given database, no two distinct base relvars should have overlapping meanings
Let A and B be distinct base relvars. Then there must not exist nonloss decompositions of
A and B into A1, A2 …, Am and B1, B2, …, Bn such that some projection of Ai in the set
A1, A2, …, Am and some projection of Bj in the set B1, B2, …, Bn have overlapping
meanings
Base relvars should have mutually independent meanings
Restriction-union normal form applies when we segment the relvar horizontally, i.e. via
restriction rather than projection
Sixth normal form represents a generalization of join dependency, which would require a
generalization of the projection and join operators
By definition, a relvar in 6NF is in 5NF
Further research on dependency theory is underway
Any action that reads from and/or writes to a database may consist of
Simple SELECT statement to generate a list of table contents
A series of related UPDATE statements to change the values of attributes in various
tables
A series of INSERT statements to add rows to one or more tables
A combination of SELECT, UPDATE, and INSERT statements
What is a Transaction? (continued)
Figure 9.2
Transaction Properties
Atomicity
Requires that all operations (SQL requests) of a
transaction be completed
Transaction-Level Atomicity: The entire goal of a transaction, a set of SQL statements executed together
as a unit of work, is to take the database from one consistent state to another consistent state. To
accomplish this goal, transactions are atomic as well—the entire set of successful work performed by a
transaction is either entirely committed and made permanent or rolled back and undone. Just like a
statement, the transaction is an atomic unit of work. Upon receipt of “success” from the database after
committing a transaction, you know that all of the work performed by the transaction has been made
Durability
persistent.
Serializability
Ensures that the concurrent execution of several transactions yields consistent
results
Isolation
Data used during execution of a transaction cannot be used by second transaction
until first one is completed
Integrity Constraints and Transactions
Integrity Constraints and Transactions It is interesting to note exactly when integrity constraints are checked. By default, integrity
constraints are checked after the entire SQL statement has been processed. There are also deferrable constraints that permit
the validation of integrity constraints to be postponed until either the application requests they be validated by issuing a SET
CONSTRAINTS ALL IMMEDIATE command or upon issuing a COMMIT.
IMMEDIATE Constraints For the first part of this discussion, we’ll assume that constraints are in IMMEDIATE mode, which is the
norm. In this case, the integrity constraints are checked immediately after the entire SQL statement has been processed. Note
that I used the term “SQL statement,” not just “statement.” If I have many SQL statements in a PL/SQL stored procedure, each
SQL statement will have its integrity constraints validated immediately after its individual execution, not after the stored
procedure completes. So, why are constraints validated after the SQL statement executes? Why not during? This is because it
is very natural for a single statement to make individual rows in a table momentarily inconsistent. Taking a look at the partial
work by a statement would result in Oracle rejecting the results, even if the end result would be OK. For example, suppose we
have a table like this:
EODA@ORA12CR1> commit;
Commit complete.
And we want to execute a multiple-row UPDATE:
EODA@ORA12CR1> update t set x=x-1;
2 rows updated.
Transaction Management with
SQL
Stores
A record for the beginning of transaction
For each transaction component (SQL statement)
Type of operation being performed (update, delete, insert)
Names of objects affected by the transaction (the name of the table)
“Before” and “after” values for updated fields
Pointers to previous and next transaction log entries for the same transaction