@Database Systems— A practical Approach to Design, Implementation, and Management
Database Systems— A practical Approach to Design, Implementation, and Management 学习记录
第二章要点
chapter 2.1 The Three-Level ANTI-SPARC Architecture
-
concentrated on the need for an implementation-independent layer to isolate programs from underlying representational issues.
集中在对独立实现层把软件从潜在的代表性问题中隔绝开。 -
three levels of abstraction, that is, three distinct levels at which data items can be described
comprising an external, a conceptual, and an internal level
抽象的三个层次,3个独立的层次包括外部层, 概念层和内部层
外部层对应user 内部层对应DBMS 概念层提供两者间的映射和必要的独立性 -
这样分的原因
- avoid being affected by other users
- users don’t have to deal with physical database storage details
- DBA should be able to change the database storage structure without affecting the users’ view
- The internal structure of the database should be unaffected by changes to the physical aspects of storage.
- The DBA should be able to change the conceptual structure of the database without affecting all users.
2.1.1 External Level
External Level ————The users’ view of the database. This level describes that part of the database that is relevant to each user.
- includes only those entities, attributes, and relationships in the ‘real world’.
就是感兴趣的提供接口,不感兴趣的封装到database中 并且不同user界面不同
2.1.2 Conceptual Level
Conceptual Level————The community view of the database. This level describes what data is stored in the database and the relationships among the data.
- 包含整个数据库逻辑结构
- represents:
- all entities, their attributes, and their relationships;
- the constraints on the data;
- semantic information about the data; 数据的语义信息
- security and integrity information.
- 外部view中所有的可获得数据都源于概念层
- 不包含储存依赖细节。
2.1.3 Internal Level
Internal Level————The physical representation of the database on the computer. This level describes how the data is stored in the database.
- 包含数据结构和文档管理
- storage space allocation for data and indexes;
- record descriptions for storage (with stored sizes for data items);
- record placement;
- data compression and data encryption techniques.
- DBMS和操作系统能相互作用
2.1.4 Schemas, Mappings, and Instances(模式映射和实例)
- The overall description of the database is called the database schema.
- highest level—— external schemas (also called subschemas)
- At the conceptual level, we have the conceptual schema(唯一)
- At the lowest level of abstraction we have the internal schema(唯一)
- The conceptual schema is related to the internal schema through a conceptual/internal mapping.
- database schema不怎么变 但实际上database一直在变
2.1.5 Data Independence(逻辑和物理上)
Logical data independence ————Logical data independence refers to the immunity of the external schemas to changes in the conceptual schema.
Physical data independence————Physical data independence refers to the immunity of the conceptual schema to changes in the internal schema.
2.2 Database Language
- DDL and DML
- 许多DBMS嵌入子语言,大多数非嵌入
2.2.1 The Data Definition Language (DDL)
-
DDL————A language that allows the DBA or user to describe and name the entities, attributes, and relationships required for the application, together with any associated integrity and security constraints.
- 定义一个或调整已有的,编译后收集于System catalog 整合了metadata。又被称为data dictionary and data directory
- 实际只需要提供一个DDL说明外部模式和概念模式。
2.2.2 The Data Manipulation Language (DML)
-
DML————A language that provides a set of operations to support the basic data manipulation operations on the data held in the database.
- 增删改查。 底层复杂 高层简单
查数据用query language - procedural and non-procedural 区分DML的两种类型
Procedural DML————A language that allows the user to tell the system what data is needed and exactly how to retrieve the data.
Network and hierarchical DMLs are normally procedural(网状和层次数据库)
-
Non-procedural DML————A language that allows the user to state what data is needed rather than how it is to be retrieved.
提供相对的数据独立性
Non-procedural languages are also called declarative languages. -
非过程语言通常有 typically SQL (Structured Query Language) or QBE (Query-ByExample) 相对更加简单
2.2.3 Fourth-Generation Languages (4GLs)
- 快捷的语言形式(shorthand)Compared with a 3GL, which is procedural, a 4GL is non-procedural
提高十倍效率 但减少了可处理问题的类型 - 包括presentation languages;speciality languages;application generators;very high-level languages that are used to generate application code
- 表单生成器:快速产生数据屏幕输入和输出形式的工具。
报表生成器:生成数据库中存储数据的报表的工具。
图形生成器: 从数据库中检索数据并以图形的形式显示数据的工具。
应用程序生成器:能产生与数据库接口的程序的工具。
2.3 Data Models and Conceptual Modeling
Data model———— An integrated collection of concepts for describing and manipulating data, relationships between data, and constraints on the data in an organization.