FIT2094 Lecture Notes - Lecture 2: Tuple, Referential Integrity, Relational Model
FIT2094 Databses!
Lecture 2 - Relational Model!
Data Redundancy!
Relational Model!
-Fundamental basis for relational DBMS!
-Basic structure is the mathematical concept of a RELATION mapped!
Relation:!
-A relation consists of two parts!
-Heading — also called Relational Schema consists of a fixed set of attributes (column)!
-R = relation name, Ai = attribute i!
-R(A1,A2,…,An)!
-Each attribute corresponds to one underlying domain!
-Eg. Customer (custno, cutsame,custadd)!
-Body — also called Relation Instance (state) —> (set of data rows)!
-Consists of a time-varying set of n-tuples!
Relation Properties!
-No duplicate tuples!
-By definition sets do not contain duplicate elements hence tuples are unique!
-Tuples are unordered within a relation!
-By definition sets are not ordered hence tuples can only be accessed by content!
-No ordering of attributes within a tuple!
-By definition sets are not ordered!
- Tuple values are atomic — cannot be divided!
RM: Terminology!
Domain - set of atomic values!
- specify: name, data type, data format!
Relational Algebra!
!
Foreign Key (FK) !
•An attribute/s in a table that exists in the same, or another table as a Primary Key. !
•Referential Integrity"
– A Foreign Key value must either match the primary key "
in another table or be NULL. !
•The pairing of PK and FK creates relationships (logical connections) between tables.
Hence the abstraction away from the underlying storage model. !
Data Integrity !
▪ Entity integrity"
– Primary key values must be unique"
– Primary key value must not be NULL. !
find more resources at oneclass.com
find more resources at oneclass.com
Document Summary
Basic structure is the mathematical concept of a relation mapped. Heading also called relational schema consists of a xed set of attributes (column) R = relation name, ai = attribute i. Each attribute corresponds to one underlying domain. Body also called relation instance (state) > (set of data rows) Consists of a time-varying set of n-tuples. By de nition sets do not contain duplicate elements hence tuples are unique. By de nition sets are not ordered hence tuples can only be accessed by content. No ordering of attributes within a tuple. Tuple values are atomic cannot be divided. An attribute/s in a table that exists in the same, or another table as a primary key. A foreign key value must either match the primary key in another table or be null. The pairing of pk and fk creates relationships (logical connections) between tables. Hence the abstraction away from the underlying storage model.