Relational Data Model

来源:互联网 发布:微擎源码 编辑:程序博客网 时间:2024/05/16 14:12

Overview
The goal of a model is to reduce and abstract the real world into something computable.
It is represented as a collection of tables.

Relational Model describe how to operate database with some operations.
A relation is a set, no duplicate tuples.
Tuples are unordered.
Attributes are unordered and are referenced by name and not position.

A super key, SK, is a subset of attributes that uniquely identify a tuple
A super key usually has redundant attributes. A key is a set of attributes with no redundancies that uniquely identifies a tuple.

Relational Model Integrity
Candidate Key-uniquely identify a tuple.
Primary Key - One of the candidate keys.
Alternate Key - other candidate key not primary key.
Foreign Key - in one relation whose value are required to be equal to the primary key of another relation.

Entity
Referential

Relational Algebra

The Relational Algebra is a set of operators that operate on relations, producing other relations.
8 operators:
Selection Operator
used to select a subset of tuples from a single relation that satisfy a selection criterion.
1
Projection Operator
The projection operator is used to select a subset of attributes(columns) from a single relation.
2
Hence: projection removes duplicates!
Rename Operator
just a combination of the Projection operator that allows attributes to be renamed.
Product Operator
Union Operator
union compatible relations
Intersection Operator
find the same part of the two tables
Difference Operator
find the difference data of the tables.
Join Operator
a binary operator used to combine tuples from two relations where the tuples are related by some join expression.
3
Nature join is with the duplicate attributes removed.
4
Divide Operator

finished

原创粉丝点击