关系模型(relational model)

1.关系模型的数据结构

(1)关系(relation):一个关系就是一张二维表

(2)元组(tuple):表中的一行

(3)属性:表中的一列,一列的名称叫做属性名(列名)

(4)主码:也称码键,表中的某个属性组,他可以唯一确定一个元组

(5)域:一组具有相同数据类型的值得集合,属性的取值范围来自某个域

(6)分量:元组中的一个属性值(一条记录中的一个列值)

(7)关系模型:对关系的描述,关系名(属性1,属性2,,,,属性n)

举个例子:性别的域是“男,女”;

     对学生关系的描述:学生(姓名,性别,学号,系别,年级)

2.关系模型的要求

(1)最基本的规范条件:不允许表中有表

3.操作和完整性约束条件

(1)集合的操作:增删改查

(2)关系的两个不变形:实体完整性,参照完整性

(3)用户定义的完整性

4.缺点

(1)查询效率低

(2)为了提升查询性能,会增加开发人员的工作难度

————————

1. Data structure of relational model

(1) Relationship: a relationship is a two-dimensional table

(2) Tuple: a row in a table

(3) Attribute: a column in the table. The name of a column is called attribute name (column name)

(4) Main code: also known as code key, it is an attribute group in the table, which can uniquely determine a tuple

(5) Field: a set of values with the same data type. The value range of the attribute comes from a field

(6) Component: an attribute value in a tuple (a column value in a record)

(7) Relationship model: description of relationship, relationship name (attribute 1, attribute 2,,, attribute n)

For example, the gender domain is “male, female”;

Description of student relationship: student (name, gender, student number, Department, grade)

2. Requirements for relational model

(1) The most basic specification condition: tables in tables are not allowed

3. Operational and integrity constraints

(1) Set operation: add, delete, modify query

(2) Two immutability of relationship: entity integrity and reference integrity

(3) User defined integrity

4. Disadvantages

(1) Low query efficiency

(2) In order to improve query performance, it will increase the difficulty of developers