relational database (CH.2)

Source: Internet
Author: User

2.1.1 Relationship

Domain
Cartesian product
Relationship
Candiate key If a set of attribute values can uniquely identify a single ancestor, but his subset is not, then this is a candidate code
Relationships can be made up of three types
Basic relationships
Query relationships
View

Attach the following two definitions to the relationship
The infinite relationship is meaningless,
To cancel the order of a relationship by attaching a property name to the relationship

The basic relationship has the following 6 properties
The column is homogeneous.
Different columns can be taken from the same domain
The order of the rows doesn't matter
The candidate code for any two-tuple cannot be the same
The component must be atomized.

2.1.2 Relationship Mode

The relationship pattern can be formalized to represent
R (U,D,ROM,F)
U is a collection of attributes that make up a relationship
D is the field of the property's value
ROM is a collection of attribute-to-domain mappings
F is a collection of dependency relationships between attributes

The relational pattern can be précis-writers into R (U) R (a1,a2.). An is a property name, and the other part is omitted

2.2 Relationship Operations 2.2.1 Basic relational operations

Choosing a projection connection to divide the difference and cross the Cartesian product

The basic operation is: choose projection and the difference of five kinds of Cartesian product

The classification of 2.2.2 relation language

An algebraic or logical representation of a relationship.

are called relational algebra and relational calculus, respectively.

    • Relational algebra uses the operation of relation to express query demand

    • Relational calculus uses predicates to represent query requirements

The relationship calculus is divided into the meta-ancestor relation calculus language and the domain relational calculus language according to the basic object is the tuple variable or the domain variable.

and language SQL with both of these relationships

SQL is a set of query, data definition language data manipulation language, Data Control Language DCL in one language

2.3 Integrity of the relationship 2.3.1 entity integrity

Is null the Primary property is not NULL

2.3.2 Referential integrity

is if f is the outer code of R
Corresponds to the Ks in S
Then F can take a null value
A non-null value is equal to the value of one of the main codes in S

2.4 Relational algebra

Relational algebra is divided into traditional set operation and closing relationship operator two kinds of

2.4.1 the traditional set operation

4 kinds of poor and cross-cartesian product (generalized)

2.4.2 Special Relational Operation symbols

Including the selection of projection connection except operation, etc.

Choose

The selection expression is actually a tuple that chooses to make F true from the relationship R type
Σf (r) ={t | T belongs to R and f (t) = ' true '}

Projection

A projection is a new relationship that consists of selecting several attribute columns from R.
Πa (R) ={t[a] |t belongs to R}

Connection

Also becomes the θ connection, from the Cartesian product of two relations to select the Yuanzulai satisfying certain conditions

Θ is = The connection is called an equivalent connection

A natural connection is a special equivalent connection, which requires that the property names in the two relationships be compared, and that duplicate columns are dropped in the result

Some tuples in the relationship R do not exist in the corresponding S, so it is possible to be discarded and become suspended tuples (Dangline tuple)

The suspension tuple is reserved and null is filled in as an outer join. Leave left and right respectively left connected right

Except operations

R/S ={tr[x] | Tr belongs to R and Πy (S) belongs to YX}

Relational calculus 2.5.1 Tuple Relationship Calculus language ALPHA

1 Retrieving operations

2.5.2-Tuple relationship calculus

Temporary brief

relational database (CH.2)

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.