574 Chapter 16 Relational Database Design Algorithms and Further Dependencies
16.6.3 Functional Dependencies Based on Arithmetic
Functions and Procedures
Sometimes some attributes in a relation may be related via some arithmetic func-
tion or a more complicated functional relationship. As long as a unique value of Y is
associated with every X, we can still consider that the FD X → Y exists. For example,
in the relation
ORDER_LINE (Order#, Item#, Quantity, Unit_price, Extended_price,
Discounted_price)
each tuple represents an item from an order with a particular quantity, and the price
per unit for that item. In this relation, (
Quantity, Unit_price ) → Extended_price by the
formula
Extended_price = Unit_price
*
Quantity.
Hence, there is a unique value for Extended_price for every pair (Quantity, Unit_price ),
and thus it conforms to the definition of functional dependency.
Moreover, there may be a procedure that takes into account the quantity discounts,
the type of item, and so on and computes a discounted price for the total quantity
ordered for that item. Therefore, we can say
(
Item#, Quantity, Unit_price ) → Discounted_price,or
(
Item#, Quantity, Extended_price) → Discounted_price.
To check the above FD, a more complex procedure COMPUTE_TOTAL_PRICE may
have to be called into play. Although the above kinds of FDs are technically present
in most relations, they are not given particular attention during normalization.
16.6.4 Domain-Key Normal Form
There is no hard-and-fast rule about defining normal forms only up to 5NF.
Historically, the process of normalization and the process of discovering undesir-
able dependencies were carried through 5NF, but it has been possible to define
stricter normal forms that take into account additional types of dependencies and
constraints. The idea behind domain-key normal form (DKNF) is to specify (theo-
retically, at least) the ultimate normal form that takes into account all possible types
of dependencies and constraints. A relation schema is said to be in DKNF if all con-
straints and dependencies that should hold on the valid relation states can be
enforced simply by enforcing the domain constraints and key constraints on the
relation. For a relation in DKNF, it becomes very straightforward to enforce all data-
base constraints by simply checking that each attribute value in a tuple is of the
appropriate domain and that every key constraint is enforced.
However, because of the difficulty of including complex constraints in a DKNF rela-
tion, its practical utility is limited, since it may be quite difficult to specify general
integrity constraints. For example, consider a relation
CAR(Make, Vin#)(where Vin#
is the vehicle identification number) and another relation MANUFACTURE(Vin#,