数据库系统概论——Relational Model

Three elements of logical data model(LDM): 逻辑数据模型三要素

Data structure 数据结构

Data operation 数据操纵

Data constraints 数据约束


Relational Model is the most popular LDM. 关系数据模型是最常见的数据模型。

Typical relational databases: 典型的关系数据库

ORACLE

DB2

SQL Server

Access

Database Modeling & Implementation 数据库建模和实现


ER Model vs. Relational Model ER模型和关系模型的异同

  • Both are used to model data

    都是用来对数据建模的

  • ER model has many concepts

    ER模型有很多概念

        entities, relations, attributes, etc.

        实体,关系,属性等等

        well-suited for capturing the app. requirements

        非常适用于获取应用的需求

        not well-suited for computer implementation (does not even have operations on its structures)

        不太适合计算机实现(ER模型的结构里甚至没有数据的操作)

  • Relational model has just a single concept: relation

    关系模型只有一个简单的概念:关系

        world is represented with a collection of tables

        世界是用一系列表格标识的

        well-suited for efficient manipulations on computers

        非常适合计算机上高效地操作


Schemata vs. instances 

在绪论里讲过模式和示例的区别,schema 模式与instance 实例类比于程序语言的数据类型和变量的值。

String movie = “Spiderman

String 类比于模式,Spiderman类比于实例。


The Schema of a Relation:

Relation name plus attribute names
    E.g. Product(Name, Price, Category, Manufacturer)
In practice we add the domain for each attribute

The Schema of a Database

A set of relation schemata
E.g. Product(Name, Price, Category, Manufacturer), Vendor(Name, Address, Phone),...

Cartesian product 笛卡儿积

给定一组域D1, D2, …, Dn(它们可以有相同的元素,即可以完全不同,也可以部分或全部相同)。D1, D2, …, Dn的笛卡尔积为D1×D2×...×Dn={(d1, d2, …, dn)|di∈Di,i=1,2,…,n}

由定义可以看出,笛卡尔积也是一个集合。
其中:
1. 元素中的每一个di叫做一个分量(Component),来自相应的域(di∈Di)
2. 每一个元素(d1,d2,d3,…,dn)叫做一个n元组(n-tuple),简称元组(Tuple)。但元组不是di的集合,元组的每个分量(di)是按序排列的。如:
    (1,2,3)≠(2,3,1)≠(1,3,2);
而集合中的元素是没有排序次序的,如(1,2,3)=(2,3,1)=(1,3,2)。

Mathematical Definitions of Relations 关系的数学定义

关系的数学定义:

Relation is the subset of  Cartesian product

关系是笛卡儿积的子集

Relation has FINITE tuples

关系有有限个元组

因为关系的实例是有限的

Relation's features 关系的几个特点

  • Tuples with same value are not allowed.

     关系里元组的值均不同

  • Relations are unordered.

    关系是无序的

        Order of tuples is irrelevant (tuples may be stored in an arbitrary order)

        元组的顺序是无关的(元组可以按任意顺序存储)

        Order of Attributes is also irrelevant

        属性的顺序也是无关的

  • Attribute values must comply with domain constraint

    属性的值必须符合域约束

  • Each attribute must has a different name

    不同的属性必须有不同的名字

  • Different attributes can use a same domain

    不同的属性可以使用相同的域

  • Attribute values are required to be atomic; that is, indivisible

    属性的值需要是原子的,即不可分割的

    E.g. the value of an attribute can be an account number, but cannot be a set of account numbers

    例如:属性的值可以是账号,但是不能是一组账号

    Also the attribute can't be a composite one

    属性也不能是复合属性


  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值