Database Management Systems
Database Management Systems
Unit-I
Database:
Database-System Applications:
• Internet Interactions: For online shopping, you select an item from the
database and then send your credit card number to buy the product.
• Computer Horoscope: We enter our name, date of birth, and our likes
and dislikes in a form presented to us. All these details are compared
against a database to search for a perfect match and our future is
predicted.
The alternative to using a DBMS is to store the data in files, but file-
processing system has a number of disadvantages:
• Data Isolation: Because data are scattered in various files, and files
may be in different formats, an application developer needs to write
software to convert the files to some common format to facilitate
processing. Again this can be time-consuming and expensive.
Advantages of DBMS:
View of Data:
Data Abstraction:
The designers use complex data structures to represent data in the database
for the sake of efficiency. Since many database users are not computer
trained, developers hide the complexity from users through several levels of
abstraction:
View View Level View
View 1
2 n
Logical
Level
Physical
Level
Physical Level:
• The lowest level of abstraction describes how the data are actually
stored.
Logical Level:
• The next higher level of abstraction describes what data are stored in
the database, and what relationships exist among those data.
• The user of the logical level need not aware of the complexity at
physical level.
View Level:
• Many users of the database system do not need all the information
stored in a large database, instead, they need only a part of the
database.
• The view level of abstraction exists to simplify user interaction with the
system.
• The system may provide many views for the same database.
For simple explanation, let us take the example of declaring the variable in C
language:
int a=2;
Example:
• Relational Model:
Each table has multiple columns, and each column has a unique name.
The relational model is the most widely used data model and majority
of the today’s database systems are based on the relational model.
In practice, the DDL and DML are not two separate languages, instead, they
are parts of a single database language, such as SQL.
The language used to specify the database schema or to define the data in
the database is called as DDL.
The DDL statements are compiled by DDL compiler and output generated
are the metadata and will be stored in special file called data dictionary.
There is another type of DDL, called, Data Storage and Definition Language,
used to specify the storage structure and access methods. These statements
define the implementation details of the database schemas, which are
hidden from the users.
The language used to manipulate the data in the database is called DML.
Declarative DMLs are usually easier to learn and use than procedural DMLs.
But procedural DMLs are more efficient than declarative DMLs, because they
specify the procedure to retrieve the data.
Here is an example of SQL query to find the names of all customers who
reside in Hyderabad:
SELECT customer_name
FROM customer
WHERE customer_city=’hyderabad’;
People who work with a database can be categorized as database users and
database administrators.
Database Users:
• Naïve Users:
Naïve users are un-sophisticated users who interact with the system by
invoking the application programs that have been written previously.
For example, a bank teller who needs to transfer Rs.500/- from account
A to account B invokes a program called transfer. This program asks
the teller for the amount of money to be transferred, the account from
which the money is to be transferred, and the account to which the
money is to be transferred.
• Application Programmers:
• Sophisticated Users:
Analysts who submit queries to explore data in the database fall in this
category.
• Specialized Users:
Database Administrators:
A person who has central control over the database system is called a
database administrator (DBA). The functions of the DBA are:
• Schema definition:
The DBA creates the original database schema by executing set of DDL
statements.
• Routine Maintenance:
2. The DBA ensures that there is enough free disk space is available
for normal operations.
3. The DBA monitors all the jobs running on the database and
ensures that performance is not degraded.
Database Architecture:
1. Query Processor
2. Storage Manager
• DDL Interpreter:
• DML Compiler:
Query Processor
Query
Evaluation
Engine
Buffer File Authorization Transactio
Manager Manager & Integrity n Manager
Manager Storage Manager
Indices
Data
Disk Storage
Data Files Dictionary
This tests for the satisfaction of integrity constraints and checks the
authority of users to access data.
• Transaction Manager:
• File Manager:
This manages the allocation of space on disk storage and the data
structures used to represent information stored on disk.
• Buffer Manager:
This is responsible for fetching the data from disk storage to main
memory, and decides what data to cache in main memory.
• Data Files:
• Data Dictionary:
• Indices: