DBMS Mod 1
DBMS Mod 1
DBMS Mod 1
Syllabus
Introduction to database Systems, advantages of database system over traditional
file system, Basic concepts & Definitions, Database users, Database Language,
Database System Architecture, Schemas, Sub Schemas, & Instances, database
constraints, 3-level database architecture, Data Abstraction, Data Independence,
Mappings, Structure, Components & functions of DBMS, Data models.
DBMS NOTES 1
Advantages of Database Systems over Traditional File Systems:
This example demonstrates the creation of a basic table, insertion of data, and a
simple query to retrieve all records from the "Students" table.
DBMS NOTES 2
Database Users:
1. Naive Users:
2. Online Users:
3. Sophisticated Users:
4. Unsophisticated Users:
Description: Users who have some knowledge of databases but are not
experts.
Functions:
DBMS NOTES 3
Data Security: Implementing security measures to control access and
protect sensitive information.
Database Languages:
1. DDL (Data Definition Language):
Basic Syntax:
DBMS NOTES 4
2. DML (Data Manipulation Language):
Basic Syntax:
UPDATE TableName
SET Column1 = NewValue
WHERE Condition;
Basic Syntax:
DBMS NOTES 5
REVOKE DELETE ON TableName FROM UserName;
Basic Syntax:
COMMIT;
ROLLBACK;
SAVEPOINT : Sets a point within a transaction to which you can later roll
back.
SAVEPOINT SavepointName;
Basic Syntax:
What is a Schema?
DBMS NOTES 6
A schema is like the blueprint or plan for a house. It defines the overall
structure and organization of a database.
Layman Example:
Imagine building a house. The architectural drawings that specify where the
rooms, doors, and windows will be represent the schema for the house.
2. Subschemas:
What is a Subschema?
Layman Example:
In the house, everyone might have their own way of arranging the furniture in
the living room. Each arrangement is like a subschema tailored to an
individual's preference.
3. Instances:
What is an Instance?
An instance is like the actual furniture, people, and decorations in the rooms
of the house at a particular moment. It represents the current state.
Layman Example:
If the living room furniture is arranged for a cozy movie night, that
arrangement is an instance of the living room at that specific time.
4. Schema Evolution:
Schema evolution is like renovating the house over time. It involves making
changes to the original plan to adapt to new needs or trends.
Layman Example:
If you decide to add a home office to the house because you started working
from home, that's a form of schema evolution.
5. Schema Integration:
DBMS NOTES 7
Schema integration is like combining different room designs from different
plans into a harmonious whole.
Layman Example:
If you merge ideas from different interior design plans to create a cohesive
look for the entire house, that's similar to schema integration.
In summary, think of a schema as the blueprint for a database (like a house plan),
subschemas as customized views for specific users (like arranging furniture in a
room), instances as the current state of the data (like the current furniture
arrangement), schema evolution as adapting the plan over time (like renovating the
house), and schema integration as merging different plans into a unified design (like
combining various interior design ideas).
3-Schema Architecture
The three-schema architecture is a conceptual framework that separates a database
system into three distinct components or schemas. This architecture was introduced
by the ANSI/X3/SPARC committee and is widely used for designing and managing
database systems. The three schemas are the User Schema, the Logical Schema,
and the Physical Schema.
1. User Schema:
Purpose:
Defines the views and access privileges for different user groups.
Components:
Example:
In an online shopping database, the user schema might have views for
customers to see their order history, and another view for administrators to
manage product inventory.
2. Logical Schema:
DBMS NOTES 8
Purpose:
Components:
Example:
In the same online shopping database, the logical schema would define
tables for products, customers, orders, and their relationships, without
specifying how data is physically stored.
3. Physical Schema:
Purpose:
Represents how the data is physically stored and accessed on the hardware.
Components:
Example:
Continuing with the online shopping database, the physical schema would
detail how product information is stored on disk, specifying details like file
organization and indexing methods.
Changes in one schema do not affect the other schemas. For example,
modifying the physical storage does not impact user views.
DBMS NOTES 9
3. Flexibility:
Users can have customized views without affecting the overall structure of
the database.
4. Maintenance:
Purpose:
Layman Example:
Think of a nightclub where the bouncer checks your ID before allowing you
inside. The process of checking your name on the guest list and confirming
your access is similar to authorization.
Authentication:
Purpose:
DBMS NOTES 10
Layman Example:
When you log in to your email account by entering your username and
password, you are going through the authentication process to prove that
you are the authorized user.
Purpose:
Layman Example:
Consider a car. As a driver, you don't need to know the intricate details of the
engine; you interact with the dashboard and controls. The engine details are
hidden from you, promoting simplicity and safety.
Data Abstraction:
Purpose:
Layman Example:
When using a smartphone, you don't need to know the intricacies of how
each app works; you interact with abstract functionalities like messaging or
navigation, simplifying the user experience.
3. Data Independence:
Data Independence:
DBMS NOTES 11
Definition: Data independence is the ability to make changes in the database
structure without affecting the application programs or user views.
Types:
Layman Example:
Summary:
1. Authorization and Authentication:
3. Data Independence:
2-Tier Architecture:
Definition:
DBMS NOTES 12
Components:
1. Client Tier:
The user interface or presentation layer that interacts directly with the user.
2. Database Tier:
Characteristics:
Thinner Client: The client has less processing logic; more processing occurs on
the server.
Example:
3-Tier Architecture:
Definition:
Components:
DBMS NOTES 13
Interprets user requests, processes them, and communicates with the data
tier.
Characteristics:
Example:
Key Differences:
1. Number of Tiers:
2. Communication Flow:
3-Tier: Communication flows from the client to the application server, and
then to the database.
3. Scalability:
2-Tier: Limited scalability; upgrading one tier affects the entire system.
4. Security:
DBMS NOTES 14
3-Tier: Enhanced security with a separate data tier, reducing direct access
to the database.
5. Business Logic:
Mapping:
Mapping Cardinality:
Mapping Ratio:
Types:
1. One-to-One (1:1):
Description:
Example:
2. One-to-Many (1:N):
Description:
Example:
DBMS NOTES 15
A mapping between a "Department" entity and an "Employee" entity where
each department has many employees, but each employee belongs to only
one department.
3. Many-to-One (N:1):
Description:
Example:
4. Many-to-Many (N:N):
Description:
Each instance in one entity can be associated with zero or more instances in
another entity, and vice versa.
Example:
A mapping between a "Book" entity and an "Author" entity where each book
can have multiple authors, and each author can write multiple books.
Data Models:
1. Hierarchical Data Model:
Structure:
Example:
Structure:
DBMS NOTES 16
Similar to the hierarchical model but allows multiple relationships between
entities, forming a network.
Example:
Structure:
Example:
A database for a library where there are tables for books, authors, and
borrowers, each related through unique identifiers.
Structure:
Example:
Structure:
Organizes data into objects with attributes and methods, reflecting real-world
entities.
Example:
A multimedia database where images, videos, and audio files are treated as
objects with properties and behaviors.
DBMS NOTES 17