Introduction to DBMS Unit 1
Introduction to DBMS Unit 1
Database Management
System
Examples:
• MySQL
• Oracle Database • MongoDB
• Microsoft
• PostgreSQL
• Azure Cosmos DB
• CouchDB
• Amazon DynamoDB
DBMS
Architecture
• Database System
Architecture defines how
data is managed, stored,
and accessed in a structured
manner.
• 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.
1-Tier •
application layer.
Typically used for local applications or small-scale software
where data does not need to be shared across multiple users.
Architecture Advantages:
• Fast and efficient as no network latency is involved.
• Simple to develop and maintain.
• No need for an internet connection.
Disadvantages:
• Not scalable for large systems.
• Difficult to share data with multiple users.
• Higher risk of data loss in case of system failure.
Examples:
• Microsoft Access – A standalone database system for small
applications.
• SQLite databases used in mobile apps or small desktop
applications.
Visual Representation:
A single system containing Application + Database in one unit.
In a two-tier architecture, the application client and database
server are located on separate machines. The client sends
queries, and the database server processes them and returns
the results. The client does not directly manipulate the database
2-Tier Architecture but interacts through a structured query language or application
programming interfaces.
(Client-Server Advantages:
• Provides better security since the database is on a separate
Architecture) •
server
Allows multiple clients to connect, improving scalability
• Ensures data integrity through centralized management
Disadvantages:
• Performance depends on network speed
• Requires a dedicated database server
• Limited business logic implementation on the client side
Examples:
• A desktop application using MySQL, PostgreSQL, or Oracle
Database on a separate server
• Banking applications where a desktop client connects to a
central database
• Hospital management systems where multiple branches use
a centralized database
In a 3-Tier Architecture, the system is divided into
three layers
• Presentation Layer – User interface
• Application Layer – Business logic processing
Data is structured like a tree, where each parent has one or more
children.
Traditional
Features of a Hierarchical Model
1. Parent-Child Relationship
A parent node exists for each child node. However, a parent node might
Data Models
have several child nodes. It is not permitted to have more than one parent.
2. One-to-many Relationship
The data is organised in a tree-like form, with the datatypes having a one-
to-many relationship. There can only be one path from any node to its
parent. For example, in the preceding example, there is only one way to
get to the node ‘sneakers’, which is through the ‘men’s shoes’ node.
3. Deletion Problem
When a parent node is removed, the child node is removed as well.
4. Pointers
Pointers are used to connect the parent and child nodes and to traverse
and navigate between the stored data. The ‘shoes’ node in the above
example points to the two additional nodes, ‘women’s shoes’ and ‘men’s
shoes.’
Pros of Hierarchical Model
• A tree-like structure is incredibly straightforward and quick to navigate.
• Any modification to the parent node is reflected automatically in the
child node, ensuring data integrity.
Cons of Hierarchical Model
• Relationships that are complex are not supported.
• Because it only supports one parent per child node, if we have a
complex relationship in which a child node needs to have two parents,
we won’t be able to describe it using this model.
• When a parent node is removed, the child node is removed as well.
•More flexible than hierarchical, supports many-to-many relationships.
Example: Banking systems, where accounts and customers have multiple
links.
Model number of relationships. It allows for quick and easy data access.
2. The Ability to Merge More Relationships
Data is more connected in this model since there are more relationships.
This paradigm can handle many-to-many as well as one-to-one
relationships.
3. Circular Linked List
The circular linked list is used to perform operations on the network model.
The present position is kept up to date with the help of a software, and it
navigates through the records based on the relationship.
Pros of Network Model
• In comparison to the hierarchical model, data can be retrieved faster.
This is because the data in the network model is more related, and there
may be more than one path to a given node. As a result, the data can
be accessed in a variety of ways.
• Data integrity is present since there is a parent-child relationship. Any
changes to the parent record are mirrored in the child record.
Cons of Network Model
• As the number of relationships to be managed grows, the system may
get increasingly complicated. To operate with the model, a user must
have a thorough understanding of it.
• Any alteration, such as an update, deletion, or insertion, is extremely
difficult.
A high-level data model diagram is the entity-relationship model or ER Model. We depict
the real-world problem in visual form in this model to make it easier for stakeholders to
comprehend. The developers can also quickly grasp the system by simply looking at
the ER Diagram.
Components of an ER Diagram
The ER diagram is a visual representation of an ER Model. The three components of an
ER diagram are as follows:
1. Entities
An entity is a real-life concept. It could be a person, a location, or even an idea. A school
management system, for example, has entities such as teachers, students, courses,
buildings, departments, and so on.
2. Attributes
An attribute is a real-world property that exists in an entity. For example, the entity
teacher has properties such as teacher salary, id, age, and so on.
3. Relationship
The relationship between two traits describes how they are linked. A teacher, for
The entities in the figure above are Teacher and Department.
Teacher_id, Teacher_Name, Age, Salary, and Mobile Number are the
characteristics of the Teacher object. Dept_name and Dept_id are the
attributes of the Department entity. The relationship is used to connect
the two entities, and each teacher is assigned to a department.
Pros of Entity-Relationship Model
1. Simple – The ER Model is simple to construct conceptually. We can easily
construct the ER Diagram for the model if we know the relationship between the
entities and the attributes.
2. Effective communication tool – Database designers frequently employ this
model to communicate their thoughts.
3. Easy conversion to any model – This model translates neatly to the relational
model, and it is simple to transform the ER model into a table. This model can be
transformed into a network model, a hierarchical model, and so forth.
Cons of Entity-Relationship Model
1. No industry standard for notation – When it comes to creating an ER model,
there is no industry standard. As a result, one developer may utilise notations that
are unfamiliar to other developers.
2. Hidden information – In the ER model, certain information may be lost or
hidden. Because it is a high-level view, there is a potential that some information
specifics will be buried.
A Database Schema is the logical structure of a database that
defines how data is organized, stored, and related. It acts as a
blueprint for the database, ensuring consistency and integrity.
Schema
relationships.
•Schema Objects: Includes tables, fields, views, indexes, keys
(primary & foreign), triggers, and stored procedures.
•Logical Representation: Data is physically stored in files, but
the schema defines its structure and retrieval process.
•Ensures Data Integrity: Implements constraints,
relationships, and rules to maintain consistency and
accuracy.
•Does Not Contain Data: Only defines the structure without
storing actual data.
Types of Database Schemas
1. Physical Schema: Defines how data is stored on disk (e.g.,
storage structure, indexing, partitions).
2. Logical Schema: Defines tables, attributes, relationships,
constraints without specifying storage details.
3. View Schema: Defines customized views for different users to
improve data security and accessibility.
The given diagram is an example of a database schema. It contains three
tables, their data types. This also represents the relationships between the
tables and primary keys as well as foreign keys.
Database Data Definition Language(DDL) is used for describing structures or patterns and its
relationship in a database. It is also used to define the database schema, tables,
2. Schemas
•A schema is the logical structure that defines tables, relationships, views, and other
database objects.
•It helps in organizing and securing database objects.
Example: A University Database Schema can include:
• Students (StudentID, Name, Age, CourseID)
• Courses (CourseID, CourseName, Credits)
3. Indexes
• Indexes improve the speed of data retrieval.
• They act like a table of contents, allowing faster searches in large datasets.
Example:
Creating an index on the StudentID column for quick lookups:
CREATE INDEX idx_student ON Students(StudentID);
4. Views
• Views are virtual tables that store query results.
• They do not store data themselves but simplify complex queries.
Example:
Creating a view for students enrolled in AI courses:
CREATE VIEW AI_Students AS
SELECT Name, Age FROM Students WHERE Course = 'AI';
5. Keys
Keys ensure data integrity and relationships between tables.
a) Primary Key
•A Primary Key uniquely identifies each record in a table.
•It prevents duplicate and NULL values.
Example:
Example of Primary Key:
CREATE TABLE Students ( StudentID INT PRIMARY KEY, Name
VARCHAR(50), Age INT );
Here, StudentID uniquely identifies each student.
b) Foreign Key
•A Foreign Key establishes a relationship between two tables.
•It ensures referential integrity by linking records.
Example:
Thank You