当前位置:网站首页>Tutorial on principles and applications of database system (009) -- conceptual model and data model
Tutorial on principles and applications of database system (009) -- conceptual model and data model
2022-07-07 12:15:00 【Rsda DBA_ WGX】
Database system principle and Application Tutorial (009)—— Conceptual model and data model
Catalog
The steps to create a database are :(1) Analyze the system requirements according to the real world ;(2) Use conceptual model reality 、 Comprehensively describe the management objects and their connections in the real world ;(3) Transform the conceptual model into something DBMS Supported data models .
The three steps of creating a database correspond to the three worlds of information , namely : Real world , Information world and data world . As shown in the figure below .
One 、 The real world of information
The real world of information is all kinds of things we manage and the connections between things . The real world of information passes through entities 、 Entity set and the relationship between entity sets .
1、 Entity
Things or concepts that can be distinguished from each other in the real world are called entities . Entities can be divided into thing entities and conceptual entities . for example : One of the students 、 A machine 、 A classroom 、 A book is an entity . A course 、 A class is a conceptual entity .
2、 Characteristics of entities
Each entity has its own characteristics , Different entities can be distinguished by using the characteristics of entities . for example : Students can pass the student number 、 full name 、 Gender 、 Age 、 Date of birth 、 height 、 Weight and other characteristics .
An entity has many characteristics , But when we create a database, we will decide which features to save according to the needs of management . For the employees of a unit , If it is based on personnel management , You can choose the job number 、 full name 、 Date of birth 、 position 、 Salary and other characteristics . And if based on the health management of employees , You can choose the job number 、 full name 、 Date of birth 、 height 、 weight 、 Describe blood pressure and other characteristics .
3、 Entity set
A set of entities that have the same characteristics or can be described with the same characteristics is called an entity set . for example : A student is an entity , All students that need to be managed are entity sets . A class is an entity , All classes that need to be managed are entity sets .
4、 The relationship between entity sets
The entity set in the real world is not isolated , There are various connections between entity sets . The relationship between entity sets refers to the corresponding relationship between entities in different entity sets . for example : There is a subordinate relationship between classes and students , There is a relationship between students and courses , There is a teaching relationship between teachers and courses . There are three kinds of relations between two entity sets :
(1) One to one contact (1:1)
There are two entity sets A and B, If the entity set A And entity set B There is a one-to-one connection between , Then for entity set A Every entity in , Entity set B There is at most one entity in ( There can be no ) Connect with it ; conversely , For entity sets B Every entity in , Entity set A At most one entity is associated with it . Entity set A And entity set B The connection between them is expressed as 1:1, for example : The school has a one-to-one relationship with the principal , A school can only have one principal , conversely , A principal can only be the principal of a school . The one-to-one relationship between entity sets is shown in the following figure .
(2) One to many connection (1:n)
There are two entity sets A and B, If the entity set A And entity set B There is a one to many connection between , Then for entity set A Every entity in , Entity set B One or more entities are associated with it ; conversely , For entity sets B Every entity in , Entity set A At most one entity is associated with it . Entity set A And entity set B The connection between them is expressed as 1:n, for example : The class and students have one to many connections , A class can have more than one student , conversely , A student can only study in one class . The one to many relationship between entity sets is shown in the following figure .
(3) Many to many contact (m:n)
There are two entity sets A and B, If the entity set A And entity set B There are many to many connections between , Then for entity set A Every entity in , Entity set B One or more entities are associated with it ; conversely , For entity sets B Every entity in , Entity set A There is also one or more entities associated with it . Entity set A And entity set B The connection between them is expressed as m:n, for example : Students and courses have many to many connections , A student can take more than one course , conversely , A course can be selected by more than one student . The many to many relationship between entity sets is shown in the following figure .
Two 、 Information world and conceptual model
The information world is a description of the real world . In the information world , The characteristics of an entity are called attributes , Entities are represented by attributes as instances , A collection of instances of the same kind is called an object , The relation between entity sets is represented by object relation .
The information world through conceptual models ( Also known as the information model )、 Process model and state model reflect the real world . The conceptual model passes E-R Objects in the diagram 、 Attributes and connections give static descriptions of things and connections in the real world . The process model describes the processing method and information processing process of things through information flow chart and data dictionary . The state model makes a dynamic description of things through the state transition diagram of things .
The database is mainly designed according to the conceptual model , The data processing method is mainly designed according to the process model , The state model has important reference value for the system function design of database .
1、 conceptual model
(1) Instances and objects
Entities are represented by attributes as instances , A collection of instances of the same kind is called an object .
(2) attribute
An attribute is an abstract representation of a feature of an entity . Such as the student's name , Gender , Age is the attribute of students , One of the students' name is Li Ming , Gender is male , Age is 20, Then Li Ming 、 male 、20 Called property values .
(3) Domain
The value range of an attribute is called the field of the attribute . for example : Age range of employees 18—60 Is the domain of age .
(4) code 、 Main code 、 Candidate code
Attributes or attribute groups that can uniquely identify an entity are called codes (key). for example : Student ID is the code of student entity , Because the student ID can uniquely identify the student entity . If an entity has multiple codes , Usually take one of the codes as the main code (primary key), Then the remaining codes are called candidate codes (candidate key).
2、 The representation of conceptual model
have access to E-R chart ( Entity - Contact diagram ) Represent the conceptual model .E-R The graph is also called E-R Model , Provides a set of representation entities 、 Properties and contact methods .
(1) Representation of entity set -
E-R Figure uses a rectangle to represent a set of entities , Write the name of the entity set in the rectangle , As shown in the figure below .
(2) Representation of attributes
E-R Figure uses ellipse to represent the attributes of entity set , And use line segments to connect it with the corresponding entity set , As shown in the figure below .
Because there are many attributes of entity set , Some entities may have dozens or even hundreds of attributes , So in E-R In the figure , The attributes of entity set can not be drawn , Use a data dictionary ( written words ) How to express .
(3) The expression of contact
E-R The diagram uses diamonds to represent the relationship between entity sets , Write the name of the contact in the diamond , And use line segments to connect with the relevant entity set , At the same time, mark the type of connection next to the line segment .
Connections can also have attributes , If the contact has attributes , You need to use line segments to connect attributes and connections . The attribute of the connection must be E-R Mark , Cannot be represented by a data dictionary . Properties in the following figure 【 fraction 】 Just contact 【 Elective 】 Properties of .
3、 ... and 、 Data world and data model of information
Information in the information world , After processing, the data that can be processed by the computer is formed , Is the computer world , Also known as the data world . The related concepts involved in the data world are as follows :
1、 Data item
Data items are data representations of object attributes . Data items can be divided into types and values , The type of data item is the representation of the characteristics of data item , Include the name of the data item 、 data type 、 Data length and field . The value of a data item is its specific value . Such as the student's name , The type of data item can be expressed as : full name , Character , length 20. The value of a student name data item is Zhang Tao .
2、 Record
Records are data representations of instances . There are types and values in records , The type of record is the structure of record , It is composed of data item types . The recorded value represents an instance in the object , The recorded component is the value of the data item . for example :【 full name , Gender , Age , Telephone , Department 】 It is the record type of student data ,【 zhang , male ,20,13783587788, Department of Economics 】 Is the value recorded by a student , Represents an instance of a student object . Of the recorded values 【 zhang 】、【 male 】、【20】、【13783587788】、【 Department of Economics 】 Are the values of data items .
3、 file
A file is a data representation of an object , Is a collection of similar records . The record types in the same file should be the same . for example : Create a data file based on the information of all students , Then the type of each record is the same .
4、 Data model
Data model is the abstraction of data features , The data model is used to represent the record structure and the relationship of records . The most common data includes hierarchical models 、 Mesh model and relational model . Hierarchical models and mesh models are called non relational models .
(1) The three elements of the data model
The data model has a data structure 、 Three elements of data operation and integrity constraints :
A) data structure : What kind of structure is the data stored in the database . hierarchy 、 Reticular structures and relationships ( surface ) The data model of the structure is named hierarchical model 、 Mesh model and relational model .
B) Data manipulation : The data operations that can be carried out in the database mainly include data query and data update ( Insert 、 Delete and modify ), Abbreviation: increase 、 Delete 、 Change 、 check .
C) Data constraints : Data constraints are a set of data integrity rules . Data integrity rules are the constraints and dependency rules of data and its connections in the data model . for example : Entity integrity in relational data model 、 Referential integrity and user-defined integrity . Data constraints are used to ensure the correctness of data in the database 、 Effective and compatible .
(2) hierarchical model
The hierarchical model adopts a hierarchical structure ( Tree structure ) Represents various entities and the connections between entities , The typical representative of hierarchical database system is IBM The company's IMS Database management system .
(3) Mesh model
The mesh model uses a mesh structure to represent various entities and the connections between entities , The typical representative of mesh database system is DBTG System .
(4) relational model
Relational model is the most commonly used data model . Relational models use tables (table) Represents various entities and the connections between entities .
① Related concepts of relationship
A) Relationship : A relationship corresponds to a two-dimensional table .
B) Tuples : A row in the relationship is called a tuple . Some database management systems are called records (record).
C) attribute : A column in a relationship is called an attribute . Some database management systems are called columns (column) Or field (field).
D) code : An attribute or attribute group in a relationship , Their values can uniquely identify a tuple , Such attributes or attribute groups are called relational codes .
E) Domain : The value range of an attribute is called a field .
F) component : The value of an attribute in a tuple is called a component .
G) Relationship model : A relationship pattern is a description of a relationship . The relational schema is expressed as follows :
Relationship name ( attribute 1, attribute 2,……, attribute n)
for example : Student relationship can be expressed as
Student ( Student number , full name , Gender , Date of birth , nation , Political affiliation , Telephone , Department )
② Relationship operation : Relational operations mainly include data query and insertion 、 Delete 、 Modifying data .
③ The integrity constraints of relationships : Entity integrity 、 Referential integrity 、 User-defined integrity .
(5) Comparison between relational model and non relational model
A) The relational data model is based on strict mathematics .
B) The concept of relational data model is single , Easy to understand . In a relational database , Entities and the connections between entities are expressed by relationships .
C) The access path of relational data model is hidden from users . Users operate data according to the logical schema and sub schema of the database , And don't care about the physical mode of the database and the storage of the database in the computer .
D) The data connection in relational data model is through data redundancy ( Outer code ) Realized .
Four 、 The connection between the three worlds of information
The real world of information 、 The relationship between the information world and the data world can be expressed in the following table :
Real world | The information world | Data world |
---|---|---|
Entity | example | Record |
features | attribute | Data item |
Entity set | object | file |
The relationship between entity sets | The connection between objects | The connection between data |
conceptual model | Data model |
The transformation relationship between the three worlds of information is shown in the figure below .
边栏推荐
- Ask about the version of flinkcdc2.2.0, which supports concurrency. Does this concurrency mean Multiple Parallelism? Now I find that mysqlcdc is full
- 108.网络安全渗透测试—[权限提升篇6]—[Windows内核溢出提权]
- Flet教程之 17 Card卡片组件 基础入门(教程含源码)
- CMU15445 (Fall 2019) 之 Project#2 - Hash Table 详解
- zero-shot, one-shot和few-shot
- Superscalar processor design yaoyongbin Chapter 10 instruction submission excerpt
- Steps of redis installation and self startup configuration under CentOS system
- How to connect 5V serial port to 3.3V MCU serial port?
- 【滤波跟踪】基于matlab扩展卡尔曼滤波EKF和无迹卡尔曼滤波UKF比较【含Matlab源码 1933期】
- Swiftui swift internal skill how to perform automatic trigonometric function calculation in swift
猜你喜欢
Visual studio 2019 (localdb) \mssqllocaldb SQL Server 2014 database version is 852 and cannot be opened. This server supports version 782 and earlier
<No. 9> 1805. Number of different integers in the string (simple)
【滤波跟踪】捷联惯导纯惯导解算matlab实现
Stm32f1 and stm32subeide programming example -max7219 drives 8-bit 7-segment nixie tube (based on SPI)
Unity中SmoothStep介绍和应用: 溶解特效优化
[shortest circuit] acwing 1127 Sweet butter (heap optimized dijsktra or SPFA)
【玩转 RT-Thread】 RT-Thread Studio —— 按键控制电机正反转、蜂鸣器
The road to success in R & D efficiency of 1000 person Internet companies
SwiftUI 教程之如何在 2 秒内实现自动滚动功能
UP Meta—Web3.0世界创新型元宇宙金融协议
随机推荐
《通信软件开发与应用》课程结业报告
Stm32f1 and stm32subeide programming example -max7219 drives 8-bit 7-segment nixie tube (based on SPI)
C#中在路径前加@的作用
问题:先后键入字符串和字符,结果发生冲突
112.网络安全渗透测试—[权限提升篇10]—[Windows 2003 LPK.DDL劫持提权&msf本地提权]
数据库系统原理与应用教程(011)—— 关系数据库
Introduction and application of smoothstep in unity: optimization of dissolution effect
[shortest circuit] acwing1128 Messenger: Floyd shortest circuit
wallys/Qualcomm IPQ8072A networking SBC supports dual 10GbE, WiFi 6
防红域名生成的3种方法介绍
The Oracle message permission under the local Navicat connection liunx is insufficient
Ask about the version of flinkcdc2.2.0, which supports concurrency. Does this concurrency mean Multiple Parallelism? Now I find that mysqlcdc is full
[texture feature extraction] LBP image texture feature extraction based on MATLAB local binary mode [including Matlab source code 1931]
关于 Web Content-Security-Policy Directive 通过 meta 元素指定的一些测试用例
【全栈计划 —— 编程语言之C#】基础入门知识一文懂
30. Feed shot named entity recognition with self describing networks reading notes
idea 2021中文乱码
Problem: the string and characters are typed successively, and the results conflict
Unity 贴图自动匹配材质工具 贴图自动添加到材质球工具 材质球匹配贴图工具 Substance Painter制作的贴图自动匹配材质球工具
VSCode的学习使用