Computer subject

Databes Chapter 1 Introduction CMPT-354-Han-95.3 Lecture Notes September 10, 1995 1.0 Database Management Systems 1. A database management system (DBMS), or simply a database system (DBS), consists of A collection of interrelated and persistent data (usually referred to as the database (DB)). A set of application programs used to access, update and manage that data (which form the data management system (MS)). 2. The goal of a DBMS is to provide an environment that is both convenient and e cient to use in Retrieving information from the database. Storing information into the database. 3. Databases are usually designed to manage large bodies of information. This involves De nition of structures for information storage (data modeling). Provision of mechanisms for the manipulation of information ( le and systems structure, query process- ing). Providing for the safety of information in the database (crash recovery and security). Concurrency control if the system is shared by users. 1.1 Purpose of Database Systems 1. To see why database management systems are necessary, let's look at a typical \ le-processing system" supported by a conventional operating system. The application is a savings bank: Savings account and customer records are kept in permanent system les. Application programs are written to manipulate les to perform the following tasks: { Debit or credit an account. { Add a new account. { Find an account balance. { Generate monthly statements. 2. Development of the system proceeds as follows: New application programs must be written as the need arises. New permanent les are created as required. 1 2 CHAPTER 1. INTRODUCTION but over a long period of time les may be in di erent formats, and Application programs may be in di erent languages. 3. So we can see there are problems with the straight le-processing approach: Data redundancy and inconsistency { Same information may be duplicated in several places. { All copies may not be updated properly. Di culty in accessing data { May have to write a new application program to satisfy an unusual request. { E.g. nd all customers with the same postal code. { Could generate this data manually, but a long job... Data isolation { Data in di erent les. { Data in di erent formats. { Di cult to write new application programs. Multiple users { Want concurrency for faster response time. { Need protection for concurrent updates. { E.g. two customers withdrawing funds from the same account at the same time| account has $500 in it, and they withdraw $100 and $50. The result could be $350, $400 or $450 if no protection. Security problems { Every user of the system should be able to access only the data they are permitted to see. { E.g. payroll people only handle employee records, and cannot see customer accounts; tellers only access account data and cannot see payroll data. { Di cult to enforce this with application programs. Integrity problems { Data may be required to satisfy constraints. { E.g. no account balance below $25.00. { Again, di cult to enforce or to change constraints with the le-processing approach. These problems and others led to the development of database management systems. 1.2 Data Abstraction 1. The major purpose of a database system is to provide users with an abstract view of the system. The system hides certain details of how data is stored and maintained Complexity should be hidden from database users. 2. There are several levels of abstraction: (a) Physical Level: How the data are stored. E.g. index, B-tree, hashing. Lowest level of abstraction. Complex low-level structures described in detail. (b) Conceptual Level: Next highest level of abstraction. 1.3. DATA MODELS 3 view 1 view 2 view n conceptual level physical level . . . Figure 1.1: The three levels of data abstraction Describes what data are stored. Describes the relationships among data. Database administrator level. (c) View Level: Highest level. Describes part of the database for a particular group of users. Can be many di erent views of a database. E.g. tellers in a bank get a view of customer accounts, but not of payroll data. Fig. ?? ( gure 1.1 in the text) illustrates the three levels. 1.3 Data Models 1. Data models are a collection of conceptual tools for describing data, data relationships, data semantics and data constraints. There are three di erent groups: (a) Object-based Logical Models. (b) Record-based Logical Models. (c) Physical Data Models. We'll look at them in more detail now. 1.3.1 Object-based Logical Models 1. Object-based logical models: Describe data at the conceptual and view levels. Provide fairly exible structuring capabilities. Allow one to specify data constraints explicitly. Over 30 such models, including { Entity-relationship model.