Introduction to Database Systems 2

Introduction to Database Systems 2

Continue from previous article

3. Structure of database system

From a developer's perspective: the database adopts a three-level structure model, which is the structural model of the internal system of the database. See the figure below:
Insert image description here
the three-level structure model refers to: internal model - model - external model

1. Internal schema : A database has only one internal schema. The internal schema is the detailed processing of data storage and description in the system. For example, what method is used to store the data? Is it stored sequentially? Or is the hash village rough? Or heap storage? Is the data compressed? Encrypted? Etc. all belong to the internal mode
2. Mode : a public data view for all users, which has nothing to do with the physical storage of data, has nothing to do with hardware, and has nothing to do with applications, development languages, and development tools. (Detailed explanation of the schema will be written later)
3. External schema : The logical structure and characteristic description of the local data used by database users. Because the scope of the internal schema is too wide, it is possible that only a part is needed for the application. The external schema reflects the needs of different applications. Requirements can simplify the view, which is a powerful measure to ensure database security!

From the user's perspective, the system structure of the database is:

  • single user architecture
  • master-slave structure
  • distributed structure
  • Client-server architecture
  • Browser-application server architecture

4. Composition of database system:

Database system components

5. Relational model data structure (second list)

Relational model : In the simplest terms, it can be explained as a two-dimensional table
field : it is a
Cartesian product of data sets of the same type : given a set of fields: D1, D2, D3,..., Dn, then the Cartesian product of these fields The product is D1xD2xD3x…xDn={(d1,d2,d3…dn)|di∈Di,i=1,2,3,4…n}. The Cartesian product can be regarded as the domain of the relationship.
Relationship : The subset of D1xD2xD3x…Dn is called the relationship on the domain D1, D2, D3…Dn, expressed as: R (D1, D2,…,Dn) R: relationship name n: the order or degree of the
relationship
tuple
: relationship Each element (d1, d2, d3,..., dn) in is called a tuple, and t is usually used to represent
attributes : a column in the table is an attribute, and the name given to each attribute is the attribute name code
: 1. Candidate Code, the value of a certain attribute group in the relationship can uniquely identify a tuple, then the attribute group is called a candidate code 2. Full code, (extreme case) all attribute groups in the relationship pattern are candidate codes for this relationship pattern

6. The connection between relationship model and relationship

(Relationship models and relationships are often collectively called relationships, but there are still differences)

  • Relationship model : The relationship model is a description of the relationship. The relationship model is the type, the relationship is the value, and the relationship model is static and fixed.
  • Relationship : is dynamic and changes over time

7. Two important integrity aspects of relationships - entity integrity and referential integrity

1. Entity integrity : The main attributes of the relationship cannot be empty (null values ​​are: don't know, does not exist, meaningless). For example: a student relationship, student (student number, age, height) where if the student number is the main attribute (Main code), then when filling in the student relationship form, you can’t leave it blank!
2. Referential integrity : The integrity of the relationship (that is, the integrity between the two tables) will lead to the concept of "foreign code". For example: student (student number, age, major number), major (major number, major name) There are two relationships here, one is a student relationship, and the other is a professional relationship. In the student relationship, "student number" is the main code, and in the professional relationship, "major number" is the primary code, but in the student relationship There is also the attribute of professional number in the relationship, but it is not the main code. In fact, the professional number in the student relationship is the external code.

Guess you like

Origin blog.csdn.net/weixin_46516242/article/details/104892534