Database concepts
Database-management system (DBMS) | A collection of interrelated data and a set of programs to access those data |
Database-system applications |
|
File-process systems | The typical file-processing system is supported by a conventional operating system The system stores permanent records in various files, and it needs different application programs to extract records from, and add records to, the appropriate files |
Data inconsistency (*drawback of file system) | The various copies of the same data may no longer agree ~比如一個學生選了雙學位,那麼在兩個學位下面都要存儲他的信息,造成冗餘 ~而且,如果學生的地址改變了,那麼可能一處進行了修改,一處沒有,造成不一致 |
Consistency constraints (*drawback of file system) | When new constraints are added, it is difficult to change the program to enforce them
|
Data abstraction | The need for efficiency has led designers to use complex data structures to represent data in the database Since users are stupid, developers hide the complexity from users through several levels of abstraction:c Physical level: how the data are actually stored Logical level: what data are stored in the database View level: users only need part of the database, so we need to simplify their interaction with the system |
Instance | The collection of information stored in the database at a particular moment 實例,類比於某個時刻某個變量的值 |
Schema | The overall design of the database 模式,類比於變量的聲明 |
physical schema | The database design at the physical level |
logical schema | The database design at the logical level |
Physical data independence | Although implementation of the simple structure at logical level may involve complex physical-level structures, the user of the logical level does not need to be aware of that |
Data models | Underlying the structure of a database is the data model: a collection of conceptual tools for describing data, data relationships, data semantics, and consistency constraints A data model provides a way to describe the design of a database at the physical, logical and view levels |
entity-relationship model (chpt 7) | E-R data model uses a collection of basic objects, called entities, and relationships among these objects An entity is a "thing" or "object" in the real world |
relational data model (chpt 2-6) | The relation model uses a collection of tables to represent both data and the relationships among those data Tables are also known as relations |
object-based data model | Extending the E-R model with notions of encapsulation, methods (functions), and object identity |
semistructured data model | Permits the specification of data where individual data items of the same type may have different sets of attributes |
Database languages | SQL is a database language |
data-defining language(DDL) | To specify the database schema by a set of definitions Also used to specify additional properties of the data |
data-manipulation language(DML) | A language that enables users to access or manipulate data as organized by the appropriate data model |
query language |
|
Metadata | 元數據是“數據的數據”,用於描述數據的特徵或性質以及該數據的內容,是數據庫的一部分 ~例如(數據名稱、定義、長度)或者(數據來源、存儲位置、擁有者) |
Application program | A program that is used to interact with the database |
Normalization | To generate a set of relation schema that allows us to retrieve information without unnecessary redundancy, yet also allows us to retrieve information easily |
Data dictionary | DDL gets some input and returns output The output of DDL is called data dictionary, which contains metadata - that is, data about data The data dictionary is considered to be a special type of table that can only be access and update by the database system itself (not a regular user) |
Storage manager | Provides the interface between the low-level data stored in the database and the application system and queries submitted to the system Including: authorization and integrity manager; transaction manager; file manager; buffer manager |
Query processor | The query processor components include: DDL interpreter: interprets DDL statements DML compiler: translate DML statements into a low-level construction that engine understands Query evaluation engine: executes low-level instructions generated by the DML compiler |
Transactions | 事務 A transaction is a collection of operations that performs a single logical function in a database application |
atomicity | All-or-none: Fund transferred or not at all |
failure recovery | Detect system failures and restore the database to the state that existed prior to the occurrence of the failure |
concurrency control | The consistency of data may no longer be preserved even though the individual transaction is correct Concurrency-control system is to control the interaction among the concurrent transactions |
Two- and three-tier database architectures | 2-tier: the application resides at the client machine 3-tier: the client machine acts as merely a front end and does not contain any direct database calls Instead, the client communicates with an application server through a forms interface; then the application server in turn communicates with the database system 3-tier is more suitable for large applications, and those applications running on the web |
Data mining | Semiautomatically analyzing larger database to find useful patterns |
Database administrator (DBA) | A person who has the central control of both the data and the programs that access those data |
|
|
Data | The data describe one particular enterprise 數據是可以記錄和存儲在計算機介質上的關於對象和事件的事實 Or 數據是在用戶環境中具有意義和重要性的對象和事件的存儲表示 |
Information | 人能看懂的數據 |
Metadata | 元數據是“數據的數據”,用於描述數據的特徵或性質以及該數據的內容,是數據庫的一部分 ~例如(數據名稱、定義、長度)或者(數據來源、存儲位置、擁有者) |
Database | Database is the collection of data, usually contains information relevant to an enterprise 長期存儲在計算機內,有組織的,可共享的大量數據集合 |
Database-management system (DBMS) | 互相關聯的數據集合(database)和一組用於訪問這些數據的程序 目標:提供一種方便、高效地存儲數據庫信息的途徑 |
Database system (DBS) | 在計算機系統中引入數據庫後的系統構成 ~包括用戶、應用系統、應用開發工具、操作系統、數據庫等等 |
Major disadvantages of file system | Data redundancy and inconsistency Difficulty in accessing data Data isolation (multiple files and formats) Integrity problem (integrity constraints) Atomicity of updates Concurrent access by multiple users Security problems (hard to provide some instead of all data) |
Database schema | 數據庫模式,也被稱爲數據庫內涵,是指對數據庫的描述 是在設計過程中規定的,不會經常改變 |
Database instance | 某一時刻數據庫中的數據,也被稱爲數據庫的外延or數據庫的狀態 數據庫的實例會經常變化 |
Relation schema | The database schema describes how the tables (relations) connect and are built, while a relation schema is essentially the schema for a table |
Relation instance |
|
Data abstraction (3-layer architecture) | 對應書上第七頁,實質上是data abstraction的三個層次
|
physical level (internal schema) | 內模式、內層、物理層。表示數據庫的物理存儲結構,和數據存儲的路徑及細節。 |
logical level (conceptual schema) | 概念模式、中間層、概念層。用於爲用戶描述數據庫的結構,注重實體、數據類型、用戶操作和約束,並且隱藏了存儲的細節。 使用表示型數據模型(E-R模型)來描述概念模式 使用實現型數據模型(OO模型)來進行概念模式設計 |
view level (external schema) | 外模式、外層、視圖層。描繪了用戶感興趣的部分數據庫,隱藏其他部分。 使用表示型數據模型(E-R模型)加以實現 |
| 三層模式的主要目的是保證數據的獨立性,即對底層的修改不會對高層造成影響。 |
physical data independence | 物理數據獨立性:概念模式不會受內模式變化的影響。 |
logical data independence | 邏輯數據獨立性:外模式不會受概念模式變化的影響。(x獨立:x變化但上一層不受影響) |
Database languages |
|
procedural languages | Procedural DMLs require a user to specify what data are needed and how to get those data |
declarative languages | Declarative DMLs (non-procedural DMLs) require a user to specify what data are needed without specifying how to get those data |
SQL: |
|
DDL | a data-definition language (DDL) to specify the database schema |
DML | a data-manipulation language (DML) to express database queries and updates What DML can do: Retrieval, Insertion, Deletion, Modification |
Query language (Select) | DML能做的是增刪改(取),query能做的是(查),但是可以混爲一談 query是請求查詢的語句,query language是DML中的取數據操作 A query is a statement requesting the retrieval if the information A query language is the portion of DML that involves information retrieval |
Types of DBS users | Database users: 4 types differentiated by the way they expect to interact with the system: Naïve users: too young too naïve, use interfaces Application programmers: they use rapid application development tools to program Sophisticated users: interact with the system without writing programs, but they use database query languages to form their request ~an analyst Specialized users: write specialized database systems Database administrators |
Functions of DBAs | Schema definition Storage structure and access-method definition Schema and physical-organization modification Granting of authorization for data access Routine maintenance |
DBMS architectures | |
ACID of transactions and meaning | Atomicity: either all operations of the transaction are reflected properly in the database, or none are Consistency: execution of a transaction in isolation (no other concurrent transaction) preserves the consistency of the database Isolation: though Ti and Tj execute concurrently, it appears to Ti that either Tj has not begun or has finished That is, each transaction is unaware of other transactions executing concurrently Durability: after a transaction completes successfully, the changes it has made to the database persist, even if there are system failures |