Notes on the Relational Model:
As defined in “Relational Theory for Computer Professionals” by CJ Date.
1) An open ended collection of types, including type BOOLEAN in particular.
2) A relational type generator and an intended interpretation for relations of types generated thereby.
3) Facilities for defining relation variables of such generated types.
4) A relational assignment operator for assigning relation values to such relation variables.
5) A relationally complete, but otherwise open ended, collection of generic relational operators for deriving relation values from other relation values.
Algebraic Properties
Involution: Double Negation
Transitive: if (a=b) and (b=c) then (a=c)
Commutative: a+b = b+a
Associative: (a+b)+c=a+(b+c)
Distributive: a*(b+c)=a*b + a*c
Idempotence: An operation that can be applied multiple times to a value(s) and the same result is still achieved – for example, absolute value, max value.
DeMorgan’s Laws: Two parts
1. not(a and b)=(not a) or (not b)
2. not(a or b)=(not a) and (not b)
Relational Algebra – Based on set theory
Relational Calculus – Based on predicate calculus
RA and RC are equivalent
Range variable: subquery of the same table
select a.id from Table as a where code<(select b.code from Table as b where b.id=100)
a and b are range variables
The Information Principle: "The entire information content of the database at any given time is represented in one and only one way: namely, as explicit values in attribute positions in tuples in relations."
The Golden Rule: Violating a database constraint fails and raises an immediate error.
The Assignment Principal: After assignment of value v to a variable V, the comparison v = V must be true.
Relation = Relation Value
No duplicate rows, rows and columns aren't ordered, in 1NF (at least)
3 Valued Logic – True, False, Maybe
4 Valued – True, False, Maybe but applicable, Maybe but inapplicable
First order logic: “First-order logic is symbolized reasoning in which each sentence, or statement, is broken down into a subject and a predicate. The predicate modifies or defines the properties of the subject. In first-order logic, a predicate can only refer to a single subject. First-order logic is also known as first-order predicate calculus or first-order functional calculus.”
Relation – contents of a table
Table – relvar
Codd's Theorem: Relational algebra and relational calculus are equivalent in expressive power.