Содержание
- 2. CONTENT Relation in mathematics Relation definition Domains, attributes, schemas and instances of relations in RDM Relations
- 3. Nonformal introduction to relations Form of representation: As a table By using a condition Relation is
- 4. Relation definition Let’s given sets D1, D2,…, Dn (does not obligatory distinct). Relation R, defined on
- 5. Additional terms - Sets D1, D2,…, Dn are called domains of the relation R . -
- 6. Representation of binary relations As a matrix As a table Graphical As a logical condition: R(x,y,...,z)
- 7. Basic operations Union: R ∪ S = {t | t ∈ R ∨ t ∈ S}
- 8. Property of binary relations Reflexivity: Relation R is reflexive if: ∀a R(a, a). Symmetry: Relation R
- 9. Examples of binary relations Relation Look-Like(x,y) is reflexive (any person looks like himself), symmetric (if b
- 10. Schema of a relation In mathematics order of columns is essential. Is More Is More 5
- 11. Property of attributes and schemas Properties of the relation attributes: Each attribute of a relation has
- 12. Relation instance Relation instance corresponds to the relation in mathematics with the only difference – the
- 13. Relational data structure The relational schema and its instance have the following properties: Name of the
- 14. Relations and tables ID 1, 2, … POST assistant, professor, … Domains NAME … SALARY …
- 15. Term correspondence Formal term Nonformal equivalent domain allowed values attribute column, field relation table tuple row,
- 16. Keys The key is a set of relation attributes that uniquely identify the tuples of the
- 17. Simple and compound keys The key is simple, if it consists of one attribute. The key
- 18. Redundant and minimal keys Compound key is redundant (not minimal) if there is a subset of
- 19. Primary key A relation may have many minimal keys. All of them are called candidate keys.
- 20. Properties of a primary key Main properties (integrity constraints): Primary key values must never be duplicated.
- 21. Example of a primary key Primary key Teachers: No Name Past-Ser Pasp-No 1 John СН 951945
- 22. Foreign key In a relational model relationships between relations are defined “by values”. Foreign key is
- 23. Example of a foreign key
- 24. Property of foreign key Main property (integrity constraint): Value of a foreign key cannot reference to
- 25. Supporting referential constraint Manipulating by tuples of a child relation: When a tuple is added or
- 26. Supporting referential integrity constraints in SQL Supporting referential integrity constraints in standard SQL: ON DELETE {RESTRICT
- 27. Supporting referential constraint – RESTRICT Fac-ty No Name Dean 1 CSF Ann 2 CEF Dick 3
- 28. Supporting referential constraint – CASCADE Fac-ty No Name Dean 1 CSF Ann 2 SEF Dick 3
- 29. Supporting referential constraint – SET NULL Fac-ty No Name Dean 1 CSF Ann 2 SEF Dick
- 30. Supporting referential constraint – SET DEFAULT Fac-ty No Name Dean 1 CSF Ann 2 SEF Dick
- 31. Recursive foreign key Foreign key is recursive if it references to the primary key of the
- 32. Cross-reference foreign keys FACULTY(ID, Name, DID) DEPARTMENT(ID,Name, FID) Is a part of Is in curriculum of
- 34. Скачать презентацию