Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 32

BISM7206 期中知识点整理

Week 1 Objectives
By the end of this lecture, you should be able to:
• Understand the difference between files vs databases-了解文件与数据
库之间的区别
• Understand the key concepts of a database-了解数据库的关键概念
• Describe the functions of a DBMS-描述 DBMS 的功能
• Understand the purpose of three-level database architecture.- 了解三级
数据库体系结构的用途。

1. File-based systems
Collection of application programs that perform services for the end users (e.g.



reports).


为最终用户提供服务的应用程序集合(例如报告)



Each program defines and manages its own data. 每个程序定义并管理自己的数据。




TERM DEFINITION 他

Data Raw facts, such as a telephone number, a birth date, a customer name, and a year-to-date (Y TD) sales value. Data have

使

little meaning unless they have been organized in some logical manner.原始事实,例如电话号码、出生日期、客户

姓名和年初至今(Y TD)销售价值。除非以某种逻辑方式组织数据,否则它们几乎没有意义。

Field A character or group of characters (alphabetic or numeric) that has a specific meaning. A field is used to define and

store
uq

data (e.g. student name).具有特定含义的字符或字符组(字母或数字)。字段用于定义和存储数据(例如学生姓


名)。

Record
A logically connected set of one or more fields that describes a person, place, or thing. For example, the fields that

constitute a record for a customer might consist of the customer's name, address, phone number, date of birth, credit

limit, and unpaid balance.描述人、地点或事物的一个或多个字段的逻辑连接集。例如,构成客户记录的字段可


能包括客户的姓名、地址、电话号码、出生日期、信用额度和未付余额。
sm
bi

File

A collection of related records. For example, a file might contain data about the students currently enrolled at UQ.相关

记录的集合。例如,一个文件可能包含当前在 UQ 注册的学生的数据。


2. Limitations of File-Based Approach 文件 based 方式的局限性 Separation and


isolation of data 数据的分离和隔离



Duplication of data (data redundancy) 数据重复(数据冗余)


Data dependence 数据依赖性


uq

Incompatible file formats 不兼容的文件格式


Fixed Queries 固定查询
Proliferation of programs 项目激增

3. The Database
Shared collection of logically related data (and a description of this data), stored in a
single logical data repository 逻辑相关数据(以及该数据的描述)的共享集合,
存储在单个逻辑数据存储库中 A database is designed to meet the information needs








5. Database System vs File System





使




uq







sm
bi









uq

of an organisation. 数据库旨在满足组织的信息需求。Database system =


Computerised record-keeping system 数据库系统=计算机化记录保存系统。

4. Purpose of a Database System 数据库系统的用途目的


Store & maintain data 存储和维护数据
Enable easy and timely access to informative, accurate, useful and relevant data 能够
轻松及时地访问信息丰富、准确、有用和相关的数据
Enables more informed and better business decisions 实现更明智、更好的业务决
6. The Paradigm Shift
File-Based Approach:基于文件的方法:
driven by application system needs of different departments (area) within an
organisation 由组织内不同部门(区域)的应用系统需求驱动
Database Approach:数据库方法:
Organisation now needs to think of the data first (e.g. develop a corporate data
model) and then think of the various applications.组织现在需要首先考虑数据(例
如开发公司数据模型),然后考虑各种应用程序。
This change in approach is a ‘Paradigm Shift’这种方法的改变是一种“范式转变”

7. Advantages of the Database Approach Control of data


redundancy 控制数据冗余
Data consistency 数据一致性
More information from the same amount of data 从相同数量的数据中获取更多信息
Sharing of data 数据共享
Improved data integrity 改进的数据完整性
Improved security 提高安全性
Enforcement of standards 标准的执行
Economy of scale 规模经济
Balance conflicting requirements 平衡相互冲突的需求
Improved data accessibility and responsiveness 改进了数据的可访问性和响应能力
Increased productivity 提高生产力
Improved maintenance through data independence 通过数据独立性改进维护
Increased concurrency 增加并发性
Improved backup and recovery services 改进的备份和恢复服务

8. Disadvantages of the Database Approach


Complexity 复杂性
Size 大小
Cost of DBMS 成本
Additional hardware costs 额外的硬件成本
Costs of conversion 转换成本
Performance 性能

Impact of failures 故障的影响




9. Data Analysis/Database Design 数据分析/数据库设计 The aim of creating databases is to: 创



建数据库的目的是:

Manage data efficiently and effectively to enable easy, timely, informative and accurate

access

to relevant and useful data.高效地管理数据,以便轻松、及时、信息丰富、准确地访问相关和有用的



数据。
使




uq




sm
bi


We know that a database is a shared collection of logically related data designed to meet the


information needs of an organisation.Therefore, we must analyse the information needs of users,


understand the data, and identify the logical relationships within the data.Then, we can design a

well-structured database that meets the needs of the users 我们知道,数据库是逻辑相关数据的


共享集合,旨在满足组织的信息需求。因此,我们必须分析用户的信息需求,了解数据,

并确定数据中的逻辑关系。然后,我们可以设计一个结构良好的数据库,以满足用户的需

求.
uq

10. Database Management Systems (DBMS)


A DBMS is a software system that enables us to define, create, maintain and control access to
the database. toDBMS 是一种软件系统,它使我们能够定义、创建、维护和控制对数据库的访问。

11. Components of the DBMS environment

12. Components of the DBMS environment


Hardware - Can range from a PC to a network of computers (depends on the


organisation‘s requirements and the DBMS used).硬件——可以是 PC,也可以是

计算机网络(取决于组织的要求和使用的 DBMS)。

Software - DBMS, operating system, network software (if necessary) and



application programs.软件——数据库管理系统、操作系统、网络软件(如有必要)和应用程

序。

Data - Used by the organisation & a description of the data (metadata).数据——


组织使用的数据和对数据(元数据)的描述。

使

Procedures - Instructions and rules that should be applied to the design and use

of the database and DBMS.程序——设计和使用数据库和 DBMS 时应使用的说明


和规则。

People - End users, application programmers, database designers, database


uq

administrator, data administrator 人员-最终用户、应用程序程序员、数据库设计师、


数据库管理员、数据管理员


13. DBMS functions (三种 functions 用加粗标出)



Data Storage, Retrieval, and Update.数据存储、检索和更新。


Data definition language (D D L):Enables data to be specified (names, data types,


sm

structure and constraints) and stored in a structured manner.允许以结构化方式指定


bi

和存储数据(名称、数据类型、结构和约束)。All specifications are stored in the


database.所有规格都存储在数据库中。

Data manipulation language (D M L): General enquiry/retrieval and update







uq
facility (query language) of the data 数据的一般查询/检索和更新设施(查询语
言)
A user-accessible catalogue.用户可访问的目录。
Repository for describing data about the database:用于描述数据库数据的存储库:
Aka Metadata 又名元数据 Fundamental component of the DBMS 数据库管理系统
的基本组成部分 Stores definitions of the data elements and their relationships
i.e. describes data characteristics such as:存储数据元素及其关系的定义,即描述数
据特征,例如:names, types, and sizes of data items;数据项的名称、类型和大小;
integrity constraints;完整性约束;users’ access rights;用户的访问权限;usage
statistics.使用统计。
Transaction support.事务支持。
Database transaction processing falls into one of four categories (CRUD):
数据库事务处理分为四类(CRUD):
Create – insert new data record (table, record, row, relation)创建–插入新数据记录
(表、记录、行、关系)
Read - retrieve existing data record 读取-检索现有数据记录
Update - change or modify existing data 更新-更改或修改现有数据
Delete – remove a complete data record 删除–删除完整的数据记录

14. ACID 数据库的四个特性


Atomicity, Consistency, Isolation, Durability 原子性、一致性、隔离性、耐久性

15. Database Environment - Chapter 2


Purpose of three-level database architecture 三级数据库体系结构的目的
External, conceptual, and internal levels 外部、概念和内部级别

Purpose of external/conceptual and conceptual/internal mappings.外部/概念和概念/


内部映射的目的。

Meaning of logical and physical data independence.逻辑和物理数据独立的含义。


A classification of data models.数据模型的分类。



Purpose/importance of conceptual modelling.概念建模的目的/重要性。




16. Three-level Database Architecture


Database design should provide users with an abstract view of data 数据库设计应该

为用户提供数据的抽象视图
使

Each user may require a different view of the data 每个用户可能需要不同的数据视




Therefore, database design must provide an abstract and general description 因此,
uq

数据库设计必须提供抽象和一般的描述

A user’s view is immune to changes made in other views.用户的视图不受其他视图



中所做更改的影响

Users should not need to know physical database storage details.用户不需要知道物


理数据库存储的详细信息。


sm
bi




















使




uq





External (logical) : Individual users ’ view of the database ; Describes that part of

database that is relevant to a particular user.


sm

Conceptual (logical) : Community view of the database i.e. logical view of the whole
bi

database. 数据库的 社 区 视图 , 即 整个数据库的逻辑 视图 。 Describes what data is


stored in the database and the relationships among the data e.g. constraints and

integrity information. 描述数据库中存储的数据以及数据之间的关系,例如 约束


和完整性信息。

Internal (physical) : Physical implement ation of the database. 数据库的 物 理实现。


Describes how data is stored in the database e.g. storage space allocation, indexes,

data compression, encryption.


uq

描述数据如 何 存储在数据库中,例如存储 空 间分
配 、 索引 、数据 压缩 、加 密 。

17. Schemas overall description of the database (but it is not the actual data)数据库
的总体描述
(但不是实际数据)
Specified during the database design 在数据库设计期间指定
Should not change often 不应该经常改变
Consists of 3 different types of schema 由 3 种不同类型的模式组成
18. Three Types of Database Schema 三种数据库模式
Defined according to the levels of abstraction of the three-level architecture 根据三层
架构的抽象级别定义
External schema (sometimes called subschema) – 外部模式(有时称为子模式) highest
level of abstraction 最高层次的抽象
may be several external schemas (different user views) 可能有多个外部架构(不同
的用户视图)
Conceptual schema 概念图式

External views are merged into 1 conceptual view 外 部 视图 合并为一个概念 视图


Describes entities, attributes, relationships, constraints 描述实体、 属 性、关系和 约




Internal schema 内部模式


Lowest level of abstraction 最 低抽象层次



Description of internal model e.g. storage space allocation, indexes, data compression,


encryption 描述内部模型,例如存储 空 间分 配 、 索引 、数据 压缩 、加 密





使




uq







sm
bi




19. Data Models



Integrated collection of concepts for describing data, relationships between data, and

constraints on the data in an organisation. 用于描述数据、数据之间关系和组织中



uq

数据 约束 的集 成 概念集合。
A high -level description of the database & is understa ndable by a variety of users. 对
数据库的高级描述 & 各种用户 都 能理解。
A data Model comprises:数据模型包括:
• a structural part;结构部件;
• a manipulative part;操纵的部分;
• possibly a set of integrity rules 可能是一套完整性规则

20. Various Model Types


Data models represent data in an understandable way 数据模型以可理解的方式表示
数据
Object-Based Data Models – use entities, attributes and relationships 基于对象的数据
模型——使用实体、属性和关系:
Entity-Relationship 实体关系
Semantic 语义的
Functional 功能的
Object-Oriented.面向对象。
Record-Based Data Models – fixed-format records 基于记录的数据模型——固

定格式记录 :


Relational Data Model 关系数据模型


Network Data Model 网络数据模型



Hierarchical Data Model. 分 层 数据模型。


Physical Data Models 物 理数据模型







使




uq







sm
bi









uq
Week 2 DB System Development Lifecycle & DB Analysis - Ch 10 &11 Objectives:
Understand the Database Development Lifecycle.
Understand the main phases of database design: conceptual, logical, and physical
design.
Understand fact-finding.

Part 1: DB System Development Lifecycle


1. Information System vs Database System 信息系统与数据库系统
Information System (IS):
Resources that enable collection, management, control, and dissemination of
information throughout an organization.能够在整个组织中收集、管理、控制和


传播信息的资源。


Computer-based IS includes:基于计算机的 IS 包括:



Application software; Database software;应用软件;数据库软件


Computer hardware;计算机硬件;



People – system users, system developers.系统用户、系统开发人员。 Database


System:


Database is a fundamental component of IS,数据库是信息系统的基本组成部分

DB development/usage should be viewed from perspective of the wider


requirements of the organization.数据库的开发/使用应该从组织更广泛的需求


使

的角度来看待


2. Database System Development Lifecycle Stages 数据库系统开发生命周期阶段


uq

Lifecycle of an IS is linked to the lifecycle of its supporting database system


IS 的生命周期与其支持的数据库系统的生命周期相关联


database planning,数据库规划:Planning how the stages of the lifecycle can be



realized most efficiently and effectively.规划如何最有效地实现生命周期的各个


阶段。
sm
bi

system definition,系统定义:Specifying the scope and boundaries of the database


system, including the major user views, its users, and application areas.指定数据

库系统的范围和边界,包括主要用户视图、用户和应用程序区域。

requirements collection and analysis,需求收集和分析:Collection and analysis



of the requirements for the new database system.收集和分析新数据库系统的需



uq

database design,数据库设计:Conceptual, logical, and physical design of the


database.数据库的概念、逻辑和物理设计

DBMS selection (optional):DBMS 选择(可选),Selecting a suitable DBMS


for the database system.为数据库系统选择合适的 DBMS。
application design,应用程序设计:Designing the user interface & application
programs that use and process the database.设计使用和处理数据库的用户界面
和应用程序。

prototyping (optional),原型设计(可选):Building a working model of the


database system, which allows the designers or users to visualize and evaluate
how the final system will look and function.建立数据库系统的工作模型,允许
设计师或用户可视化并评估最终系统的外观和功能。

implementation,实施:Creating the physical database definitions and the


application programs.创建物理数据库定义和应用程序。




data conversion and loading,数据转换和加载:Loading data from the old system


to the new system and, where possible, converting any existing applications to run


on the new database.将数据从旧系统加载到新系统,并在可能的情况下,将任何现有应用



程序转换为在新数据库上运行。




testing,测试:Database system is tested for errors and validated against the。

requirements specified by the users.对数据库系统进行错误测试,并根据用户



使

指定的要求进行验证。


operational maintenance.操作维护:Database system is fully implemented. The


system is continuously monitored and maintained. When necessary, new


uq

requirements are incorporated into the database system through the preceding

stages of the lifecycle.数据库系统已全面实现。该系统持续受到监控和维护。



必要时,通过生命周期的前几个阶段将新需求合并到数据库系统中。



3. Database System Development


sm

Must be integrated with overall IS strategy of the organisation.必须与组织的整体


bi

IS 战略相结合。Mission statement for the database project defines major aims


and purpose of the database project.数据库项目的任务声明定义了数据库项目



的主要目标和目的。Database planning should also include development of


standards that govern:数据库规划还应包括制定管理以下各项的标准(how


data will be collected,如何收集数据;how the format should be specified,如何指



定格式;what necessary documentation will be needed,需要哪些必要的文件;


how design and implementation should proceed.设计和实现应该如何进行)


uq

System Definition describes scope and boundaries of database system & the major
user views.描述数据库系统的范围和边界以及主要的用户视图。

Part 2 Database Design


Process of creating a design for a database that will support the enterprise’s mission
statement and mission objectives for the required database system.为数据库创建设计
的过程,该数据库将支持企业的任务声明和所需数据库系统的任务目标。
Data modeling:数据建模:
Vital prerequisite to building a database;建立数据库的重要前提;
Understanding of the data requirements;了解数据要求;

数据 ;




1. Data Modelling


Data model is a graphical abstract representation of the data requirements; 数据



模型是数据需求的 图形抽象表示


Assists in understanding the meaning (semantics) of the data; 帮助 理解数据的



含 义( 语 义) ;


Facilitates communication about the information requirements; 促 进有关信息


使
需求的 沟 通 ; 费
Give an overall view of the database; 给出 数据库的 总 体 视图;

Organize data for various u sers. 为各种用户组织数据。



Various data modelling techniques/model types e.g. 各种数据 建 模 技术 / 模型 类


uq

型,例如 : Entity -Relationship model; 实体关系模型 ; Hierarchical model; 层


次 模型 ; Relational model; 关系模型 ; Object -oriented model 面向对象 模型




2. Database Design

Three phases of database design:


Conceptual 概念的 dat abase design


sm

Logical database design


bi

Physical database design.










uq

Understanding of the data to be stored in the database;了解要存储在数据库中的


Three-Level ANSI-SPARC Architecture and Phases of Database Design

3. Conceptual Database Design


Part of the enterprise that we are interested in modelling; 我们对建模感兴趣
的企业的一部分
Independent of all physical/implementation considerations; 独立于所有物理/
实施考虑;
Uses the information in users’ requirements specification; 使用用户需求说明
书中的信息;
Source of information for logical design phase. 逻辑设计阶段的信息来源

4. Logical Database Design


Conceptual data model is refined & mapped on to a logical data model;概
念数据模型被细化并映射到逻辑数据模型


Logical structure (describes relations & constraints);逻辑结构(描述关系


和约束);



DBMS is known so we know the specific data model (e.g. relational);


DBMS 是已知的,因此我们知道特定的数据模型(例如关系型)



Independent of physical considerations such as storage;独立于物理因

素,如存储;

Tested and validated against the users’ requirements;根据用户要求进行


测试和验证;

Model is normalised to test correctness and eliminates data redundancy


使

模型被标准化以测试正确性并消除数据冗余


5. Physical Database Design 物理数据库设计


uq

Designed for a specific DBMS system - DBMS is known so we know the


specific data model (e.g. relational);为特定的 DBMS 系统设计——



DBMS 是已知的,因此我们知道特定的数据模型(例如关系型);

Describes the database implementation 描述数据库实现



i. file organizations,档案组织,

ii. indexes,索引,
sm

iii. security measures;安全措施;


bi

Main aim is to describe how to physically implement the logical database



design.主要目的是描述如何物理实现逻辑数据库设计。


Part 3 Fact-finding

1. Fact-finding

Critical to capture the necessary facts to build the required database application;

Fact-finding: formal process of using techniques such as interviews and


uq

questionnaires to collect facts about systems, requirements, and preferences.


ü Fact-finding used throughout the database application lifecycle; ü Crucial to
the early stages including database planning, system definition, and
requirements collection and analysis stages.
ü Enables developer to understand the users and the system they want/need.
2. Examples of the types of facts collected during the DSDL(ppt page 24)
3. Fact-finding Techniques examining documentation
interviewing
observing the organization in operation research questionnaires


更 详细 的 关于 每种 方式 的 优缺 点 和 何 时 使用 参 考 text book ch. 11.3












使




uq







sm
bi









uq

Brainstorming
WEEK 3 Entity-Relationship Modelling - Ch 12 & Ch 13
Objectives
Understand the purpose & importance of using entity-relationship (ER) modelling
in a business environment.
Explain the entity-relationship diagram (ERD):
Build an ER model from a requirements specification.
Appreciate the limitations of the ER model.
Understand the concept of specialisation/generalization.

Part 1: ER Modelling in DB Design


1. Importance of Data Models
Communication tool
Give an overall view of the database
Organise data for various users
Abstraction for the creation of a good database

First proposed by Chen (1976) and refined by many other




2. Main components of ER Model : Entities, Relationships, Attributes


a. Entities: 个

Entity type:

Distinct ot group of objects 不同的物体群 E.g. Students, Staff,


Properties,例如学生、员工、财产 , a course or faulty . Refers to the



entity set and not to a single entity


occurrence 指的是实体集,而不是单个实体引用
使

Entity occurrence: Uniquely identifiable object of an entity type 实体类型


的唯一可标识对象

Unique or independent existence 独特的或独立的存在



uq

Same properties/attributes 相同的属性/属性


b. Relationships

Relationship type:

Meaningful associations between entities.实体之间有意义的关联。



Records the way two or more entities participate 记录两个或多个实体参


sm

与的方式
bi

Represented with a simple verb phrase (e.g. works at)用一个简单的动词



短语表示(例如,works at)

Written in the present tense and descriptive.用现在时态写的,描述性的。




Students enrolled a course, staff work in a branch



uq

Verb phrase: Work at …


Relationship occurrence:
Uniquely identifiable association 唯一可识别关联
Includes one occurrence from each participating entity type.包括每个参与
实体类型中的一个事件。

Relationship Degree: (例子见 ppt14 页)


Number of entities associated with a relationship: 与关系关联的实体数:
Binary relationship: two entities are associated 二元关系:两个实体相关

Ternary relationship: three entities are associated 三元关系:三个实体相
关联 :
Quaternary relationship: four entities are associated
四元关系:四个实体相关联: A SOLICTIOR 业务员 ARRANGES A BID ON
BEHALF OF a buyer supported by a financial institution
Recursive relationship: same entity type participates more than once in
different roles.递归关系:同一实体类型多次参与不同的角色。 Staff
(supervisor) supervises staff (supervisee)

c. Attributes 属性: (more detail 重要):


Each entity has a set of attributes;每个实体都有一组属性;
Property or characteristic of the entity that the organisation wants to store;
组织想要存储的实体的财产或特征;
Named
Single value or multiple values 单值或多值

Attribute Domain 属性域: Set of allowable values (gender)

Attribute Types:
`Single-valued Attribute 单值属性:Has a single value for each entity
occurrence;每个实体引用都有一个值 Sometimes called ‘atomic’
attributes (e.g. studentID).有时被称为“原子”属性(例如 studentID, last
name ,fierst name)。

`Composite Attribute 复合属性:Composed of multiple components (e.g.


address).由多个组件组成(例如地址)。 : postcode

`Multi-valued Attribute 多值属性:Attribute with multiple values for each


occurrence of an entity type (e.g. address; qualification, phoneNumber).属
性,每个实体类型(例如地址、资格、电话号码)都有多个值。

`Derived Attribute 派生属性:Attribute value is derivable from value of a


related attribute 属性值可从相关属性的值派生


3. Keys – uniquely identifies an entity occurrence.














uq



Candidate Key - Minimal set of attributes that uniquely identifies an. entity


(alternate key/secondary key).唯一标识实体的最小属性集(备用键/辅助


键)



Primary Key - Candidate key selected to uniquely identify an entity.选择候
sm
选密钥以唯一标识实体。
bi
Composite Key - Candidate key that consists of two or more. attributes.由两

个或多个属性组成的候选密钥。







uq

4. Strong/Weak Entities
Strong Entity: Existence is independent of other entity types i.e. it can exist
apart from all its related entities. 存在独立于其他实体类型,即它可以独立
于所有相关实体而存在。
Weak Entity: Existence is dependent on another entity type i.e. it only exists.
when it is associated with another related entity occurrence. 存在依赖于另一
个实体类型,即仅当它与另一个相关实体关联时才存在。Primary key is
partially or totally derived from parent entity 主键部分或全部来自父实体

5. Strong/Weak Relationships
Weak ( non -identifying) relationship : Primar y key of the related entity does .
not contain a primary key component of the parent entity 相关实体的 主 键不
包含 父 实体的 主 键组件
Strong (identifying) relationship : Primary key of the related entity contains a .
primary key component of the parent entity 相关实体的 主 键 包含 父 实体的
主 键组件
Part 2:Structural Constraints
1. Structural Constraints 结构约束
Based on business rules;基于商业规则;
Relate to entities that participate in a relationship;与参与关系的实体相关;
Restrictions on relationships should reflect the ‘real world’;对关系的限制应该反
映“现实世界”;E.g. a car must have an owner, a student can only have one Date
of Birth; Main type of constraint is called “Multiplicity”.约束的主要类型称为

2. Multiplicity (main type of structural constraint)


Multiplicity consists of two types of restrictions on relationships: 多重性 包括两 种
类 型的关系限制:
Cardinality : Maximum num ber of possible relationship occurrences for an
entity participating in a given relationship type (0, 1, M). 参 与 给 定关系 类 型的实
体可能 出 现的最 大 关系 次 数( 0, 1, M ).
Particip ation : Determines if all or only some entity occurrences participate in a
relationship (mandatory or optional). 确定是 否 所 有 或 仅某 些 实体 事 件 参 与关系
(强制或可选)

Staff Manages Branch Relationship


“多重性”。
3. Business Rules: the basis for DB or structural constraints













使

4. Multiplicity Constraints – different notations




uq







sm
bi









uq
5. ER Notations
6. Composite Entities
Used to eliminate a Many to Many (M:N) relationship between two entities
用于 消除两 个实体之间的多 对 多( M:N ) 关系
Composite (new) entity created between the original entities
在 原 始 实体之间 创建 的复合( 新 )实体
Has a 1:M relationship with the original ( parent) entities
与 原 始 ( 父 )实体有 1: M 关系
Composed of the primary key attributes of each parent entity
由每个 父 实体的 主 键 属 性组 成
May also con tain additional attributes
还 可能 包含其他属 性

7. Developing an ER Diagram
Create a detailed narrative of the organisation’s description of operations 对
组织的运营进行详细描述
Identify main entities and relationships 确定主要实体和关系
Identify business rules (constraints)
确定业务规则(约束)
Develop the initial ER Diagram including relationships based on the rules 开
发初始 ER 图,包括基于规则的关系
Identify the attributes and primary keys that adequately describe the entities
确定适当描述实体的属性和主键
Revise and review ER Diagram – it is an iterative process 修订和审查



ER 图——这是一个迭代过程




Part 3 Enhanced ER Modelling




1. Enhanced ER Model


EER modelling enables for more complex situations; EER 建模可用于
更复杂的情况; 其

Additional ‘semantic’ modelling concepts needed;需要额外的“语义”建


使

模概念;

Incorporated into the original ER model;纳入原始 ER 模型;


Most useful addition to the EER model is specialization / generalization.


EER 模型最有用的补充是专门化/泛化。
uq

2. Specialisation / Generalization

Superclass

Entity type;

Includes one or more distinct subgroupings of its occurrences. Subclass



sm

Distinct subgrouping.不同的亚组。
bi

Superclass/subclass relationship is 1:1;


Superclass may contain overlapping or distinct subclasses.


Not all members of a superclass need be a member of a subclass.



Attribute Inheritance 属性继承:An entity in a subclass represents.


same ‘real world’ object as in superclass, and may possess



subclassspecific attributes, as well as those associated with the superclass.


子类中

的实体表示与超类中相同的“真实世界”对象,并且可能具有子类特定的属性,以
uq

及与超类关联的属性。
Specialisation 专业化: Process of maximizing differences between.
members of an entity by identifying their distinguishing characteristics.
通过识别实体成员的显著特征,最大化其差异的过程。
Generalisation:Process of minimising differences between entities by
identifying their common characteristics.通过识别实体间的共同特征来
最小化实体间差异的过程。
3. Constraints on Specialization/Generalization
a. participation constraints :
Shows whether ev ery member in superclass must also participate as a
member of a subclass.
May be mandatory or optio nal .
b. disjoint constraints
Indicates whether member of a s uperclass can be a member of one, or
more than one, subclass.
May be disjoint (can be member of only one subclass) or nondisjoint
(entity may be member of more than one subclass).

4. Four categories of constraints of specialization/generalization


a. mandatory and disjoint: {Mandatory, Or}
b. optional and disjoint: {Optional, Or}
c. mandatory and nondisjoint: {Mandatory, And}
d. optional and nondisjoint: {Optional, And} optional and

nondisjoint:{optional , and}













使




uq







sm
bi









uq

WEEK 4 Relational Modelling

Objectives
• Understand the terminology and structure of the relational model;
• General awareness of the connection between mathematical relations and
relations in the relational model;

• Identify different types of database keys


• Understand integrity cons traints


• Describe views and their importance


• Apply relational model concepts to a simple database.




Part 1: Structure of the relational model



1. The Relational Database Management System (RDMS)


A Relational Database is: a collection of normalised relations ; Normalisation ; For



now, consider a normalised relation to be a table composed of rows and columns


where each cell contains a single value.

使

2. Major commercia l relational database products include : Oracle ;DB2 (IBM) ;SQL

Server ;MySQL


uq

3. Research and Commercial Implementations









sm
bi









uq
4. Relational Schema
a. Represents individual named relations and their attributes;
b. Organisation of the DB as described by the DB administrator
c. Describes structure and characteristics of each relation.
uq








5. Relational Terminology
bi
sm







uq




使












All data is logically structured within relations (tables) 所有数据都在关系
(表)中进行逻辑结构
A relation is a table with columns/attributes and rows/tuples 关系是包含列/
属性和行/元组的表
Each relation has a name 每个关系都有一个名字

Each attribute is the name of a column of a relation


每个 属 性 都 是关系中一 列 的 名称


Each tuple is a row of a relation & contains one value per attribute


每个 元 组是一个关系的一行,每个 属 性 包含 一个 值











使




uq







sm
bi









uq

6. Properties of Relations (tables)


Relation names are unique (distinct).关系名称是唯一的(不同的)。
A relation/table is perceived as a two-dimensional structure with rows and.
columns 关系/表被视为一个具有行和列的二维结构
Each cell of a relation contains exactly one atomic (single) value.一个关系的
每个单元格只包含一个原子(单个)值。
Each attribute (column) has a unique name (within each relation).每个属性
(列)都有一个唯一的名称(在每个关系中)。
Values of an attribute are within the same domain and are of the same data
format.属性的值位于同一个域中,并且具有相同的数据格式。
The order of attributes and tuples has no significance.属性和元组的顺序没
有意义。
Each tuple/row is distinct or unique i.e. no duplicate tuples.每个元组/行都是
不同的或唯一的,即没有重复的元组。

7. Relational Keys 关系键 (各个键的关系和使用是重点,具体参考 week4


ppt17-20 页)
a. Superkey
b. Candidate Key
c. Primary key


d. Alternate key



e. Foreign key 人
f. Composite key

g. Secondary key


Part 2 Mathematical Relations




1. Cartesian product 笛卡尔积



使

The concept of Cartesian products applies to databases. That is, flexibility can

be maximized by creating new (typically temporary) tables that combine each


record from each initial table with each record of all other initial tables of

interest. Therefore, we can define relations mathematically.


uq

Suppose there are two sets: A = {1, 3} and B = {0, 2, 4}



A x B = {(1, 0), (1, 2), (1, 4), (3, 0), (3, 2), (3, 4)}

For example, suppose C = { j, k }


A x B x C = {(1, 0, j), (1, 2, j), (1, 4, j), (3, 0, j), (3, 2, j), (3, 4, j), (1, 0, k), (1,

2, k), (1, 4, k), (3, 0, k), (3, 2, k), (3, 4, k)}


sm
bi

Any subset of Cartesian product is a relation


May specify which pairs are in relation using some condition for selection;

e.g. second element is 1


Or, first element is always twice the second:





R = (2,1){, (4, 1)}


uq
R= ({ x y x D y D, )| Î Î1, , and
2

y = }1

S ={(x y x D y D, ) | Î Î, , and x=
2y}
1 2

2. What is the Cartesian product below?


Part 3 Integrity Constraints
Integrity Constraints 完整性 约束 ( 重点 )
Protect the database from becoming: 保护数据库, 防止 其成 为:
• Incomplete, 不完整,
• Inaccurate, 不准确的,
• Inconsistent 不一致的
To ensure logical model is a true representation of the organization’s data .
requirements, integrity constraints must be checked by identifying: 为了确保
逻辑模型 真 实地 表示 组织的数据需求, 必须 通过确定以 下 内容 来检 查完
整性 约束 : ( 以 下 内容 的 定义 c和 例 子 参 考 week 4 ppt 30 -43 页 )
a. Required data 所 需数据
b. Attribute domain constraints 属 性域 约束
c. Multiplicity 多种多 样
d. Entity integrity 实体完整性
e. Referential integrity 参 照 完整性
f. General constraints 一 般约束 条 件

You might also like