0% found this document useful (0 votes)
7 views

UNIT-1(DBMS)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

UNIT-1(DBMS)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Database Management

System (DBMS)
SYLLABUS
S. NO. CONTENT
UNIT - 1 Introduction: An overview of DBMS; Advantages of using DBMS approach; Database systems vs File
Systems, Database system concepts and architecture Data models, schemas, and instances; Three-schema
architecture and data independence; Database languages and interfaces; The database system environment;
Centralized and client-server architectures; Classification of Database Management systems.

UNIT - 2 Entity-Relationship Model: Using High-Level Conceptual Data Models for Database Design; An Example
Database Application; Entity Types, Entity Sets, Attributes and Keys; Relationship types, Relationship Sets,
Roles and Structural Constraints; Weak Entity Types; Refining the ER Design; ER Diagrams, Naming
Conventions and Design Issues; Relationship types of degree higher than two.
UNIT - 3 Relational Model and Relational Algebra: Relational Model Concepts; Relational Model Constraints and
Relational Database Schemas; Update Operations, Transactions and dealing with constraint violations; Unary
Relational Operations: SELECT and PROJECT; Relational Algebra and Calculus Operations from Set Theory;
Binary Relational Operations: JOIN and DIVISION; Additional Relational Operations. Examples of Queries in
Relational Algebra; Relational Database Design Using ER- to-Relational Mapping.
SQL – 1: SQL Data Definition and Data Types; Specifying basic constraints in SQL; Schema change statements
in SQL; Basic queries in SQL; More complex SQL Queries.
Insert, Delete and Update statements in SQL; Specifying constraints as Assertion and Trigger; Views (Virtual
Tables) in SQL; Additional features of SQL; Database programming issues and techniques; Embedded SQL,
Dynamic SQL; Database stored procedures.
Optimization of SQL Queries through Indexes, Concepts of NoSQL.
S. NO. CONTENT
UNIT - 4 Database Design – 1: Informal Design Guidelines for Relation Schemas; Functional Dependencies;
Normal Forms Based on Primary Keys; General Definitions of Second and Third Normal Forms; Boyce-
Codd Normal Form
Properties of Relational Decompositions; Algorithms for Relational Database Schema Design;
Multivalued Dependencies and Fourth Normal Form; Join Dependencies and Fifth Normal Form;
Inclusion Dependencies; Other Dependencies and Normal Forms
UNIT - 5 Transaction Management: The ACID Properties; Transactions and Schedules; Concurrent Execution of
Transactions; Lock- Based Concurrency Control; Performance of locking; Transaction support in SQL;
Introduction to crash recovery; 2PL, Serializability and Recoverability; Lock 9Management; Log Files;
Checkpointing; Recovering from a System Crash; Media Recovery
UNIT -1
What is Data?
Data is a collection of a distinct small unit of information. It can be used in a variety of forms like text, numbers, media,
bytes, etc. it can be stored in pieces of paper or electronic memory, etc.

What is Database?
• A database is an organized collection of data, so that it can be easily accessed and managed. You can organize data into
tables, rows, columns, and index it to make it easier to find relevant information.
• The main purpose of the database is to operate a large amount of information by storing, retrieving, and managing data.
• There are many dynamic websites on the World Wide Web nowadays which are handled through databases. For
example, a model that checks the availability of rooms in a hotel. It is an example of a dynamic website that uses a
database.
• There are many databases available like MySQL, Sybase, Oracle, MongoDB, Informix, PostgreSQL, SQL Server, etc.
• Modern databases are managed by the database management system (DBMS).

Database Management System


Database management system is a software which is used to manage the database. For example: MySQL, Oracle, etc are a
very popular commercial database which is used in different applications.
DBMS provides an interface to perform various operations like database creation, storing data in it, updating data, creating
a table in the database and a lot more.
It provides protection and security to the database. In the case of multiple users, it also maintains data consistency.
DBMS allows users the following tasks:

• Data Definition: It is used for creation, modification, and removal of definition that defines the organization of data in
the database.
• Data Updation: It is used for the insertion, modification, and deletion of the actual data in the database.
• Data Retrieval: It is used to retrieve the data from the database which can be used by applications for various purposes.
• User Administration: It is used for registering and monitoring users, maintain data integrity, enforcing data security,
dealing with concurrency control, monitoring performance and recovering information corrupted by unexpected failure.

Characteristics of DBMS

• It uses a digital repository established on a server to store and manage the information.
• It can provide a clear and logical view of the process that manipulates data.
• DBMS contains automatic backup and recovery procedures.
• It contains ACID properties which maintain data in a healthy state in case of failure.
• It can reduce the complex relationship between data.
• It is used to support manipulation and processing of data.
• It is used to provide security of data.
• It can view the database from different viewpoints according to the requirements of the user.
Advantages of DBMS

Controls
database
redundancy

Multiple
Data
user
sharing
interface

Advantages of
DBMS

Easily
Backup
Maintenance

Reduce
time
Disadvantages of DBMS
Cost of
Hardware
and
Software

Higher
DISADVANTAGES
impact of Size
OF DBMS
failure

Complexity
Advantages of DBMS

• Controls database redundancy: It can control data redundancy because it stores all the data in one single database file
and that recorded data is placed in the database.
• Data sharing: In DBMS, the authorized users of an organization can share the data among multiple users.
• Easily Maintenance: It can be easily maintainable due to the centralized nature of the database system.
• Reduce time: It reduces development time and maintenance need.
• Backup: It provides backup and recovery subsystems which create automatic backup of data from hardware and
software failures and restores the data if required.
• Multiple user interface: It provides different types of user interfaces like graphical user interfaces, application program
interfaces

Disadvantages of DBMS

• Cost of Hardware and Software: It requires a high speed of data processor and large memory size to run DBMS
software.
• Size: It occupies a large space of disks and large memory to run them efficiently.
• Complexity: Database system creates additional complexity and requirements.
• Higher impact of failure: Failure is highly impacted the database because in most of the organization, all the data stored
in a single database and if the database is damaged due to electric failure or database corruption then the data may be lost
forever.
Database systems vs File Systems

Basis DBMS Approach File System Approach


Meaning DBMS is a collection of data. In DBMS, The file system is a collection of data. In this
the user is not required to write the system, the user has to write the procedures
procedures. for managing the database.

Sharing of data Due to the centralized approach, data Data is distributed in many files, and it may
sharing is easy. be of different formats, so it isn't easy to
share data.
Data Abstraction DBMS gives an abstract view of data that The file system provides the detail of the data
hides the details. representation and storage of data.

Security and Protection DBMS provides a good protection It isn't easy to protect a file under the file
mechanism. system.
Recovery Mechanism DBMS provides a crash recovery The file system doesn't have a crash
mechanism, i.e., DBMS protects the user mechanism, i.e., if the system crashes while
from system failure. entering some data, then the content of the
file will be lost.

Manipulation Techniques DBMS contains a wide variety of The file system can't efficiently store and
sophisticated techniques to store and retrieve the data.
retrieve the data.
Basis DBMS Approach File System Approach
Concurrency Problems DBMS takes care of Concurrent access of data using In the File system, concurrent access has many
some form of locking. problems like redirecting the file while deleting some
information or updating some information.

Where to use Database approach used in large systems which File system approach used in large systems which
interrelate many files. interrelate many files.
Cost The database system is expensive to design. The file system approach is cheaper to design.
Data Redundancy and Inconsistency Due to the centralization of the database, the In this, the files and application programs are created
problems of data redundancy and inconsistency are by different programmers so that there exists a lot of
controlled. duplication of data which may lead to inconsistency.

Structure The database structure is complex to design. The file system approach has a simple structure.

Data Independence •In this system, Data Independence exists, and it can In the File system approach, there exists no Data
be of two types.Logical Data Independence Independence.
•Physical Data Independence

Integrity Constraints Integrity Constraints are easy to apply. Integrity Constraints are difficult to implement in file
system.
Data Models •In the database approach, 3 types of data models In the file system approach, there is no concept of
exist:Hierarchal data models data models exists.
•Network data models
•Relational data models
Flexibility Changes are often a necessity to the content of the The flexibility of the system is less as compared to
data stored in any system, and these changes are the DBMS approach.
more easily with a database approach.

Examples Oracle, SQL Server, Sybase etc. Cobol, C++ etc.


DBMS Architecture

• The DBMS design depends upon its architecture. The basic client/server architecture is used to deal with a large
number of PCs, web servers, database servers and other components that are connected with networks.
• The client/server architecture consists of many PCs and a workstation which are connected via the network.
• DBMS architecture depends upon how users are connected to the database to get their request done.

Types of DBMS Architecture


1-Tier Architecture

• In this architecture, the database is directly available to the user. It means the user can directly sit on the DBMS and
uses it.
• Any changes done here will directly be done on the database itself. It doesn't provide a handy tool for end users.
• The 1-Tier architecture is used for development of the local application, where programmers can directly
communicate with the database for the quick response.

2-Tier Architecture

• The 2-Tier architecture is same as basic client-server. In the two-tier architecture,


applications on the client end can directly communicate with the database at
the server side. For this interaction, API's like: ODBC, JDBC are used.
• The user interfaces and application programs are run on the client-side.
• The server side is responsible to provide the functionalities like:
query processing and transaction management.
• To communicate with the DBMS, client-side application establishes a connection
with the server side.
3-Tier Architecture

• The 3-Tier architecture contains another layer between the


client and server. In this architecture, client can't directly
communicate with the server.
• The application on the client-end interacts with an application
server which further communicates with the database system.
• End user has no idea about the existence of the database beyond
the application server. The database also has no idea about any
other user beyond the application.
• The 3-Tier architecture is used in case of large web application.
Three schema Architecture
• The three schema architecture is also called ANSI/SPARC architecture or three-level architecture.
• This framework is used to describe the structure of a specific database system.
• The three schema architecture is also used to separate the user applications and physical database.
• The three schema architecture contains three-levels. It breaks the database down into three different categories.
In the above diagram:
• It shows the DBMS architecture.
• Mapping is used to transform the request and response between various database levels of architecture.
• Mapping is not good for small DBMS because it takes more time.
• In External / Conceptual mapping, it is necessary to transform the request from external level to conceptual schema.
• In Conceptual / Internal mapping, DBMS transform the request from the conceptual to internal level.

A. Internal Level
• The internal level consists of an internal schema which is used to describe the physical structure of the database in which
the data is stored.
• This schema is often called as the physical schema.
• The internal level uses the physical data model. This data model describes the method by which the data should be stored
in a block.
• Complex low-level data structures are described in detail in this schema.

B. Conceptual Level
•The conceptual schema elaborates the database and its data along with the design at a conceptual level.
•The conceptual level is often known as the logical level.
•Conceptual level is used for describing the entire database with its structure.
•This level also describes where the data which is stored in the entire database and the relation about the data as well.
•The data structure’s implementation and other internal details are hidden at the conceptual level.
•Administrators and programmers work on the database at the conceptual level.
C. External Level

• A database contains various schemas at this level, and these schemas may also be called as subschemas. These are
used to describe the possible different views in the database.
• View schema is another name for the external schema.
• External level describes the user and his interaction with the data in the database.
Data Models

Data Model is the modeling of the data description, data semantics, and consistency constraints of the data. It provides the
conceptual tools for describing the design of a database at each level of data abstraction. Therefore, there are following four
data models used for understanding the structure of the database:
1) Relational Data Model: This type of model designs the data in the form of rows and columns within a table. Thus, a
relational model uses tables for representing data and in-between relationships. Tables are also called relations. This
model was initially described by Edgar F. Codd, in 1969. The relational data model is the widely used model which is
primarily used by commercial data processing applications.

2) Entity-Relationship Data Model: An ER model is the logical representation of data as objects and relationships among
them. These objects are known as entities, and relationship is an association among these entities. This model was
designed by Peter Chen and published in 1976 papers. It was widely used in database designing. A set of attributes
describe the entities. For example, student_name, student_id describes the 'student' entity. A set of the same type of
entities is known as an 'Entity set', and the set of the same type of relationships is known as 'relationship set’.

3) Object-based Data Model: An extension of the ER model with notions of functions, encapsulation, and object identity,
as well. This model supports a rich type system that includes structured and collection types. Thus, in 1980s, various
database systems following the object-oriented approach were developed. Here, the objects are nothing but the data
carrying its properties.

4) Semistructured Data Model: This type of data model is different from the other three data models (explained above).
The semistructured data model allows the data specifications at places where the individual data items of the same type
may have different attributes sets. The Extensible Markup Language, also known as XML, is widely used for
representing the semistructured data. Although XML was initially designed for including the markup information to the
text document, it gains importance because of its application in the exchange of data.
Data Independence
• Data independence can be explained using the three-schema architecture.
• Data independence refers characteristic of being able to modify the schema at one level of the database system without
altering the schema at the next higher level.

There are two types of data independence:

1) Logical Data Independence


• Logical data independence refers characteristic of being able to change the conceptual schema without having to change
the external schema.
• Logical data independence is used to separate the external level from the conceptual view.
• If we do any changes in the conceptual view of the data, then the user view of the data would not be affected.
• Logical data independence occurs at the user interface level.

2) Physical Data Independence


• Physical data independence can be defined as the capacity to change the internal schema without having to change the
conceptual schema.
• If we do any changes in the storage size of the database system server, then the Conceptual structure of the database will
not be affected.
• Physical data independence is used to separate conceptual levels from the internal levels.
• Physical data independence occurs at the logical interface level.
Database Languages in DBMS

• A DBMS has appropriate languages and interfaces to express database queries and updates.
• Database languages can be used to read, store and update the data in the database.

Types of Database Languages


1) Data Definition Language (DDL)
• DDL stands for Data Definition Language. It is used to define database structure or pattern. It is used to create schema,
tables, indexes, constraints, etc. in the database.
• It includes some commands like create, alter, drop, truncate etc.

2) Data Manipulation Language (DML)


• DML stands for Data Manipulation Language. It is used for accessing and manipulating data in a database. It handles user
requests.
• It includes some commands like select, insert, update, delete etc.

3) Data Control Language (DCL)


• DCL stands for Data Control Language. It is used to retrieve the stored or saved data.
• The DCL execution is transactional. It also has rollback parameters.
• It include commands like grant, revoke.

4) Transaction Control Language (TCL)


• TCL is used to run the changes made by the DML statement. TCL can be grouped into a logical transaction.
• It includes command like commit, rollback.

You might also like