Module1_DBMS
Module1_DBMS
Dept of ISE
1.1- Introduction
1.2- Characteristics of database approach
1.3- Advantages of using the DBMS approach
1.4- History of Database applications
Dept of ISE
1.1- Introduction
https://www.youtube.com/watch?v=X7v0O8yiUuY
Dept of ISE
INTRODUCTION
Dept of ISE
(ii) Insulation between programs and data, and data abstraction
• Both are critical features that enhance the flexibility, maintainability, and
scalability of database systems.
• The characteristic that allows program-data independence and
program-operation independence is called data abstraction.
Data Abstraction & Data Model:
• Data abstraction helps users work with data without needing to know how it
is stored or managed internally.
• A data model provides a simplified view of data and hides technical details
like file structures and indexing.
Dept of ISE
(iii)Support of multiple views of the data
• A database typically has many types of users, each of whom may require
a different perspective or view of the database.
• A view may be a subset of the database or it may contain virtual data that is
derived from the database files but is not explicitly stored.
• For example, when several reservation agents try to assign a seat on an airline
flight, the DBMS should ensure that each seat can be accessed by only one agent at
a time for assignment to a passenger. These types of applications are generally
called online transaction processing (OLTP) applications.
1. Controlling Redundancy
2. Restricting Unauthorized Access
3. Providing Persistent Storage for Program Objects
4. Providing Storage Structures and Search Techniques for Efficient Query
Processing
5. Providing Backup and Recovery
6. Providing Multiple User Interfaces
7. Representing Complex Relationships among Data
Dept of ISE
8. Enforcing Integrity Constraints
9. Permitting Inferencing and Actions Using Rules and Triggers
10. Additional Implications of Using the Database Approach
(1)Controlling Redundancy
• Redundancy in databases means storing the same data multiple
times in different places.
• While this might seem convenient in some cases, it leads to several
problems:
a. Duplication of Effort
b. Wasted Storage
c. Inconsistency
• To solve these problems, data normalization is used. It means we
Dept of ISE store each piece of data (like a student's name or birthdate) only
once in the database. This keeps everything consistent, saves space,
and avoids errors.
• However, sometimes controlled redundancy is used intentionally for
performance reasons.
• This is called denormalization. It helps speed up the system by
reducing the need to search multiple places for related data.
(2) Restricting Unauthorized Access
• When many people share a large database, not everyone should have access
to all the information in it.
• For example: Confidential Information: Data like salaries or bonuses is
private and can only be seen by authorized people.
Hence, the type of access operation—retrieval or update—must also be
controlled.
In short, the database ensures that people only see and do what they are
allowed to, keeping the data secure and organized.
(3)Providing Persistent Storage for Program Objects
• Object-oriented database systems enable persistent storage of program
objects and data structures, allowing them to survive after a program ends.
• This eliminates the need for manual conversions to and from file formats, as
the database system automatically handles these.
• Programming languages like C++ and Java integrate seamlessly with these
databases, allowing objects to be stored and retrieved directly, ensuring
convenience and consistency.
Dept of ISE • Object-oriented database systems address the impedance mismatch problem
by providing compatibility between database data structures and
programming language data structures.
(4) Providing Storage Structures and Search Techniques for
Efficient Query Processing
• The database is typically stored on disk, the DBMS must provide specialized data
structures and search techniques to speed up disk search for the desired
records.
• Auxiliary files called indexes are often used for this purpose. Indexes are
typically based on tree data structures or hash data structures that are suitably
modified for disk search.
• The DBMS often has a buffering or caching module that maintains parts of the
Dept of ISE database in main memory buffers.(to avoid disk-to-memory buffering )
• The choice of which indexes to create and maintain is part of physical database
design and tuning, which is one of the responsibilities of the DBA staff.
(5) Providing Backup and Recovery
Dept of ISE
1.4- History of Database
applications
Dept of ISE
History of Database applications
1. Early Database Systems (Hierarchical and Network)
•Early systems were used in organizations like universities, banks, and
hospitals.
•Data was tightly linked to its physical storage, making it hard to reorganize
or handle new queries.
•Required complex programming for new queries.
2. Relational Databases
•Introduced in the 1980s to separate data storage from its representation.
•Provided flexibility and program-data independence.
Dept of ISE
•Supported high-level query languages, making queries easier and faster
to write.
•Became the dominant database system over time due to improved
performance.
5. Specialized Applications
•New database extensions support applications like:
• Scientific data (e.g., genome mapping, physics experiments).
• Images and videos (e.g., X-rays, satellite images).
Dept of ISE • Data mining (e.g., detecting fraud).
• Geographical data (e.g., maps, weather).
• Time-series data (e.g., sales trends).
•Added features like new data types, operations, and indexing for these uses.
Dept of ISE
2.1- Data Models, Schemas and
Instances
Dept of ISE
Data Models
Dept of ISE • A data model—a collection of concepts that can be used to describe the structure
of a database—provides the necessary means to achieve this abstraction
• Provide concepts that are close to the way many users perceive
data -use concepts such as entities, attributes, and relationships.
• An entity represents a real-world object or concept, such as an
employee or a project from the miniworld that is described in the
database.
Dept of ISE • An attribute represents some property of interest that further
describes an entity, such as the employee’s name or salary.
• A relationship among two or more entities represents an
association among the entities., for example, a works- on
relationship between an employee and a project.
Dept of ISE
2. Low-level or physical data models
• Provide concepts that describe the details of how data is stored
on the computer storage media, typically magnetic disks.
• Concepts provided by low-level data models are generally meant
for computer specialists, not for end users.
Examples:
Relational Model – Uses tables, primary keys, and foreign keys
(e.g., MySQL, PostgreSQL).
Document-Oriented Model – Stores data as documents
(e.g., MongoDB, CouchDB).
Key-Value Model – Stores key-value pairs
(e.g., Redis, DynamoDB).
Columnar Model – Stores data in columns instead of rows
Dept of ISE (e.g., Apache Cassandra, HBase).
Schemas 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.
• The data in the database at a particular moment in time is called a database state/
SNAPSHOT / current set of occurrences / instances in the database
Dept of ISE
Schemas 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.
• The data in the database at a particular moment in time is called a database state/
SNAPSHOT / current set of occurrences / instances in the database.
• In a given database state, each schema construct has its own current set of instances;
for example, the STUDENT construct will contain the set of individual student entities
(records) as its instances.
Dept of ISE
Three Schema Architecture and
Dept of ISE
Data Independence
Three Schema Architecture
• The goal of the three-schema architecture, illustrated in Figure 2.2, is to separate the user
applications from the physical database.
Dept of ISE
• Data Independence refers to the ability to modify the database schema at one
level without altering the schema at the next higher level. It ensures that
changes to the database structure or storage do not affect how the data is
accessed or viewed by users.
• Data Independence is achieved through the three-schema architecture in
DBMS.
• We can define two types of data independence:
• Logical Data Independence
Dept of ISE • Physical Data Independence
• Logical Data Independence
• Definition:
• The ability to change the conceptual schema (logical structure of the
database) without affecting the external schema (user views).
• What can be changed:
• Adding or removing entities, attributes, or relationships.
• Modifying constraints such as keys.
• Why it’s important:
Dept of ISE • User applications or queries don’t need to be modified when the
database's logical design changes.
• Example:
• Adding a new attribute PhoneNumber to the STUDENT table should not
affect user queries that only retrieve the Name and Age.
• Physical Data Independence
• Definition:
• The ability to change the internal schema (physical storage of the
database) without affecting the conceptual schema or external schema.
• What can be changed:
• File organization, indexing, or access methods.
• Storage hardware or data compression techniques.
• Why it’s important:
Dept of ISE • Optimizations at the storage level do not disrupt database functionality
or logical structure.
2.3- Database Languages and
Interfaces
Dept of ISE
Database Languages
These are specialized programming or query languages used for
creating, accessing, and managing data in a database.
Commonly used database languages include:
• Many DBMSs have their own buffer management module to schedule disk read/write.
Stored data manager controls access to DBMS information that is stored on disk, whether
it is part of the database or the catalog.
• Loading
• Backup
Dept of ISE
• Database Storage Reorganization.
• Performance Monitoring.
Database System Utilities
• DBMSs have database utilities that help the DBA manage the database system. Common
utilities have the following types of functions:
• Loading
• Used to load existing data files—such as text files or sequential files—into the
database
• Automatically reformats the data and stores it in the database
• For loading programs, conversion tools are available like IDMS (Computer
Associates), SUPRA (Cincom), and IMAGE (HP)
Dept of ISE
• Backup
• Creates a backup copy of the database, by dumping the entire database onto tape
• Used to restore the database in case of catastrophic disk failure
• Incremental backups are also often used, to save space
Database System Utilities
Dept of ISE
2. Basic Client / Server Architecture
• Specialized Servers with Specialized
functions
• Print server
• File server
• DBMS server
• Web server
Dept of ISE • Email server
• Clients can access the specialized
servers as needed
Two Tier Client-Server Architecture for DBMS
• An Open Database
Connectivity(ODBC) provides
and API which allows
client-side to call DBMS
Dept of ISE
Advantage:
• Simplicity and Seamless
Compatibility.
Three Tier and n-Tier Client-Server
Architecture
Server plays an intermediate role by running application
programs and storing business rules that are used to access
data from the database server
Dept of ISE
Classification of Database
Management System.
• Based on Data Model – DBMS Classification
• Relational Data Model.
• Object Data Model.
• Big Data system – Key _value storage system
& NoSQL systems. Document-based.
Dept of ISE Graph-based.
Column-based.
Key-value data models.
• Object relational model & hierarchical network.
• Tree – Structured data model – XML based
Classification of Database Management System
• Based on number of users
• Single user system.
• Multi user system.
• Based on usage:
• General Purpose.
• Special Purpose.
Dept of ISE
Dept of ISE
Entities and Attributes
● Each entity has attributes—the particular properties that describe it. For
example, an EMPLOYEE entity may be described by the employee’s
name, age, address, salary, and job
Dept of ISE
Types of attributes in the ER model
Dept of ISE
Types of attributes in the ER model
Dept of ISE
Types of attributes in the ER model
Dept of ISE
Types of attributes in the ER model
● The first case arises when it is known that the attribute value exists
but is missing—for instance, if the Height attribute of a person is
listed as NULL.
Dept of ISE ● The second case arises when it is not known whether the attribute
value exists—for example, if the Home_phone attribute of a person is
NULL.
Types of attributes in the ER model
● An entity type defines a collection (or set) of entities that have the same
attributes. Each entity type in the database is described by its name and
attributes.
● The collection of all entities of a particular entity type in the database at
any point in time is called an entity set or entity collection.
●
Dept of ISE
Key Attributes of an Entity Type.
● An entity type usually has one or more attributes whose values are distinct
for each individual entity in the entity set. Such an attribute is called a key
attribute, and its values can be used to identify each entity uniquely.
● Each key attribute has its name underlined inside the oval.
● Some entity types have more than one key attribute
Dept of ISE
Value Sets (Domains) of Attributes
Each simple attribute of an entity type is associated with a value set (or domain of values),
which specifies the set of values that may be assigned to that attribute for each individual
entity
Dept of ISE
Initial Conceptual Design of the COMPANY Database
According to the requirements listed , we can identify
four entity types
Dept of ISE
Dept of ISE
Relationship Types, Relationship Sets,
Roles, and Structural Constraints
● There are several implicit relationships among the various
entity types
Dept of ISE
Dept of ISE
Relationship Degree
1. Degree of a Relationship Type: The degree of a relationship type is the number
of participating entity types. Hence, the WORKS_FOR relationship is of degree
two.
A relationship type of degree two is called binary, and one of degree three is
called ternary
An example of a ternary relationship is SUPPLY, shown in Figure, where each
relationship instance ri
2. Associates three entities—a supplier s, a part p, and a project j—whenever s
supplies part p to project j.
Dept of ISE
• Relationship types usually have certain constraints that limit the possible
combinations of entities that may participate in the corresponding
relationship set.
• These constraints are determined from the miniworld situation that the
relationships represent.
Dept of ISE
Relational (Structural Constrains)
Cardinality Ratio - Binary
Relationship
Dept of ISE
Relational (Structural Constrains)
Cardinality Ratio :
Dept of ISE
Dept of ISE
Dept of ISE
A recursive relationship is a relationship where an entity is related to
itself. This means that instances of the same entity set participate in a
relationship with each other
Dept of ISE
Attributes of Relationship Types
Dept of ISE
1. Strong Entity Type
• A strong entity has a primary key that uniquely identifies each
record.
• Example: An Employee entity with Employee_ID as a key.
3. Identifying Relationship
• A weak entity is linked to a strong entity through an identifying
relationship.
• The strong entity is called the owner entity.
Dept of ISE
4. Total Participation
• A weak entity must be related to a strong entity.
• Example: A Dependent cannot exist without being related to
an Employee.
5. Partial Key
• A partial key is an attribute that helps distinguish weak entities
within the same owner.
• Example: If no two dependents of the same employee have the
Dept of ISE
same Name, then Name is a partial key for the Dependent
entity.
ER Diagrams, Naming Conventions, and Design Issues
1. Meaningful Names
• Choose names that clearly represent the purpose of entities,
attributes, and relationships.
• Example: Use Employee instead of Person if the entity
represents employees.
2. Singular Names for Entity Types
• Use singular names for entity types, rather than plural.
• Example: Use Student (✅) instead of Students (❌).
3. Naming Conventions
Dept of ISE
• Entity Types & Relationship Types → UPPERCASE
• Example: EMPLOYEE, DEPARTMENT, WORKS_FOR
• Attributes → Capitalized Initial Letter
• Example: Employee_ID, Name, Salary
• Role Names → Lowercase
• Example: manager, subordinate (in a supervision
relationship)
4. Nouns for Entities, Verbs for Relationships
• Nouns (People, objects, concepts) → Entity Type Names
• Example: STUDENT, COURSE, TEACHER
• Verbs (Actions, interactions) → Relationship Names
• Example: ENROLLED_IN, TEACHES, MANAGES
• If an entity type has only one attribute and is only related to one other
entity, it might be better as an attribute instead of a separate entity.
• Example:
• If DEPARTMENT has only the attribute Dept_Name and relates only
to STUDENT, we can demote it to an attribute of STUDENT.
Before:
Dept of ISE STUDENT ----(BELONGS_TO)----> DEPARTMENT (Dept_Name)
Dept of ISE
Dept of ISE
Dept of ISE
Dept of ISE
Dept of ISE
Dept of ISE
Dept of ISE
Dept of ISE
Dept of ISE
Dept of ISE
Dept of ISE
Dept of ISE
Dept of ISE