Basic concepts of relational databases

Source: Internet
Author: User
1. attributes and domains in the real world, a thing is often described by several features which become attributes ). The value range of each attribute corresponds to a set of values and becomes the domain of the attribute ). Generally, in the relational data model, all domains are limited to atomic data ). For example, integers and strings are atomic data.

1. attributes and domains in the real world, a thing is often described by several features which become attributes ). The value range of each attribute corresponds to a set of values and becomes the domain of the attribute ). Generally, in the relational data model, all domains are limited to atomic data ). For example, integers and strings are atomic data.

1. attributes and fields
In the real world, a thing is often described by several features which become attributes ). The value range of each attribute corresponds to a set of values and becomes the domain of the attribute ). Generally, in the relational data model, all domains are limited to atomic data ). For example, integers and strings are atomic data, while collections, records, and arrays are non-atomic data. This restriction of the relational data model is called the First Normal Form (1NF) condition.

2. Main terms

  • Degree: the number of attributes n is the object or Degree of the link.
  • Candidate Key: if the value of an attribute (or attribute group) in a link uniquely identifies a tuples, this attribute (Attribute Group) is called a Candidate code.
  • Primary Key: If one link has more than one candidate code, select one of them as the master code.
  • Key attribute: the attribute contained in any candidate code is called the primary attribute.
  • Non-Key attribute: an attribute that is not included in any candidate code is called a Non-code attribute.
  • Foreign code (Foreign Key): If the property (Attribute Group) in relational mode R is not the link code, but it is the code of other relations, then this property (Attribute Group) for relational mode R, it is an external code. For example, the customer's loan contact c-l (c-id, loan-no) and the property c-id is the customer relationship code, so c-id is the external code; the property loan-no is the code in the loan relationship, so loan-no is also an external code.
  • Full code (All-Key): All attribute groups of the relational model are candidate codes of the relational model.

For example, in relational mode R (T, C, S), attribute T indicates the instructor, attribute C indicates the course, and attribute S indicates the student. Assume that a teacher can teach multiple courses. A course can be taught by multiple teachers, and students can listen to different courses taught by different teachers. To distinguish each tuples in a relationship, the R code of this relational mode should be the full attribute T, C, and S, that is, All-Key.

3. Relationship nature
A basic link has the following five properties.

  1. The component must take the atomic value, and each component must be a data item that cannot be further divided.
  2. The column is homogeneous, and the component in each column must be of the same type of data from the same domain.
  3. Duplicate attribute names are not allowed.
  4. The order of the rows and columns is irrelevant.
  5. The two tuples cannot be exactly the same, which is guaranteed by the master code constraint. However, if you do not define integrity constraints for some databases, two or more rows of the same tuples are allowed.

4. Three types of links

  1. Basic Relationship (also known as basic table or base table ). Is an actually existing table, which is the logical representation of the actually stored data.
  2. Query a table. The table corresponding to the query result.
  3. View charts. Is a table exported from a basic table or other visual charts. Because it is not stored independently in the database, and the database only stores its definition, it is often called a virtual table.

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.