--Your friends at LectureNotes

Note for Database Management System - DBMS by Siddharth Rajput

  • Database Management System - DBMS
  • Note
  • 5 Topics
  • Uploaded 1 year ago
0 User(s)
Order Printed Copy

Share it with your friends

Leave your Comments

Text from page-2

Chapter 8.indd 402 4/9/2015 10:03:29 AM

Text from page-3

CHAPTER 8 DATABASES Syllabus: ER model, relational model (relational algebra, tuple calculus), database design (integrity constraints, normal forms), query languages (SQL), file structures (sequential files, indexing, B and B+ trees), transactions and concurrency control. 8.1  INTRODUCTION 8.1.1  Traditional File Processing Approach Database is a collection of organized information so that it can easily be searched, retrieved, managed and updated. A database management system (DBMS) is a set of programs designed to manage a database. It enables users to store, retrieve and modify information in a database with utmost efficiency along with ­security features. DBMS is applicable to various day-to-day fields such as transactions in banking; airline/railway/ hotel reservations; maintenance of student information in schools/universities; online retails; marketing and sales etc. It also allows its users to create their own ­databases. Different types of DBMS are available such as ­hierarchical, network, relational and object oriented. File processing approach is generally more accurate and faster than the manual database system. Each user is responsible for the defining and ­implementation of the files required for the specific application. The ­implementation of required files sometimes creates redundancy of data, for example, one user keeps records for the savings account of the customer and another user may create the loan account of the same customer. This causes the duplicity of the records of the same customer. So, this practice is not feasible for real time applications. There is a need of centralized management of data. The data is created once and then accessed by different users. The data should be shared for different transactions. It should be self-describing in nature, which means the Chapter 8.indd 403 4/9/2015 10:03:29 AM

Text from page-4

404        Chapter 8:  Databases  database system contains not only data but it describes the description of the database structure. 8.1.2  Database Management System A database is a collection of related data. Data is a collection of raw facts or figures, processed to form information. Database management system is a collection of programs for the creation and maintenance of database. It is an efficient and reliable approach to retrieve data for many users. It provides various functions such as:   1.  Redundancy control: It provides redundancy by removing duplicity of data by following rules of normalization.   2.  Data independence: It provides independence to application programs from details of data representation and storage. It also provides an abstract view of the data to insulate application code from such details.   3.  Data integrity: It promotes and enforces some integrity rules for reducing data redundancy and increasing data consistency.   4.  Concurrency control: It supports sharing of data, so, it has to provide an approach for ­managing concurrent access of the database. Hence, preserving the inconsistent state and integrity of the data.   5.  Transaction management: It provides an ap­proach to ensure that either all the updates for a given transaction will execute or that none of them would execute.   6.  Backup and recovery: It provides mechanisms for backing up data periodically and recovering from different types of failures, thus, preventing loss of data.   7.  Non-Procedural query language: It provides with query language for retrieval and manipulation of data.   8.  Security: It protects unauthorized access in the database. It ensures the access to authorized users. 8.2  COMPONENTS OF DATABASE SYSTEMS DBMS consists of several components, namely software, hardware, data, procedures and data access language. These components are responsible for the definition, collection, management and use of data within the environment. Figure 8.1 shows the components of database system. The description of each component is as follows:   1.  Software: It is the collection of programs used by the computers within the database system. It is used to handle, control and manage the database. It includes the following software: Chapter 8.indd 404 ••Operating system software like Microsoft Windows, Linux OS, Mac OS. ••DBMS software such as Oracle 8I, MySQL, ­Access (Jet, MSDE), SQL Server etc. ••Network softwares are used for sharing share the data of database among multiple users. ••Application programs are developed like C++, VB, dotnet etc. are used to access database in dbms. These are used to access and manipulate the data in the database.   2.  Hardware: It consists of all system’s physical devices such as computers, storage devices, I/O channels, electromechanical devices etc. It also includes peripherals, such as, keyboard, mouse, modems, printers, etc.   3.  Data: It is the collection of facts. The database contains the data and the metadata.   4.  Procedures: There are the instructions and rules to design and use the database system. These includes the following: ••Steps for the installation of DBMS to use the DBMS or application program ••Steps for the backup of DBMS ••Steps to change the structure of DBMS ••Steps for the generation of reports. ••Steps   5. Data access language: The users can use it to access the data to and from the database. The function of data access language is the entry of new data, manipulation of the existing data and the retrieval of the existing data in the database. The most popular database access language is SQL (Structured Query Language). Users can perform these functions with the help of commands. The role of administrator is to access, to create and to maintain the database.   6.  People: Persons involved to access, to create and to maintain the database are called users. These are of various types according to the role performed by them (Fig. 8.1). These are as follows: ••System Administrator: The role of system a­ dministrator is to supervise the general operations of DBMS. ••Database Administrator: The role of database administrator (DBA) is to manage the DBMS. ••Database Designer: The role of database ­designer is to design the structure of the database. ••Application Programmer: The role of ­application programmer is to create the data ­entry forms, reports and procedures. ••End User: The role of end user is to use the ­application programs by entering new data and manipulating and accessing existing data. 4/9/2015 10:03:29 AM

Text from page-5

8.4  DATA MODELS        405 End user Database administrator Application programmer Query processing Database manager File manager   1. Internal schema or physical level: It is also called Database Tier. Database exists in this tier. It also includes query processing languages, all relations and their corresponding constraints. It describes the physical storage structure of the database.   2.  Conceptual schema or logical level: It is also called Application Tier. Server and program exists in this tier. It also describes the structure of the database.   3. External schema or view level: It is also called Presentation Tier. End user exists in this tier. An end user is capable of multiple views of database. It also includes all views generated by applications. 8.3.2  Data Independence Data independence is defined, as the change at one level does not affect the higher level. It is of two types: Database Metadata Figure 8.1 |   Components of database systems. 8.3  DBMS ARCHITECTURE It is an approach to outlook the database by users. It is means for the representation of data in an understandable way to the users. DBMS architecture can be used to divide the whole system to related and independent modules. It can be of 1-tier, 2-tier 3-tier or n-tier.   1.  Logical data independence: It is defined, as the change in conceptual schema does not affect the external schema. For example, if the format of the table changes, the data lies in the table should not be changed.   2.  Physical data independence: It is defined, as the change in internal schema does not affect the conceptual schema. Thus, does not affect the external schema. For example, if the storage system has been changed, then it does not affect the logical structure of the database. 8.4  DATA MODELS 8.3.1  3-Tier Architecture DBMS can be most widely used as 3-tier architecture. In this architecture, the database is divided into three tiers depending upon the kind of users (see Fig. 8.2). View level Logical level Physical level Figure 8.2 |   The 3-tier architecture of DBMS. Chapter 8.indd 405 Data model is a collection of tools, which describes data, relationships, constraints and semantics. It gives the logical structure of the database. It describes the relationship of data in the database. Data models are of various types:   1.  Relational Model: It is a collection of relations (tables). In relational model, each table is stored as a separate file.   2.  Entity—Relationship data model: This model is based on the notion of real-world entities and relationship among them.   3.  Object-Based data model: It defines the ­database as objects, its properties and its ­operations. In this model, objects with the ­similar structures comprise a class. The classes are ­organized into hierarchies. The operations on these classes are performed through methods.   4.  Semi-Structured data model: It is also known as XML model. This model is used to exchange data over the web. It uses hierarchical tree structures. In this model, data can be represented as elements by using tags. 4/9/2015 10:03:30 AM

Lecture Notes