Tải bản đầy đủ (.pdf) (26 trang)

Distributed Database Management Systems: Lecture 5

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (70.27 KB, 26 trang )

Distributed Database
Management System
Lecture 05


Data Model
• A set of tools/ constructs
used to model a database
• Record/Semantic

Virtual University of Pakistan

2


Legacy Data Models
• Hierarchical
• Network
• Relational

Virtual University of Pakistan

3


Relational Data Model
• Two major Strengths
• Three Components
• Relational databases based
on relational Data Model


Virtual University of Pakistan

4


• A relation R defined over
domains D1, D2, …., Dn is a
set of n-tuples, dn> such that dn Dn
Virtual University of Pakistan

5


Schemes in RDB
• EMP(eNo, eName, eTitle,
eSal, pNo, eResp, pDur)
• PROJ(pNo, pName, bud)

Virtual University of Pakistan

6


• Each of the attribute in these
two relations has a domain,
like…
• Domains need not to be
distinct


Virtual University of Pakistan

7


Keys


Primary Key
• Minimum nonempty subset
of a relation whose values
uniquely identify each tuple
in relation

Virtual University of Pakistan

9


• The superset of the key is
super key, like…
• We also have candidate,
alternate, secondary, foreign

Virtual University of Pakistan

10



Table


• Relation represented in a two
dimensional form
EMP
eNo eName eTitle eSal pNo eResp eDur

PROJ
Virtual University of Pakistan

pNo pName pBud
12


eNo eName eTitle eSal pNo eResp eDur
E01
E03
E05
E06
E07
E08

Naeem
Rahila
Narjis
Aslam
Hafeez
Liaqat


Supr
Desin
Prog
Eng
Prog
Anlyst

Virtual University of Pakistan

500
700
700
850
700
900

P1
P2
P1
P1
P2
P3

Work
Mangr
Cons
Cons
Cons
Mangr


13

12
7
12
15
10
10


• After defining a relation’s
scheme, it is populated
• Tuples are rows and
attributes are cols

Virtual University of Pakistan

14


• Attributes get values from
same domain
• Can have NULL value,
but….

Virtual University of Pakistan

15



Normalization
Step-by-step reversible
process to produce
anomalies free smarter
tables

Virtual University of Pakistan

16


• Anomalies Types….
• Major step is decomposition
• Universal Relation approach

Virtual University of Pakistan

17


• Three Normal Forms
• BCNF
• Lossless decomposition
• Dependency preservation

Virtual University of Pakistan

18



Dependency Structure
• Norm. based on
dependencies
• Up to BCNF on FDs
• MVD and P-JD

Virtual University of Pakistan

19


Dependencies
A relation R defined on
attributes A(A1, A2, …., An), if
X A, Y A, if for each value of
X

Virtual University of Pakistan

20


there is a unique value in Y,
then X functionally determines
Y, X Y

Virtual University of Pakistan

21



• If X Y and there is a Z X
and ZY, then X partially
determines Y or Y is partially
dependent on X

Virtual University of Pakistan

22


A relation R defined on
attributes A(A1, A2, …., An),
if X A, Y A, Z A, if for each
value of X, there is

Virtual University of Pakistan

23


there is unique value of (Y,Z)
pair and Z depends only on X
then X multidetermines Z,
X
Z

Virtual University of Pakistan

24



P-J Dependency
A relation R defined on
attributes A(A1, A2, …., An),
if X A, Y A, Z A, if R is
equal to join of X, Y and Z
then (X, Y, Z) constitute
project-join dependency for R
Virtual University of Pakistan

25


×