资源描述
Database Chapter One OutlineA database is a collection of interrelated data items
Related to some enterprise, organizations,...
Interrelated data itemsGracefully organized
Easy to access
A DBMS (DataBase Management System) provide a way to store and retrieve information about a particular enterpriseCollection of interrelated data
Set of programs to access the dataAn environment that is both convenient, efficient, credible, and secure to use
A DBS (DataBase System) contains the following components:
DatabaseDBMS
Hardware to support DBMSOperators
Drawbacks of using file systems to store data:
Data redundancy and inconsistencyDifficulty in accessing data
Integrity problemsData isolation — multiple files and formats
Data independence is terribleAtomicity of updates
Concurrent access by multiple usersSecurity problems
Physical level: describes how a record (e.g., customer) is stored.
Logical level: describes what data are stored in database, and what relationships exist among those data.
View level: application programs hide details of data types. Views can also hide information (such as an employee's salary) for security purposes.
Instances and SchemasSchema - the logical structure of the database
Physical schema(lnternal schema): database design at the physical level
Logical schema(Conceptual schema): database design at the logical level Subschema(external schema): describe different views of the database
Instance - the actual content of the database at a particular point in time
Physical Data Independence - the ability to modify the physical schema without changing the logical schema
Logical Data Independence - the ability to modify the logical schema without updating application
Data Model: A collection of conceptual tools for describingData
Data relationshipsData semantics
Data constraintsRelational model
Entity-Relationship data model (mainly for database design)Object-based data models (Object-oriented and Object-relational)
Semistructured data model (XML)半结构化模型Other older models:
Network model 网络模型Hierarchical model 层次模型
Data Definition Language (DDL):
Specification notation for defining the database schemaDDL compiler generates a set of tables stored in a data dictionary
Data dictionary contains metadata (i.e., data about data)Database schema
Data storage and definition languageSpecifies the storage structure and access methods used
Integrity constraintsDomain constraints
Referential integrity (references constraint in SQL)Assertions
AuthorizationData Manipulation Language (DML)
Language for accessing and manipulating the data organized by the appropriate data modelQuery
InsertDelete
UpdateTwo classes of languages
Procedural - user specifies what data is required and how to get those data
Declarative (nonprocedural) 一 user specifies what data is required without specifying how to get those dataSQL is the most widely used query language
Application programs generally access databases through one ofLanguage extensions to allow embedded SQL
Application program interface (e.g., ODBC/JDBC) which allow SQL queries to be sent to a databaseDatabase Design
Logical Design - Deciding on the database schema. Database design requires that we find a "good" collection of relation schemas.
Business decision - What attributes should we record in the database?
Computer Science decision - What relation schemas should we have and how should the attributes be distributed among the various relation schemas?
Physical Design - Deciding on the physical layout of the databaseThe Entity-Relationship Model
Models an enterprise as a collection of entities and relationships
Entity: a "thing" or "object" in the enterprise that is distinguishable from other objects► Described by a set of attributes
Relationship: an association among several entitiesRepresented diagrammatically by an entity-relationship diagram:
Rectangles: Entity Sets
Ellipses: AttributesDiamonds: Sets of relationship
Lines: Link attributes to entity sets and entity sets to relationshipsStorage Management
Storage manager is a program module that provides the interface between the low-level data stored in the database and the application programs and queries submitted to the system.
The storage manager is responsible to the following tasks: Interaction with the file manager Efficient storing, retrieving and updating of dataIssues:
Storage accessFile organization
Indexing and hashingQuery Processing
1. Parsing and translationOptimization
Transaction Management
A transaction is a collection of operations that performs a single logical function in a database application
Transaction-management component ensures that the database remains in a consistent (correct) state despite system failures (e.g., power failures and operating system crashes) and transaction failures.
Concurrency-control manager controls the interaction among the concurrent transactions, to ensure the consistency of the database.
Database ArchitectureThe architecture of a database systems is greatly influenced by the underlying computer system on which the database is running:
Centralized 集中式Client-server 客户/服务
Parallel (multi-processor) 并彳亍Distributed 分布式
Two-tier Architecture
And
Three-tier Architecture
client
client
server
b. three-tier architecture
a. two-tier architecture
Database Users
Users are differentiated by the way they expect to interact with the system:
Application programmers - interact with system through DML calls 应用程序员Sophisticated users -form requests in a database query language 富有经验的用户
Specialized users - write specialized database applications that do not fit into the traditional data processing framework 专业用户NaTve users - invoke one of the permanent application programs that have been written previously无经验用户
Database AdministratorDatabase administrator's duties include:
Schema definitionStorage structure and access method definition
Schema and physical organization modificationGranting user authority to access the database
Specifying integrity constraintsActing as liaison with users
Monitoring performance and responding to changes in requirements
展开阅读全文