Unit-1
Introduction
COMPILED BY:
GHANASHYAM BK
Database Management System
a collection of interrelated data and a set of programs to access those data.
The collection of data, usually referred to as the database, contains information relevant to an
enterprise.
The primary goal of a DBMS is to provide a way to store and retrieve database information that
is both convenient and efficient.
Database systems are designed to manage large bodies of information.
Management of data involves both defining structures for storage of information and providing
mechanisms for the manipulation of information
Applications of Database
Management System
Enterprise Information
Sales: For customer, product, and purchase information.
Accounting: For payments, receipts, account balances, assets, and other accounting
information.
Human resources: For information about employees, salaries, payroll taxes, and benefits, and
for generation of paychecks.
Manufacturing:
For management of the supply chain and for tracking production of items in factories,
inventories of items in warehouses and stores, and orders for items.
Universities:
For student information, course registrations, and grades (in addition to standard enterprise
information such as human resources and accounting).
Applications of Database
Management System
Banking and Finance
Banking: For customer information, accounts, loans, and banking transactions.
Credit card transactions: For purchases on credit cards and generation of monthly statements.
Finance: For storing information about holdings, sales, and purchases of financial instruments
such as stocks and bonds; also for storing real-time market data to enable online trading by
customers and automated trading by the firm.
Airlines:
For reservations and schedule information. Airlines were among the first to use databases in a
geographically distributed manner.
Telecommunication:
For keeping records of calls, texts, and data usage, generating monthly bills, maintaining
balances on prepaid calling cards, and storing information about the communication networks.
Applications of Database
Management System
Web-based services
Social-media: For keeping records of users, connections between users (such as
friend/follows information), posts made by users, rating/like information about posts, etc.
Online retailers: For keeping records of sales data and orders as for any retailer, but also for
tracking a user’s product views, search terms, etc., for the purpose of identifying the best
items to recommend to that user.
Online advertisements: For keeping records of click history to enable targeted
advertisements, product suggestions, news articles, etc. People access such databases every
time they do a web search, make an online purchase, or access a social-networking site
Document databases:
For maintaining collections of new articles, patents, published research papers, etc.
Navigation systems:
For maintaining the locations of varies places of interest along with the exact routes of roads, train
systems, buses, etc.
File Processing system
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.
Keeping organizational information in a file-processing system has a number of major
disadvantages:
Data redundancy: same information may be duplicated in several places (files).
Data inconsistency: the various copies of the same data may no longer agree.
Difficulty in accessing data: conventional file-processing environments do not allow needed
data to be retrieved in a convenient and efficient manner.
Data isolation: Because data are scattered in various files, and files may be in different formats,
writing new application programs to retrieve the appropriate data is difficult.
File Processing system
Disadvantages(Contd…)
Atomicity problems: —it must happen in its entirety or not at all. It is difficult to ensure
atomicity in a conventional file-processing system.
Concurrent-access anomalies: data may be accessed by many different application programs
that have not been coordinated previously
Security problems: Not every user of the database system should be able to access all the data.
Simplified database system
environment
Database Systems vs File
Systems
File System DBMS
Used to manage and organise the files stored in the A software to store and retrieve the user’s data
hard disk of the computer
Redundant data is present No presence of redundant data
Query processing is not so efficient Query processing is efficient
Less complex, does not support complicated More complexity in managing the data, easier to
transactions implement complicated transactions
Less security Supports more security mechanisms
Less expensive in comparison to DBMS Higher cost than the File system
Does not support crash recovery Crash recovery mechanism is highly supported
Database Systems vs File
Systems
Fig: File System Fig: Database System
View of Data- Data Abstraction
A database system is a collection of interrelated data and a set of programs that allow users to
access and modify these data.
A major purpose of a database system is to provide users with an abstract view of the data.
That is, the system hides certain details of how the data are stored and maintained.
Data Abstraction
For the system to be usable, it must retrieve data efficiently.
The need for efficiency has led database system developers to use complex data structures to represent
data in the database.
Since many database-system users are not computer trained, developers hide the complexity from users
through several levels of data abstraction, to simplify users’ interactions with the system:
View of Data- Data Abstraction
Physical level:
The lowest level of abstraction describes how the data are actually stored.
The physical level describes complex low-level data structures in detail.
Logical level:
The next-higher level of abstraction describes what data are stored in the database, and what
relationships exist among those data.
The logical level thus describes the entire database in terms of a small number of relatively
simple structures.
Although implementation of the simple structures at the logical level may involve complex
physical-level structures, the user of the logical level does not need to be aware of this
complexity.
This is referred to as physical data independence.
Database administrators, who must decide what information to keep in the database, use the
logical level of abstraction.
View of Data- Data Abstraction
View level:
The highest level of abstraction describes only part of the entire database.
Even though the logical level uses simpler structures, complexity remains because of the
variety of information stored in a large database.
Many users of the database system do not need all this information; instead, they need to
access only a part of the database.
The view level of abstraction exists to simplify their interaction with the system.
The system may provide many views for the same database.
View of Data- Data Abstraction
Instances and Schemas
The collection of information stored in the database at a particular moment is called an
instance of the database.
The overall design of the database is called the database schema.
The concept of database schemas and instances can be understood by analogy to a program
written in a programming language.
A database schema corresponds to the variable declarations (along with associated type
definitions) in a program.
Each variable has a particular value at a given instant. The values of the variables in a program
at a point in time correspond to an instance of a database schema.
Example of Database Schema
Example of Database
Instances/State
Database Languages
A database system provides a data-definition language (DDL) to specify the database schema
and a data-manipulation language (DML) to express database queries and updates.
In practice, the data-definition and data-manipulation languages are not two separate
languages; instead they simply form parts of a single database language, such as the SQL
language.
Almost all relational database systems employ the SQL language
Data-definition language (DDL)
We specify a database schema by a set of definitions expressed by a special language called a
data-definition language (DDL).
These statements define the implementation details of the database schemas, which are
usually hidden from the users.
The data values stored in the database must satisfy certain consistency constraints.
For example, suppose the university requires that the account balance of a department must
never be negative.
the following SQL DDL statement defines the department table:
CREATE TABLE department (
Dept_name char (20),
building char (15),
budget numeric (12,2));
Data-manipulation language
(DML)
A data-manipulation language (DML) is a language that enables users to access or manipulate
data as organized by the appropriate data model.
The types of access are:
Retrieval of information stored in the database.
Insertion of new information into the database.
Deletion of information from the database.
Modification of information stored in the database
the following SQL DML statement finds the names of all instructors in the Computer
department:
SELECT instructor.name
FROM instructor
WHERE instructor.dept_name = ‘Computer';
Database Control Language
(DCL)
Database administrators use data control language (DCL) to manage or authorize database
access for other users.
It provides the administrators, to remove and set database permissions to desired users as
needed.
These commands are employed to grant, remove and deny permissions to users for retrieving
and manipulating a database.
For example, they can use the GRANT command to permit certain applications to manipulate
one or more tables.
Fig: Database System Architecture
Database Application
Architecture
Database applications can be partitioned into two or three parts.
Earlier-generation database applications used a two-tier architecture, where the application
resides at the client machine, and invokes database system functionality at the server machine
through query language statements.
In contrast, modern database applications use a three-tier architecture, where the client machine
acts as merely a front end and does not contain any direct database calls;
web browsers and mobile applications are the most commonly used application clients today.
The front end communicates with an application server. The application server, in turn,
communicates with a database system to access data.
The business logic of the application, which says what actions to carry out under what conditions,
is embedded in the application server, instead of being distributed across multiple clients.
Three-tier applications provide better security as well as better performance than two-tier
applications.
Database Application
Architecture
Assignment-1
Define database. Explain its characteristics, application, advantages and disadvantages.
List four applications you have used that most likely employed a database system to store
persistent data. Explain for what purpose it has used database.
List four significant differences between a file-processing system and a DBMS.
Explain the concept of data abstraction and data independence.
Explain the term Instances and Schemas.
Explain the concept of physical data independence and its importance in database systems.
Explain the difference between two-tier and three-tier application architectures. Which is better
suited for web applications? Why?
Explain different types of users involved in database.
Describe at least three tables that might be used to store information in a social networking system
such as Facebook.