Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Relation database

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Relational database:

The relational model consists of three parts: relational data structure, relational operation set and relational integrity constraints.

There are three aspects of relational model: integrity constraints, a language for relational operations in relational database systems, and relational calculus.

Integrity constraints:

Relationship

Field: a collection of values with the same data type

Cartesian product: the Cartesian product of two fields (or more), which superimposes the attributes (types) of two fields (without deleting duplicates). Each tuple in the new domain (which can be regarded as a row in the binary table) contains each attribute in the new field (even if some of the attributes are empty, this tuple cannot be deleted)

Relations: fields D1, D2...Dn, subsets of Cartesian products of these fields are called relations on fields D1, D2...Dn. N is the goal or degree of the relationship.

Attribute: the field has a name for each column, and this column name is attribute (attribute).

Candidate code: an attribute group (or an attribute value) that uniquely identifies a tuple in a relationship is called a candidate code.

Master code: if there are multiple candidate codes in a relationship, any one of them can be used as the master code

Primary attribute: all attributes of the candidate code are called primary attributes

Non-primary attributes: (non-code attributes) attributes that do not contain any candidate codes are non-primary attributes

Full code: relational schema (can be thought of as a table) all attributes constitute a candidate code for this relationship (only when all attributes of this table work together can a tuple be determined, that is, the primary key of the table is the table itself)

2. There are three types of relationships: basic relationships, query tables, and diagrams.

3. Relational data language: relational Algebra language (ISBL); Relational Calculus language (QUEL,QBE); language with dual characteristics of Relational Algebra and Relational Calculus (SQL)

4. Three kinds of integrity constraints of relationship: entity integrity, referential integrity and user-defined integrity.

Entity integrity: the primary attribute cannot be empty

5. Relational algebra: traditional: Union, difference, intersection, Cartesian product; special operations: selection, projection, linking, division

Select: fetch rows from the table

Projection: taking columns from a table

Join: select tuples from Cartesian product whose attributes meet certain conditions; (equivalent link, operation condition is "="; natural link; semi-join (semi-join); outer join)

6. The realization of the choice:

Full table scan: scan the basic table of the query sequentially, check whether each tuple meets the selection condition one by one, and output the tuple that meets the condition as the result; disadvantages: scan the basic table of the query sequentially, check whether each tuple meets the selection condition one by one, and output the tuple that meets the condition as the result.

Index (or hash) scanning method:

Suitable for selection criteria with indexes on attributes (such as B+ tree index or Hash index)

Through the index, we first find the tuple master code or tuple pointer that meets the conditions, and then find the tuple directly in the basic table of the query through the tuple pointer.

Implementation of the connection:

Nested loop method (nested loop)

Sort-merge method (sort-merge join or merge join)

Index join (index join) method

Hash Join method

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report