You are on page 1of 9

Real Time System Real time systems are used in real time applications where rigid time requirements

required for the completion of the operation. In real time systems apart from the correctness of the computation of the results, the response time is also a critical factor. The system should react correctly and timely according to the situation. The real time systems are classified into hard real time system and soft real time system.

DBMS hides the internal complexities from the application programs that use the database.

File Processing System A File can store records and we can extract these records using different applications programs.

The simplest data retrieval task from file require extensive programming. Also this is a time consuming and a high skill activity.

Hard Real Time System Soft Real Time System

To access the data in file the programmer must aware of the physical structure of the file. Security features such as effective password protection, locking parts of file etc are very difficult to program.

A hard real time system guarantees that critical task must complete on time, that is it ensures that tasks are performed with in the deadline deterministically. In Soft real time, computing is less restrictive as compared to hard real time system. It requires that critical processes must get priority over less priority ones. Database Management System

The File system exhibits structural dependence. That is a change in file structure such as addition or deletion of a field require the modification of all programs using that file.

A Database Management System is a collection of interrelated data and a set of programs to

Data dependence: A change in file data characteristic such as change in a field data type from integer to decimal, requires changes in all programs that access the file.

access to those data. The collection of Data is referred as Database. The primary goal of a Database Management System(DBMS) is to provide a way to store and retrieve database information that is both convenient and efficient. Data are very important in any information system. So we must have a very good way of managing such data. The DBMS contain a query language that makes it possible to give quick and exact answers to adhoc queries. The DBMS helps to create an environment in which users have better access to data. Such access makes it possible for end users to respond more quickly and efficiently to changes in their environment. DBMS helps to give an integrated view of the organizations operations. Thus it becomes much easier to see how operations in one unit affect others. Data inconsistency is considerably reduced in a properly designed database. Database systems are designed to manage large volume of information. Data management involves both defining the structure for storage of information and providing mechanism for the manipulation of data. Also the database system must ensure the safety of the information stored. The DBMS makes it possible to share the data in the database among multiple applications and users. DBMS serves as the intermediary between the database and the user by translating user request to the database and getting back exact responses to the user. Also the

A typical file processing system is supported by conventional operating systems. The system stores permanent record in various files. It uses various application programs to extract records from, and add records to the appropriate files. Before using DBMS to store and retrieve data, organizations stored information in file processing systems. But as the number of files in the system expands, system administration becomes difficult too. Each file must have its own file management system, composed of programs that allow user to create the file structure, add data to the file, delete data from the file, modify the data in the file, list the file contents etc. Even a simple file processing system containing 25 files requires 5 * 25 =125 file management programs. Each department in the organization owns its data by creating its own files. So the number of files can multiply rapidly. Security features such as effective password protection, locking out part of files or part of system itself and other data confidentiality measures are difficult to program and are usually omitted. The file systems structure and lack of security makes

it difficult to pool data. The same basic data is stored in different locations. But it is very unlikely that that data stored in different locations will always be updated consistently, hence maintaining different versions of same data. The file processing system is simply not suitable for modern data management and information requirement

Atomicity Problem It is difficult to ensure atomicity in file processing system.For example transferring $100 from Account A to account B.If a failure occurs during execution there could be situation like Php100 is deducted from Account A and not credited in Account B. Concurrent Access anomalies If multiple users are updating the same data simultaneously it will result in inconsistent data state. In file processing system it is very difficult to handle this using program code. This results in concurrent access anomalies. Security Problems Enforcing Security Constraints in file processing system is very difficult as the application programs are added to the system in an ad-hoc manner.

Disadvantages of File Processing System The conventional file processing system suffers from the following shortcomings:

Data Redundancy Data Inconsistency Difficulty in Accessing Data Data Isolation Integrity Problems Atomicity Problem Concurrent Access anomalies Security Problems

Database System Environment The term database system refers to an organization of components that define and regulate the collection, storage, management, and use of data with in a database environment. In a high level view the database system is composed of the following five major parts.

Data Redundancy Data Redundancy means same information is duplicated in several files. This makes data redundancy. Data Inconsistency Data Inconsistency means different copies of the same data are not matching. That means different versions of same basic data are existing. This occurs as the result of update operations that are not updating the same data stored at different places. Example: Address Information of a customer is recorded differently in different files. Difficulty in Accessing Data It is not easy to retrieve information using a conventional file processing system. Convenient and efficient information retrieval is almost impossible using conventional file processing system. Data Isolation Data are scattered in various files, and the files may be in different format, writing new application program to retrieve data is difficult. Integrity Problems The data values may need to satisfy some integrity constraints. For example the balance field Value must be grater than 5000. We have to handle this through program code in file processing systems. But in database we can declare the integrity constraints along with definition itself.

Hardware Software People Procedures Data

Hardware Components in a Database System Environment Hardware identifies all the system's physical devices. It includes computers, computer peripherals, network components etc. Software Components in a Database System Environment Software refers to the collection of programs used with in the database system. It includes the operating system, DBMS Software, and application programs and utilities. Operating System DBMS Software Application Programs and Utilities The operating System manages all the hardware components and makes it possible for all other

software to run on the computers. UNIX, LINUX, Microsoft Windows etc are the popular operating systems used in database environment. DBMS software manages the database with in the database system. Oracle Corporation's ORACLE, IBM's DB2, Sun's MYSQL, Microsoft's MS Access and SQL Server etc are the popular DBMS (RDBMS) software used in the database environment. Application programs and utilities software are used to access and manipulate the data in the database and to manage the operating environment of the database. People in a Database System Environment People component includes all users associated with the database system. On the basis of primary job function we can identify five types of users in a database system: System Administrators, Database Administrators, Data Modelers,System Analysts and Programmers and End Users. System Administrators Data Modelers Database Administrators System Analysts and Programmers End Users System Administrators oversees the database system's general operations. Data Modelers (Architect) prepare the conceptualdesign from the requirement.ER model represent the conceptual design of an OLTP application. Database Administrator (DBA) physically implements the database according to the logical design. The DBA performs the physical implementation and maintenance of a database system. System Analysts and programmers design and implements the application programs. They create the input screens, reports, and procedures through which end users access and manipulate the database. End Users are the people who use the application. For example incase of a banking system, the employees, customer using ATM or online banking facility are end users.

Database Management System Functions The Database Management System performs the following functions.

Data Dictionary Management Data Storage Management Data Transformation and Presentation Security Management Multi User Access Control Backup and Recovery Management Data Integrity Management Database Access Languages and Application Interface Database Communication Interface

Data Dictionary Management The data dictionary stores the definitions of data elements and their relationships.This information is termed as metadata.The metadata includes definition of data, data types, relationship between data, integrity constraints etc. Any changes made in a database structure are automatically reflected in the data dictionary. In short the DBMS provides data abstraction and it removes structural and data dependency from the system. Data Storage Management The DBMS creates the complex structures required for data storage. The users are freed from defining,programming and implementing the complex physical data characteristics. Data Transformation and Presentation DBMS supports data independence.Hence the DBMS translate logical request into commands that physically locate and retrieve the requested data. The DBMS formats the physically retrieved data according to the logical data format specifications.

Procedures in a Database Environment Procedures are the instructions and business rules that govern the design and use of the database system. Data in the Database Data are the very important basic entity in a database. It is the collection of facts stored in the database.

Security Management The DBMS creates a security system that enforces user security and data privacy within the database. Security rules determine the access rights of the users. Read/write access is given to the user is specified using access rights. Multiuser Access Control The DBMS ensures that multiple users can access the database concurrently without compromising the integrity of the database. Hence the database ensures data integrity and data consistency. Backup and Recovery Management The DBMS provide backup and data recovery procedures to ensure data safety and integrity. DBMS system provide special utilities which allow the DBA to perform routine and special backup and restore

procedures. Recovery Management deals with the recovery of the database after a failure. Data Integrity Management The DBMS promotes and enforce integrity rules to eliminate data integrity problems, thus minimizing the data redundancy and maximizing data consistency. Database Access Languages and Application Interface The DBMS provides data access via query language. A query language is a non-procedural language, that is the user only need to specify what must be done without specifying how it is to be done. The DBMS's query language contains two components: a data definition language(DDL) and a data manipulation language(DML). The DBMS also provide data access to programmers via programming languages. Database Communication Interfaces Different users may access the database through a network environment. So the DBMS provide communication functions to access the database through computer network environment.

Procedural DML: In procedural Data manipulation language user has to specify what data are needed and how to get it. Declarative DML (Non Procedural DML): In declarative Data manipulation language user has to specify what data are needed without specifying how to get it. Example : SQL (Structured Query Languages)

Data Definition Language 1. 2. Used to specify a database scheme as a set of definitions expressed in a DDL DDL statements are compiled, resulting in a set of tables stored in a special file called a data dictionary or data directory. The data directory contains metadata (data about data) The storage structure and access methods used by the database system are specified by a set of definitions in a special type of DDL called a data storage and definition language basic idea: hide implementation details of the database schemes from the users

3. 4.

5.

Database Languages Data Definition Language (DDL) Data Manipulation Language (DML)

Data Manipulation Language (DML) 1. Data Manipulation is: o retrieval of information from the database o insertion of new information into the database o deletion of information in the database o modification of information in the database The goal is to provide efficient human interaction with the system. 2. There are two types of DML: o procedural: the user specifies what data is needed and how to get it o nonprocedural: the user only specifies what data is needed Easier for user May not generate code as efficient as that produced by procedural languages

Data Definition Language (DDL) We specify the database schema (Data fields , Data Types , Constraints) by a set of definition expressed by a language called DDL. Example: CREATE TABLE student(SNAME CHAR(10), ROLLNO CHAR(10)). This DDL statement creates a table student with fields SNAME and ROLLNO.This information (meta data) is stored in the data dictionary. Data Manipulation Language (DML) Data Manipulation Language (DML) is used for data manipulation. Data manipulation is Retrieval of Information Stored in Database Insertion of Information to the database Deletion of information from the database Updating of information stored in the databas

A query language is a portion of a DML involving information retrieval only. The terms DML and query language are often used synonymously.

Database Manager 1. The database manager is a program module which provides the interface between the low-level data stored in the database and the application programs and queries submitted to the system.

Types of Data Manipulation Language (DML) Procedural DML Declarative DML (Non Procedural DML)

2.

3.

4.

Databases typically require lots of storage space (gigabytes). This must be stored on disks. Data is moved between disk and main memory (MM) as needed. The goal of the database system is to simplify and facilitate access to data. Performance is important. Views provide simplification. So the database manager module is responsible for o Interaction with the file manager: Storing raw data on disk using the file system usually provided by a conventional operating system. The database manager must translate DML statements into low-level file system commands (for storing, retrieving and updating data in the database). o Integrity enforcement: Checking that updates in the database do not violate consistency constraints (e.g. no bank account balance below $25) o Security enforcement: Ensuring that users only have access to information they are permitted to see o Backup and recovery: Detecting failures due to power failure, disk crash, software errors, etc., and restoring the database to its state before the failure o Concurrency control: Preserving data consistency when there are concurrent users.

and physical organization. Granting authorization for data access The DBA provides different access rights to the users according to their level. Ordinary users might have highly restricted access to data, while you go up in the hierarchy to the administrator ,you will get more access rights. Routine Maintenance Some of the routine maintenance activities of a DBA is given below. Taking backup of database periodically Ensuring enough disk space is available all the time. Monitoring jobs running on the database. Ensure that performance is not degraded by some expensive task submitted by some users. Performance Tuning

Database Users 1. The database users fall into several categories: o Application programmers are computer professionals interacting with the system through DML calls embedded in a program written in a host language (e.g. C, PL/1, Pascal). These programs are called application programs. The DML precompiler converts DML calls (prefaced by a special character like $, #, etc.) to normal procedure calls in a host language. The host language compiler then generates the object code. Some special types of programming languages combine Pascal-like control structures with control structures for the manipulation of a database. These are sometimes called fourthgeneration languages. They often include features to help generate forms and display data. o Sophisticated users interact with the system without writing programs. They form requests by writing queries in a database query language These are submitted to a query processor that breaks a DML statement down into instructions for the database manager module. o Specialized users are sophisticated users writing special database application programs. These may be CADD systems, knowledge-based and expert systems, complex data systems (audio/video), etc. o Naive users are unsophisticated users who interact with the system by using permanent

Some small database systems may miss some of these features, resulting in simpler database managers. (For example, no concurrency is required on a PC running MS-DOS.) These features are necessary on larger system Functions of a Database Administrator One of the main reasons for using DBMS is to have a central control of both data and the programs accessing those data. A person who has such control over the system is called a Database Administrator(DBA). The following are the functions of a Database administrator

Schema Definition Schema and physical organization modification. Granting authorization for data access. Routine Maintenance

Schema Definition The Database Administrator creates the database schema by executing DDL statements. Schema includes the logical structure of database table(Relation) like data types of attributes,length of attributes,integrity constraints etc. Storage structure and access method definition Database tables or indexes are stored in the following ways: Flat files,Heaps,B+ Tree etc.. Schema and physical organization modification The DBA carries out changes to the existing schema

application programs (e.g. automated teller machine

Overall System Structure 3. 1. Database systems are partitioned into modules for different functions. Some functions (e.g. file systems) may be provided by the operating system. Components include: o File manager manages allocation of disk space and data structures used to represent information on disk. o Database manager: The interface between lowlevel data and application programs and queries. o Query processor translates statements in a query language into low-level instructions the database manager understands. (May also attempt to find an equivalent but more efficient form.) o DML precompiler converts DML statements embedded in an application program to normal procedure calls in a host language. The precompiler interacts with the query processor. o DDL compiler converts DDL statements to a set of tables containing metadata stored in a data dictionary. In addition, several data structures are required for physical system implementation:

2.

o o

Data files: store the database itself. Data dictionary: stores information about the structure of the database. It is used heavily. Great emphasis should be placed on developing a good design and efficient implementation of the dictionary.

Indices: provide fast access to data items holding particular values.

Purpose of Database Systems 1. To see why database management systems are necessary, let's look at a typical ``file-processing system'' supported by a conventional operating system. The application is a savings bank: Savings account and customer records are kept in permanent system files. o Application programs are written to manipulate files to perform the following tasks: Debit or credit an account. Add a new account. Find an account balance. Generate monthly statements. Development of the system proceeds as follows: o New application programs must be written as the need arises.

New permanent files are created as required. but over a long period of time files may be in different formats, and o Application programs may be in different languages. So we can see there are problems with the straight fileprocessing approach: o Data redundancy and inconsistency Same information may be duplicated in several places. All copies may not be updated properly. o Difficulty in accessing data May have to write a new application program to satisfy an unusual request. E.g. find all customers with the same postal code. Could generate this data manually, but a long job... o Data isolation Data in different files. Data in different formats. Difficult to write new application programs. o 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. o 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. Difficult to enforce this with application programs. o Integrity problems Data may be required to satisfy constraints. E.g. no account balance below $25.00. Again, difficult to enforce or to change constraints with the file-processing approach.

o o

These problems and others led to the development of database management systems.

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 created and maintained Complexity should be hidden from database users. 2. There are several levels of abstraction: 1. Physical Level: How the data are stored. E.g. index, B-tree, hashing. Lowest level of abstraction. Complex low-level structures described in detail. 2. Conceptual Level: Next highest level of abstraction. Describes what data are stored. Describes the relationships among data. Database administrator level. 3. View Level: Highest level. Describes part of the database for a particular group of users. Can be many different views of a database. The E-R Model 1. The entity-relationship model is based on a perception of the world as consisting of a collection of basic objects (entities) and relationships among these objects. o An entity is a distinguishable object that exists. o Each entity has associated with it a set of attributes describing it. o E.g. number and balance for an account entity. o A relationship is an association among several entities. o e.g. A cust_acct relationship associates a customer with each account he or she has. o The set of all entities or relationships of the same type is called the entity set or relationship set. o Another essential element of the E-R diagram is the mapping cardinalities, which express the number of entities to which another entity can be associated via a relationship set. We'll see later how well this model works to describe real world situations. 2. The overall logical structure of a database can be expressed graphically by an E-R diagram: o rectangles: represent entity sets. o ellipses: represent attributes. o diamonds: represent relationships among entity sets. o lines: link attributes to entity sets and entity sets to relationships

E.g. tellers in a bank get a view of customer accounts, but not of payroll data

DATA MODELS 1. Data models are a collection of conceptual tools for describing data, data relationships, data semantics and data constraints. There are three different groups: 1. Object-based Logical Models. 2. Record-based Logical Models. 3. Physical Data Models The Object-Oriented Model 1. The object-oriented model is based on a collection of objects, like the E-R model. o An object contains values stored in instance variables within the object. o Unlike the record-oriented models, these values are themselves objects. o Thus objects contain objects to an arbitrarily deep level of nesting. o An object also contains bodies of code that operate on the the object. o These bodies of code are called methods. o Objects that contain the same types of values and the same methods are grouped into classes. o A class may be viewed as a type definition for objects. o Analogy: the programming language concept of an abstract data type. o The only way in which one object can access the data of another object is by invoking the method of that other object. o This is called sending a message to the object. o Internal parts of the object, the instance variables and method code, are not visible externally.

Object-based Logical Models 1. Object-based logical models: o Describe data at the conceptual and view levels. o Provide fairly flexible structuring capabilities. o Allow one to specify data constraints explicitly. o Over 30 such models, including Entity-relationship model. Object-oriented model. Binary model. Semantic data model. Infological model. Functional data model. At this point, we'll take a closer look at the entityrelationship (E-R) and object-oriented models

2.

2.

o Result is two levels of data abstraction. For example, consider an object representing a bank account. o The object contains instance variables number and balance. o The object contains a method pay-interest which adds interest to the balance. o Under most data models, changing the interest rate entails changing code in application programs. o In the object-oriented model, this only entails a change within the pay-interest method. Unlike entities in the E-R model, each object has its own unique identity, independent of the values it contains: o Two objects containing the same values are distinct. o Distinction is created and maintained in physical level by assigning distinct object identifiers.

The Network Model

Data are represented by collections of records. Relationships among data are represented by links. Organization is that of an arbitrary graph.

The Hierarchical Model

Similar to the network model. Organization of the records is as a collection of trees, rather than arbitrary graphs

Record-based Logical Models Physical Data Models 1. Record-based logical models: o Also describe data at the conceptual and view levels. o Unlike object-oriented models, are used to Specify overall logical structure of the database, and Provide a higher-level description of the implementation. o Named so because the database is structured in fixed-format records of several types. o Each record type defines a fixed number of fields, or attributes. o Each field is usually of a fixed length (this simplifies the implementation). o Record-based models do not include a mechanism for direct representation of code in the database. o Separate languages associated with the model are used to express database queries and updates. o The three most widely-accepted models are the relational, network, and hierarchical. o This course will concentrate on the relational model. o The network and hierarchical models are covered in appendices in the text 1. 2. Are used to describe data at the lowest level. Very few models, e.g. o Unifying model. o Frame memory. We will not cover physical models.

3.

Instances and Schemes 1. 2. 3. 4. Databases change over time. The information in a database at a particular point in time is called an instance of the database. The overall design of the database is called the database scheme. Analogy with programming languages: o Data type definition - scheme o Value of a variable - instance There are several schemes, corresponding to levels of abstraction: o Physical scheme o Conceptual scheme o Subscheme (can be many

5.

The Relational Model

Data Independence A major purpose of a database system is to provide the users with an abstract view of data. To hide the complexity from users database apply different levels of abstraction. The following are different levels of abstraction. Physical Level Logical Level View Level

Data and relationships are represented by a collection of tables. Each table has a number of columns with unique names, e.g. customer, account.

Figure 1.3 shows a sample relational database

Physical Level Physical Level is the lowest level of abstraction and it defines the storage structure.The physical level describes complex low level data structures in detail.The database system hides many of the lowest level storage details from the database programmers. Database Administrators may be aware of certain details of physical organization of data. Logical Level This is the next higher level of abstraction which describe what data are stored in database, relation between data, types of data etc . Database programmers, DBA etc knows the logical structure of data View Level This the highest level of abstraction. It provides different view to different users. At the view level users see a set of application programs that hide details of data types. The details such as data type etc are not available at this level. Only view or Access is given to a part of data according to the users access right Physical Data Independence The changes in Physical Level does not affect or visible at the logical level. This is called physical data independence. Logical Data Independence The changes in the logical level do not affect the view level. This is called logical data independence.

Relationships

Entitie An entity is a thing or object in the real world that is distinguishable from all other objects. For example 'Person' in an organization is an entity. An entity has a set of properties. At the E-R modeling level an entity actually refers to an entity set. In other words, entity in ER model corresponds to a table.

Entity Entity Set

An entity may be concrete such as a person, book etc or may be abstract such as account,loan etc. The ER model refers to a specific table row as an entity instance or entity occurrence. Collection of similar entities (Entity Set) often corresponds to a table. Each entity set has a key.All entities in an entity set have the same set of attributes. Thus entity set is a set of entities of the same type that share the same properties or attributes. An entity is represented by a rectangle containing the entity name, which is a noun usually written in capital letters. Attributes An entity is represented by a set of attributes. It corresponds to a field in a table.For each attribute there is a set of permitted values called the domain or value set of the attribute. Attributes are represented by ovals and are connected to the entity with a line. Each oval contains the name of the attribute it represents. Relationships A relationship describes an association among entities. In ER model the association among entities is described as one-to-one, one-to-many, many-tomany. Relationships are represented by a diamond connected to the related entities. The relationship name (an active or passive verb), is written inside the diamond.

Entity Relationship Model (E-R Model) The process of database design is an iterative process. The ER Model is used at the conceptual design stage of the database design.ER diagram is used to represent this conceptual design. The requirement analysis is modeled in this conceptual design. The ER model is very expressive so that people can easily understand the requirement. The data modeler prepares the ER diagram and is verified with the functional domain experts to ensure that all the requirements are properly incorporated in the conceptual design. The process is repeated until the end users and designers agree that the E-R diagram is a fair representation of the requirement. We can easily map an ER diagram to a relational schema. The basic constructs of ER Model are Entity, Attributes and Relationships. An Entity is an object that exist in the real world and is distinguishable from other entities.

Conceptual Design ER Diagram Entities Attributes

You might also like