当前位置:网站首页>Introduction to database system - Chapter 2 - relational database (2.1~2.3) (important knowledge points)
Introduction to database system - Chapter 2 - relational database (2.1~2.3) (important knowledge points)
2022-06-11 11:07:00 【Filling in notes, checking for deficiencies, filling in gaps】
Preface
take 【 Introduction to Database System ---- Chapter two – relational database (2.1~2.3)】 The important knowledge points in
1. Relationship
The relation is a finite subset of Cartesian product .
The relation is a two-dimensional table .
Cartesian product itself is meaningless in physical space , The relation is to extract a meaningful subset from the Cartesian product .
- Related terms :
- Objective ( degree ): There are several columns in the table for several degrees or items .
- There are several behaviors and several relationships .
- Each row of the table corresponds to a tuple .
- Each column of the table corresponds to a field , Each column of the table corresponds to an attribute ,n Objective relationship n Attributes .
- Candidate code : If an attribute in the relationship can uniquely identify a tuple , Call this attribute a candidate code .
- Main code : If a relation has more than one candidate code , Select one of the main codes .
- Main attribute : The attribute of the candidate code is the primary attribute .
- Non primary property ( Or non code properties ): Attributes that do not contain any candidate codes are non primary attributes or non code attributes .
- Full size : If all the attributes of a relational schema are candidates for this relational schema , Full code .
- There are three types of relationships , Basic relationship ( It is also called basic table or base table )、 Query table 、 View table .
- The base table is the actual table , Is the logical representation of the actual stored data .
- The query table is the table corresponding to the query result .
- A view table is a table derived from a base table or other view table , It's a virtual watch , Not the data that should actually be stored .
2. The nature of the basic relationship
- Columns are homogeneous , That is, the components in each column are the same type of data , From the same domain .
- Different columns can come from the same domain , Call each of these columns an attribute , Different attributes should be given different attribute names .( Property name uniqueness ).
- The order of the columns doesn't matter , That is, the order of columns can be exchanged arbitrarily .
- Two candidate codes of... Cannot take the same value .
- The order of the lines doesn't matter , That is, the order of lines can be exchanged arbitrarily .
- The component must be atomic , That is, each component must take an inseparable data item ( Cannot have table in table ).
The relationship model requires that the relationship must be normalized , That is, the relationship must meet certain normative conditions . The most basic of these normative conditions is , Each component of the relationship must be an indivisible data item . Normalized relationships are referred to as paradigms .
3. Relationship model
The description of a relationship is called a relational schema .
- Formal representation of relational schema :R(U, D, DOM, F)
- R Name the relationship
- U A collection of attribute names that make up the relationship
- D by U The domain from which the attribute in the
- DOM A collection of images to the domain for the attribute ( The values in each row correspond to the values in the field )
- F Is the dependency set of data between attributes
- Relational patterns are usually abbreviated to
R(U)orR(A1,A2,...)among Ai For the property name . - The relationship pattern is static 、 The stability of the , And relationships are dynamic 、 Changing over time .
4. Relationship operation
- Characteristics of relationship operation : Set operation mode , That is, the objects and results of the operation are collections .
- Common relational operations :
- Inquire about ( The most important part of relationship operation ):
Query operations can be divided into selection 、 Projection 、 Connect 、 except 、 and 、 Bad 、 hand over 、 Cartesian product , Selection 、 Projection 、 and 、 Bad 、 Cartesian product is 5 Basic operations , Other operations can be defined and exported with basic operations . - Data update operation :
Insert 、 Delete 、 modify
- Inquire about ( The most important part of relationship operation ):
Common relational operations : choice 、 Projection 、 Connect 、 except 、 and 、 hand over 、 Bad 、 The cartesian product.- Basic relationship operations (5 Kind of ): choice 、 Projection 、 and 、 Bad 、 The cartesian product .
5. Classification of relational data languages
- Relational algebra : Express query requirements by operations on relationships .
- Relationship calculus : Using predicates to express query requirements .
- Structured query language (SQL): Between relational algebra and relational calculus .
6. Outer code
set up F It's the basic relationship R One or a set of attributes of , But it's not the relationship R Code of ,Ks It's the basic relationship S The main code of . If F And Ks Corresponding , call F yes R The outer code of , said Basic relationship R For reference relations ( Relationship R Medium F Referring to the relationship S Medium Ks), Basic relationship S Is a referenced or target relationship .
7. The integrity of the relationship
- Entity integrity : Main code ( In relation mode, the master code is used as the unique identifier ) The primary attribute in cannot be null .
- Referential integrity : Outer code or null value , Or equal to the main code value of a tuple in the referenced relationship .
- User defined integrity : The constraints that the application domain should follow .
Entity integrity and referential integrity are the integrity constraints that relational models must meet , It's called the two invariants of a relation .
边栏推荐
- Digital collection system app source code
- How programmers do sidelines
- Jerry's blepr0 and PR1 are used as ordinary IO ports [chapter]
- Don't be a fake worker
- NFT will change data ownership in the metauniverse
- 杰理之获取 BLE 查看代码异常复位等异常情况原因【篇】
- SurroundDepth:自监督多摄像头环视深度估计
- Jerry's ble spp open pin_ Code function [chapter]
- 2022年最好的年金险产品是什么?
- 2022北京国际营养健康产业博览会,第九届中国大健康产业展会
猜你喜欢
随机推荐
beginning一款非常优秀的emlog主题
1712. number of schemes for dividing the array into three sub arrays ●●
Introduction and usage of Eval function
迭代器模式--沙场秋点兵
数据库系统概论 ---- 第二章 -- 关系数据库(2.4 关系代数)
[CV basis] Color: rgb/hsv/lab
Probability theory: calculating confidence intervals
数字藏品系统app源码
SWUST oj668: the thief ran away
把程序写进微控制器里可以更方便快捷的控制电机正反转
Application of volatile in single chip microcomputer
Don't be a fake worker
Planck plan 2022 Huawei software elite challenge is coming!
使用Yolov5训练自己制作的数据集,快速上手
Jerry's ble chip power supply range and anti burn chip measures [chapter]
Implementation of competition scoring system based on C language
外观模式--在各种套餐中早就用到啦!
校园失物招领小程序源码可作毕业设计
Implementing declarative rest calls using feign
使用国产MCU(国民技术 N32G031F8S7) 实现 PWM+DMA 控制 WS2812








