Database Learning Notes (ii) relational database

Source: Internet
Author: User

A data model is a collection of conceptual tools that describe data, data connections, data semantics, and consistency constraints.

The relational model uses a collection of tables to represent the connection between data and data.

The relational model describes the data at the logical and view layers, and the user does not have to focus on the underlying details of the data store.

2.1 Structure of the relational database

In the term of the relational model, the relationship (relation) is used to represent only the tuple (tuple) that refers to the row, and the attribute (attribute) refers to the column in the representation. Relationship instance (relation instance): Represents a specific instance of a relationship (a specific set of rows in a table). Note: The order in which tuples appear in relationships is irrelevant . For each property of a relationship, there is a collection of allowed values, called the domain of the attribute. If the elements in the field are considered to be non-atomic, the field is atomic (--).

An empty (null) value indicates an unknown or nonexistent. Null values pose many difficulties for database access and updating, so you should avoid using null values as much as possible.

2.2 Database Schema

Database schema: Logical design of database

Database instance: A snapshot of the data in a moment database

Note: relationships can be considered as variables; relational patterns (generally, consisting of attribute sequences and attribute counterparts) can be considered type definitions; relationship instances can be considered as values of variables

2.3 Yards

None of the two tuples in a relationship have the same value on all attributes.

Super-code (SUPERKEY): A collection of one or more properties that allow us to uniquely identify a tuple in a relationship.

set R to represent a collection of properties in the R mode of the relationship. If we say that a subset of R is a super-code of R, it limits the value of any two different tuples in the relationship R to be completely equal on all attributes of K. That is: if T1 and T2 are in R and T1 is not equal to T2, then T1. K is not equal to T2.K.

Candidate code (candidate key): the smallest super-code (any true subset can not be a super-code). -There is a case where several different attribute sets can be candidate codes.

Main code (primary key): Selected by the Database Designer, to distinguish different tuples in a relationship candidate code.

A relational schema (R1) may contain the main code of another relational pattern (R2) in its properties. This attribute is referred to as the external code of the reference R2 (foreign key) on the R1, and the relationship R1 is called the reference relationship of the outer code dependency (referencing relation), and the relationship R2 is referred to as the reference relationship of the outer code (referenced relation). referential integrity constraint (referential integrity constraint): Requires that the value of any tuple on a particular attribute in a reference relationship necessarily equals the value of a tuple on a particular attribute in the referenced relationship.

2.4 Relational operations

Database Learning Notes (ii) relational database

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.