Database Review ⑤
June 15, 2016
22:01
Main Relation Table & Relational Algebra Relational Tables
1. Cartesian product
2. features of the relational table
The tuple in the relational table is a subset of the Cartesian product;
Tuples do not allow a single row of identical values;
The order in which the tuples are stored is irrelevant;
Each property value under the same property name should be from the same domain and be the same numeric type;
Each attribute name is not the same;
Different attributes can have the same domain value;
Attributes are atomic and non-detachable, which means that small tables cannot be nested in large tables
3. Convert the ER diagram to a relational table
Each entity in the ER diagram is converted into a table;
The attribute columns for each table are made up of the properties of two related entities, including all properties of an entity and the primary key of another entity.
The following examples illustrate:
4. Integrity Constraints
Domain value constraints (domains Integrity Constraints) Each attribute has its type and range of values, such as the student's age between 0~150岁.
Entity integrity constraints (entities Integrity Constraints) primary key is non-empty, a table has at most one primary key, a table can exist without a primary key, and a primary key is used to specify a unique attribute column for that table.
Referential integrity constraints (referential Integrity constraints) are used to maintain referential integrity in a relational database, and any field in a table that declares a key can contain only the values of the parent table's primary key or candidate key
Custom integrity constraints;
5. null value null values
Null values can exist with relational tables, and null values are given to those indeterminate attributes or to indeterminate values for existence.
6. Relational algebra
Five basic relational operations: projection projection, selection of selection, Cartesian product Cartesian product, union, and difference difference.
7. and OP Union
8. differential Operation difference
9. Select operation Selection
projection operation Projection
Cartesian product operations Certesian product
intersection operation intersection
Natural Connection Operations
Connection Operation
Division operations
Database Review ⑤