Database learning note (4)

zhaozj2021-02-16  62

relational database

6. Relationship algebra

The relationship algebra is an abstract query language that is a traditional expression method of relational data manipulation language, which is used to express queries with the relationship.

1, traditional collection operation

And (Union), INTERSECTION, Generalized Cartesi Cartesi (Extended Cartesian Product)

2, special relationship operation

Several marks of the specified.

(1) The relationship mode is R (A1, A2, ..., AN). It is set to R. t∈R means T is a tuple of R. T [AI] indicates a component corresponding to the attribute AI in the tuple Ti.

(2) If a = {AI1, AI2, ..., AIK}, the AI1, AI2, ..., AIK is part of the A1, A2, ..., AN, A, is called attribute columns or domains. T [A] = (t [ai1], t [ai2], ..., t [aik]) represents a collection of components in the attribute column A. The attribute group remaining after {AI1, AI2, ..., Aik} is removed (A1, A2, ..., AN).

(3) R is the N object relationship, and S is the M object relationship. Tr∈r, Ts∈s, TR TS, called a tuple connection. It is a tuple of N M columns, and the previous N component is an N tone group in R, and then the M ing group in S is S.

⑷ Given a relationship R (X, Z), X and Z as attribute groups. Definition When t [x] = x, the icon set in R is:

ZX = {T [z] | t∈R, T [x] = x}

3. The definition of the relationship operation below:

1. Selection (SELECTION)

σF (r) = {T | t∈R∧f (t) = 'true'}

Select the logical expression F as a real tuple from the relational r. This is an operation from the perspective of rows.

2. Projection

The projection on the relational r makes a new relationship of several attribute columns from R. Remember:

πa (r) = {T [a] | t∈R}

After projection, not only certain columns in the original relationship, but may also cancel some tuples, because after canceling some attribute columns, you may have repeated rows, and you should cancel these exact same lines.

3. Connection (JOIN)

The connection is also known as a connection. It is a tuple that satisfies a certain condition between two relationships.

The connection operation is connected by two commonly used connections, one is an equivalent connection, one is a natural connection.

1. Connection operation for "=" is called an equivalent connection. It is a tuition that selects the a, b attribute value of the A and B attributes from the generalized Cartesian quarter of the relationship R and S, and the set equivalent connection is:

2. Natural connection is a special equivalent connection, which requires the components that compare in both relationships must be the same attribute group, and repeated attribute columns are removed in the results.

4. Division

A given relationship r (x, y) and s (y, z), where x, y, z are attribute groups. Y in Y and S in R may have different attribute names, but must be from the same domain set. The divination of R and S gives a new relationship P (x), and P is the projection of the tuple that satisfies the following conditions in the X attribute column, and the group set of X-containing value X contains YX in Y Collection of on the projection. The other operation is calculated simultaneously from the perspective of rows and columns.

Seven, relationship calculation

1. Element relationship calculation language alpha:

The alpha language mainly has GET, PUT, HOLD, UPDATE, DELETE, DROP 6 statement, statement's basic format: operation statement workspace name (expression): Operating condition expressions are used to specify the operation object of the statement, it can be related Name or property name, one statement can operate multiple relationships or multiple properties at the same time. The operating conditions are a logical expression that limits the operational objects in a tuple that meets the condition, and the operating conditions can be empty. 1, get retrieval operation

2, update update operation, steps are as follows:

· First use the HOLD statement to read the tuple to the unit from the database from the database. This is then modified with the host language.

3, PUT insertion operation, steps are as follows:

· First use the host language to establish a new period in the workspace · Then use the PUT statement to deposit the group in the designated relationship

4, HOLD with concurrent control GET statement

5, delete delete operation

· Use the HOLD statement to read the tuple you want to delete from the database to the workspace. Use the delete statement to delete the group

2, domain relationship calculation QBE (Query By EXAMPLE)

The most prominent feature is its way of operation. It is a highly non-processed screen table-based query language that constructs query requirements through the terminal screen editing program to fill out the form, and the query result is also displayed in the form of table, so it is very intuitive and easy to use.

Eight, relational database management system:

Relationship Database Management System is referred to as a relational system, refers to a system that supports relationship model. A database management system can be defined as a relational system when it is only supported:

1. Relationship database (ie, the relational data structure). That is, from the user's point of view, the database is made by the table, and the system is only a structure in the system.

2, support selection, projections, and (natural) connection operations. These operations do not require user to define any physical access paths.

According to E.F.CODD, depending on the relationship between the relationship system supports the relationship model, the relationship system can be divided into four categories:

1, a table system.

Such systems only support relational data structures (ie, tables), and do not support integrating operations. The table system is actually untrusted system. The Inverted List system belongs to this.

2, (minimum) relationship system.

That is, the relationship system defined above, it supports relational data structure and selection, projection, and connect three relationships. Many microcomputer relationships such as FoxBase, FoxPro, etc. belong to this.

3, the complete system is complete.

Such systems support relational data structures and all relationship algebraic operations (feature and relational algebra). Many large-scale relationship systems such as DB2, Oracle, etc. are here.

4, the full relational system.

Such systems support all features of the relationship model, especially the concept, entity integrity and reference integrity of the data structure. Although DB2, Oracle and other systems have been close to this goal, there is no system so far is a system.

Although different relationship systems have different supports of the relational model, their architecture complies with the three-level mode structure, providing pictures, external mode, mode, mode, mode, mode and internal mode. Amazing. Table is the model of the relational system, which can be defined on the table, which is the external mode of the relational system, and the relationship system usually provides statements that define the peer-out mode. In-mode is the file actually stored on disk or tape.

Sustainable continued.

Well-off

康 1949@hotmail.com2004-2-29

转载请注明原文地址:https://www.9cbs.com/read-22288.html

New Post(0)