? "Database System Concept" 3-primary key, relational operation

Source: Internet
Author: User

?

First, relational database related


A) There are two key issues that need to be addressed when presenting data to the user: How to retrieve, update, and protect the data.
The user's use of the field determines whether it is atomic, such as the phone, even if you save a single phone number, if the operator is differentiated by phone number, the region is not satisfied with atomicity.
b) The classification of the key:
Super key (Super Key), which is combined by several fields to uniquely identify a data object
Candidate keys (candidate key), different combinations of super-keys
Primary KEY (Primary key) is a candidate key selected by the Database Designer
c) The selection of the primary key must be able to uniquely identify a data object and will not change or make little changes
D) If Department.dept_name is the primary key, the instructor table is associated with the department table through Instructor.dept_name, then Instructor.dept_ Name is called the foreign key (foreign key) of the instructor table, and the relationship from Instructor.dept_name to Department.dept_name is referred to as the foreign Key's reference relationship (referencing relation). The relationship from Department.dept_name to Instructor.dept_name is referred to as the referenced relationship (referenced relation).
e) Referential relationships must adhere to referential integrity constraints, where the value of any tuple on a particular field in a reference relationship exists in the corresponding attribute of the tuple of the referenced relationship.
f) Table relationships can be represented by a schema diagram:


However, although this diagram can express the foreign key relationship, but cannot display referential integrity constraints, the later learning E-r map can compensate for this.

Second, relational operations
Common relational operations include selection, projection, natural connection, etc.:

Select σ
The select operation outputs rows that satisfy the predicate condition, such as where instructor.salary>=85000
Projection ∏
Outputs the data that contains the specified columns and removes duplicates
Natural connection?
Merging the tuples of two relationships into a single tuple, such as connecting instructor and department to Dept_name, to get information from each mentor and his department
Cartesian product X
The Cartesian product outputs all the tuple pairs, such as the Cartesian product of the teacher and the department, indicating all possible correspondence.
And ∪
The parallel operation merges two tables with similar structures.
For duplicate data in the result of the operation, some SQL languages strictly follow the mathematical definition of set operations to remove duplicates, while others retain duplicates, such as T-SQL while Union and union all, considering that the deduplication requires a lot of related processing.

Learning materials: Database System concepts, by Abraham Silberschatz, Henry F.korth, S.sudarshan



? "Database System Concept" 3-primary key, relational operation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.