Data Model
- A set of tools/ constructs used to model a database
- Record/Semantic
Legacy Data Models
- Hierarchical
- Network
- Relational
Relational Data Model
- Two major Strengths
- Three Components
- Relational databases based on relational Data Model
- A relation R defined over domains D1, D2, …., Dn is a set of n-tuples, <d1, d2, …, dn> such that <d1 D1……, dnDn
Schemes in RDB
- EMP(eNo, eName, eTitle, eSal, pNo, eResp, pDur)
- PROJ(pNo, pName, bud)
- Each of the attribute in these two relations has a domain, like…
- Domains need not to be distinct
Keys
Primary Key
- Minimum nonempty subset of a relation whose values uniquely identify each tuple in relation
- The superset of the key is super key, like…
- We also have candidate, alternate, secondary, foreign
Table
- Relation represented in a two dimensional form
EMP
PROJ
- After defining a relation’s scheme, it is populated
- Tuples are rows and attributes are cols
- Attributes get values from same domain
- Can have NULL value, but….
Normalization
- Step-by-step reversible process to produce anomalies free smarter tables
- Anomalies Types….
- Major step is decomposition
- Universal Relation approach
- Three Normal Forms
- BCNF
- Lossless decomposition
- Dependency preservation
Dependency Structure
- Norm. based on dependencies
- Up to BCNF on FDs
- MVD and P-JD
Dependencies
- A relation R defined on attributes A(A1, A2, …., An), if XA, YA, if for each value of X
- There is a unique value in Y, then X functionally determines Y, X Y
- If X Y and there is a Z X and Z Y, then X partially determines Y or Y is partially dependent on X
- 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 unique value of (Y,Z) pair and Z depends only on X then X multi determines Z, X Z
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
- 1NF, attributes have only atomic values
- 2NF, there are no partial dependencies
- 3NF, for each X Y where Y is not in X, either X is a superkey of R or Y is prime attribute
No comments:
Post a Comment