CSC 310 DATABASE DESIGN - Relational - Model - April - 2021-1
CSC 310 DATABASE DESIGN - Relational - Model - April - 2021-1
CSC 310 DATABASE DESIGN - Relational - Model - April - 2021-1
Structure: content
I. Introduction
II. Relational Model Concepts
III. Relational Model Constraints
IV. Operations on the Relational Model
V. Relational Algebra
VI. Relational Database Management Systems
1
4/13/2021
Structure: objectives
At the end of this notes the reader will be able to:
• Describe Relational Model Concepts
• Describe properties of a relation and relational keys
• Describe relational model/integrity constraints
• Describe The Relational Algebra
Introduction
The principles of the relational model were first outlined
• proposed by Edgar Codd in 1969
• centered around its primary element: the relation
• everything is a relation in this model
The more popular models used at that time were hierarchical and network, or even
simple flat file data structures.
Relational database management systems (RDBMS) were designed and soon became
very popular, especially for their ease of use and flexibility in structure.
Dr. NYAMSI 12/04/2021 4
2
4/13/2021
Introduction
Earlier we saw
• how to convert an unorganized text description of information requirements
into a conceptual design,
• by the use of ER diagrams (Covert in the design part of this course).
Introduction
The advantage of ER diagrams is that
• They force you to identify data requirements that are implicitly known, but
not explicitly written down in the original description.
• We design the database to what we call Entity/Relation (ER) model
• We therefore convert this ER into a logical design of a relational database.
• The logical model is also called a Relational Model .
3
4/13/2021
4
4/13/2021
5
4/13/2021
6
4/13/2021
7
4/13/2021
8
4/13/2021
9
4/13/2021
10
4/13/2021
11
4/13/2021
12
4/13/2021
13
4/13/2021
14
4/13/2021
15
4/13/2021
16
4/13/2021
17
4/13/2021
Relational Algebra
• Relational algebra:
• A collection of operations each acting on one or two relations and
producing one relation as result,
• A language for combining those operations
• The algebra has played a central role in the relational model: algebraic
operations characterize high-level set-at-a-time access
Relational Algebra
• The algebra in practice
• It was never a real user language (calculus-based languages and SQL are
simpler)
• Its semantics is clear and a de facto standard
• A precise syntax for the algebra is more complicated than its semantics
18
4/13/2021
Relational Algebra
• It consist of six fundamentals operations
• Unary operations: selection, projection and rename
• Binary operations: union, difference and Cartesian product
• And can be extended to other operations:
• set intersection,
• natural join,
• outer join and inner join,
• … etc.
19
4/13/2021
20
4/13/2021
21
4/13/2021
22
4/13/2021
23
4/13/2021
24
4/13/2021
25
4/13/2021
26
4/13/2021
27
4/13/2021
28
4/13/2021
29
4/13/2021
30
4/13/2021
31
4/13/2021
32
4/13/2021
33
4/13/2021
34
4/13/2021
• σc1∧c2(R) =σc1(σc2(R))
• σc1(σc2(R)) =σc2(σc1(R))
• If A⊆A1, then πA(R) =πA(πA1(R))
• πA(σc(R)) = σc(πA(R)) if attributes in c ⊆ attributes in A
• σc(R ∞ S) = σc(R) ∞ S if attributes in c ⊆ attributes in R
Dr. NYAMSI 12/04/2021 69
35
4/13/2021
• (R∞S)∞T=R∞(S∞T)
• σc(R∪S) =σc(R)∪σc(S)
• πA(R∪S) =πA(R)∪πA(S)
36