20CS07 Data Base Management Systems
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING (AUTONOMOUS) Accredited by NAAC & NBA (Under Tier - I) ISO 9001:2015 Certified Institution Approved by AICTE, New Delhi. and Affiliated to JNTUK, Kakinada L.B. REDDY NAGAR, MYLAVARAM, KRISHNA DIST., A.P.-521 230. DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND DATA SCIENCE |
UNIT I
Module 1: INTRODUCTION
Program & Semester: B.Tech & III SEM
Academic Year: 2022 - 23
An overview of Database Management System
A database-management system (DBMS) is a collection of interrelated data and a set of programs to access those data. The collection of data, usually referred to as the database. (or)
The DBMS is a general-purpose software system that facilitates the processes of defining, constructing, manipulating, and sharing databases among various users and applications.
Database has the following implicit properties:
Meaning.
Database System Applications
�Evolution of Database Management Systems�
Based on the data model
Based on the users
Classification of Database Management System
Database Systems versus File Systems
Based on the sites over which network is distributed
Drawbacks of using file systems
Data redundancy and inconsistency
Multiple file formats, duplication of information in different files
Difficulty in accessing data
Need to write a new program to carry out each new task
Data isolation
multiple files and formats
Integrity problems
Atomicity of updates
updates carried out
E.g. transfer of funds from one account to another should either
complete or not happen at all
Concurrent access by multiple users
E.g. two people reading a balance and updating it at the same time
Security problems
Advantages of DBMS:
Data Models
A database model shows the logical structure of a database, including the relationships and constraints that determine how data can be stored and accessed. Individual database models are designed based on the rules and concepts of whichever broader data model the designers adopt. Most data models can be represented by an accompanying database diagram.
We have different data models
The Entity-Relationship(ER) Model
The entity-relationship (E-R) data model is based on a perception of a real world that consists of a collection of basic objects, called entities, and of relationships among these objects.
• Rectangles: which represent entity sets
• Ellipses: which represent attributes
• Diamonds: which represent relationships among entity sets
• Lines: which link attributes to entity sets and entity sets to relationships
Relational Model
Object oriented model
This model defines a database as a collection of objects, or reusable software elements, with associated features and methods. There are several kinds of object-oriented databases:
A multimedia database incorporates media, such as images, that could not be stored in a relational database.
A hypertext database allows any object to link to any other object. It’s useful for organizing lots of disparate data, but it’s not ideal for numerical analysis.
The object-oriented database model is the best known post-relational database model, since it incorporates tables, but isn’t limited to tables.
Object-relational model
This hybrid database model combines the simplicity of the relational model with some of the advanced functionality of the object-oriented database model. In essence, it allows designers to incorporate objects into the familiar table structure.
Network data Model
A network model is nothing but a generalization of the hierarchical data model as this data model allows many to many relationships therefore in this model a record can also have more than one parent.
The network model can be represented as a graph and hence it replaces the hierarchical tree with a graph in which object types are the nodes and relationships are the edges.
Hierarchical data model
The hierarchical data model is one of the oldest data models, developed in the 1950s by IBM. In this data model, the data is organized in a hierarchical tree-like structure. This data model can be easily visualized because each record has one parent and many children (possibly 0) as shown in the image given below.
Three Schema Architecture
A database system is a collection of interrelated files and a set of programs that allow users to access and modify these files. It provides users with an abstract view of the data. That is, the system hides certain details of how the data are stored and maintained.
Developers hide the complexity from users through several levels of abstraction, to simplify users’ interactions with the system.
The data in the DBMS is described at three levels of abstraction
Physical Level
The lowest level of abstraction describes how the data are stored. The physical level has an internal schema which describes the physical storage structure of the database.
Logical Level
The conceptual schema hides the details of physical storage structures and concentrates on describing entities, data types, relationships, user operations, and constraints.
View level
Database Schema and Instances
The description of a database is called the database schema, which is specified during database design and is not expected to change frequently.
Data Independence
Logical data independence is the capacity to change the conceptual schema without having to change external schemas or application programs.
Physical data independence is the capacity to change the internal schema without having to change the conceptual schema. Hence, the external schemas need not be changed as well.
Database languages are used for read, update and store data in a database. There are several such languages that can be used for this purpose; one of them is SQL (Structured Query Language).
A database system provides a data definition language to specify the database schema and a to express database queries and updates. data manipulation language.
There are three categories of DBMS Languages. Those are
1) Data Definition Language (DDL)
2) Data Manipulation Language (DML)
3) Data Control Language (DCL)
Database Languages
Data Definition Language (DDL)
DDL or Data Definition Language actually consists of the SQL commands that can be used to define the database schema. It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in the database.
CREATE – is used to create the database or its objects (like table, index, function, views, store procedure and triggers).
DROP – is used to delete objects from the database.
ALTER-is used to alter the structure of the database.
COMMENT –is used to add comments to the data dictionary.
RENAME –is used to rename an object existing in the database
TRUNCATE–is used to remove all records from a table, including all spaces allocated for the records are removed.
Data Manipulation Language (DML)
The SQL commands that deals with the manipulation of data present in the database belong to DML or Data Manipulation Language and this includes most of the SQL statements.
Examples of DML:
INSERT – is used to insert data into a table.
UPDATE – is used to update existing data within a table.
DELETE– is used to delete records from a database table.
Data Control Language (DCL)
DCL includes commands such as GRANT and REVOKE which mainly deal with the rights, permissions and other controls of the database system.
Examples of DCL commands:
GRANT-gives user’s access privileges to the database.
REVOKE-withdraw user’s access privileges given by using the GRANT command.
Database System Structure
A database system is partitioned into modules that deal with each of the responsibilities of the overall system. The functional components of a database system can be broadly divided into the storage manager and the query processor components.
Storage manager
Authorization and integrity manager: which tests for the satisfaction of integrity constraints and checks the authority of users to access data.
Transaction manager: which ensures that the database remains in a consistent (correct) state despite system failures, and that concurrent transaction executions proceed without conflicting.
File manager: which manages the allocation of space on disk storage and the data structures used to represent information stored on disk.
Buffer manager: which is responsible for fetching data from disk storage into main memory, and deciding what data to cache in main memory. The buffer manager is a critical part of the database system, since it enables the database to handle data sizes that are much larger than the size of main memory.
The storage manager implements several data structures as part of the physical system implementation:
• Data files: which store the database itself.
• Data dictionary: which stores metadata about the structure of the database, in particular the schema of the database.
• Indices: which provide fast access to data items that hold particular values.
The Query Processor
The query processor components include
• DML compiler, which translates DML statements in a query language into an evaluation plan consisting of low-level instructions that the query evaluation engine understands.
A query can usually be translated into any of a number of alternative evaluation plans that all give the same result. The DML compiler also performs query optimization, that is, it picks the lowest cost evaluation plan from among the alternatives.
• DDL interpreter, which interprets DDL statements and records the definitions in the data dictionary.
• Query evaluation engine, which executes low-level instructions generated by the DML compiler