数据库系统概论——data model

Model 

is the abstraction of real world.

模型是真实世界的抽象。

reveal the essence of objects, help people to locate and resolve problems

Data Model

explicitly determines the structure of data, and defines the operation that can be imposed, in order to represent the characteristic of the world.

数据模型定义了数据的结构和可执行的操作,以展示出现实世界的特性。

Data model is the core and fundamental of database

    Data model determines the function and performance of database

There exists different data models

    From different level, or different point of view

The evolution of data model promotes the database progress


数据库系统概论——data model

Different level of abstraction


数据库系统概论——data model

Data models

Conceptual model:

    documents and organizes the data for communication between functional and technical people

    概念模型用文档和数据用于功能和技术人员的交流。

Logical model:

    describes data semantics, data relationships, data constraints and data operation in database

    逻辑模型描述了数据库中数据的语义,数据的关系,数据的约束和数据的操作

Physical model:

    describes how data is orgnized in storage device

    物理模型描述了存储设备上数据的组织方式。

Steps in Building a DB Application


数据库系统概论——data model

概念设计——逻辑设计——物理设计

ER Model

is the most popular conceptual model

ER模型是最流行的一种概念模型

elements of ER model: 

Entities, attributes, relationships

Entities

    real-world objects distinguishable from other objects

    described using a set of attributes

Entity set

    a collection of similar entities

实体与实体集的关系如图。

数据库系统概论——data model

Attributes

    each has an atomic domain: string, integers, reals, etc.

For example:

数据库系统概论——data model

产品(product)是一个实体集,具体的产品(specific product )是实体。

price, name, category 是属性。

Relations

A mathematical definition:

    if A, B are sets, then a relation R is a subset of A × B. (笛卡儿积)

数据库系统概论——data model

Relationship Attribute

An attribute can also be property of a relationship.

For instance, the attribute access-date

数据库系统概论——data model

ER Relationship Diagrams

数据库系统概论——data model

Alternative notation for cardinality Constraints

数据库系统概论——data model

下面是一些关于ER图、三元关系的例子:

数据库系统概论——data model

三元联系:

数据库系统概论——data model

三元关系转化成二元关系:

数据库系统概论——data model

数据库系统概论——data model