Why Database? DBMS Fundamentals, Components, and User Types
Overview: Follow one fee payment through a college portal.
What is Data and What is a Database?
- In daily life, every organization generates information:
- A college maintains records of students, attendance, marks, and fees.
- A bank keeps track of account holders, balance, transactions, and loans.
- A shopping app stores products, customer addresses, orders, and delivery statuses.
- Data: Raw, unorganized facts and figures (e.g.,
Amit,95,BCA). - Information: Processed, structured data that has meaningful context (e.g., “Amit scored 95 marks in BCA DBMS”).
- Database: An organized collection of logically related data stored electronically so that it can be easily accessed, managed,…
Why Database? File Processing Systems vs. DBMS
- Before DBMS was invented in the 1960s, organizations stored their data using traditional Operating System Flat Files (like
.txt,.csv,… - Major Limitations of Traditional File Processing Systems: Data Redundancy and Inconsistency: The same student address might be duplicated in the Library file, Hostel file, and Exam file.
- Difficulty in Accessing Data: Writing a new C or Python program just to find “students who scored above 75% in Indore” is slow and tedious.
- Data Isolation: Data is scattered across multiple file formats and directories, making cross-referencing difficult.
- Integrity Problems: Hard to enforce business rules (e.g.,
Balance >= 500orAge between 18 and 60) across arbitrary flat files. - Atomicity Problems: If a computer crashes midway through a bank fund transfer, money might be debited from Account A without being credited to…
- Concurrent Access Anomalies: Two railway clerks trying to book the last available train seat at the exact same second can both sell the same seat without…
- Security Problems: Flat files do not easily permit granular permissions (e.g., allowing a teacher to view marks but not salary).
View diagram · Comparison: Traditional File System vs. Database Management System
Key Characteristics of Data in a Database
- Self-Describing Nature (Metadata in Data Dictionary): A database does not just contain raw data; it contains complete definitions of tables, columns, constraints, and data types…
- Insulation Between Programs and Data (Data Independence): The physical file layout on hard drives can change without breaking user application programs.
- Support for Multiple Views: A student views only their grades, a teacher views all class grades, and the accountant views fee balances.
- Sharing of Data and Multi-User Transaction Processing: Concurrency control ensures multiple users read and write safely at the same time.
- ACID Properties of Transactions:
- Atomicity: All operations succeed or none do (All or Nothing).
- Consistency: Database transitions only between valid states.
- Isolation: Concurrent transactions execute without interfering with each other.
Major Components of a DBMS
- A complete DBMS architecture consists of five fundamental building blocks:
- Hardware: Physical computers, storage disks, networking devices, and memory buffers where data is physically housed.
- Software: The core software engine (like MySQL or Oracle) containing query optimizers, transaction managers, buffer managers, and…
- Data: The operational user data alongside the Metadata (data about data: table schemas, index maps, user privileges).
- Procedures: Operational guidelines, backup schedules, recovery protocols, and validation rules governing how the system is operated.
- People / Users: The human personnel interacting with the database at various levels of technical abstraction.
View diagram · The Five Core Components of DBMS
Types of Database Users
- Different people interact with a DBMS in different ways based on their technical skills:
- 1. Naive / Parametric Users: Zero technical knowledge
- 2. Sophisticated Users: High technical knowledge
- 3. Application Programmers: Software developers
- 4. Specialized Users: Domain specialists
- 5. Database Administrator (DBA): Master system authority
Advantages and Disadvantages of DBMS
- Advantages of DBMS: Redundancy Reduction: Central storage eliminates conflicting duplicate data.
- Data Sharing: Multiple departments query the same single source of truth.
- Data Integrity: Constraints guarantee that invalid records (like negative salaries) cannot be entered.
- Security Control: Restricts unauthorized user access via granular permissions.
- Backup and Automatic Recovery: Reconstructs consistent database states after sudden power cuts or disk failures.
- Enforcement of Standards: Enforces standardized data naming, formatting, and documentation.
- Disadvantages of DBMS: High Initial Cost: Enterprise licenses for software (e.g., Oracle) and powerful enterprise server hardware are expensive.
- Complexity: Highly complex software requiring trained staff to administer.
Three-Schema Architecture, Data Independence, and Role of the DBA
Overview: A student sees a marksheet, while the exam office sees the results of the entire class.
Introduction: Why Do We Need Abstraction in Databases?
- A database stored on a server’s hard drive consists of complex byte offsets, binary disk blocks, compression trees, and B-Tree indexes.
The Three-Level Database Architecture
- The three-schema architecture divides the database system into three independent levels of abstraction:
- A. External Level (View Level - Highest Abstraction): This is the level closest to end users.
- Different users have different customized Views of the exact same data.
- Example in a University Database:
- A Student sees only their own roll number, attendance, and semester marks.
- An Accounts Officer sees student fees paid, fee dues, and scholarship funds, but cannot edit grades.
- A Professor sees student marks and assignment submissions, but cannot view salary records of colleagues.
- Hides confidential or irrelevant data from specific user roles.
View diagram · ANSI/SPARC 3-Level Database Architecture
What is Data Independence?
- Data Independence is the ability to modify a schema definition at one level of the database system without having to alter the schema…
- Levels Involved: Between Internal Level and Conceptual Level
- What Can Be Changed?: Switching from HDD to SSD, creating new B-Tree indexes, changing hashing algorithm or file compression
- Impact on Programs: User applications require zero code changes
- Ease of Achievement: Easy to achieve (handled automatically by DBMS)
View diagram · The Two Levels of Data Independence
Role and Responsibilities of the Database Administrator (DBA)
- The Database Administrator (DBA) is the chief technical custodian of an enterprise database system.
- Key Responsibilities of a DBA: Schema Definition and Modification: Designing the original conceptual and physical database schemas, and altering table structures when business requirements…
- Storage Structure and Access-Method Definition: Deciding which indexing techniques (B+ Tree, Hashing) and storage formats to use for optimal query speed.
- Granting Authorization and Security Control: Deciding which users have access to which tables.
- Routine Maintenance and Backups: Establishing periodic automated backup routines (hourly, daily, weekly) onto secure secondary servers or cloud storage to…
- Disaster Recovery and Restoration: Restoring the database to a clean, consistent state after hardware crashes, power outages, or accidental human deletion.
- Performance Tuning and Monitoring: Monitoring query bottlenecks, slow transactions, and disk space usage.
- Liaison with Users and Management: Helping software developers write optimized queries and ensuring business policies are faithfully represented in the data…
Entity-Relationship (ER) Model: Components, Symbols, and Attributes
Overview: A book title can have several physical copies.
What is the Entity-Relationship (ER) Model?
- Introduced by Peter Chen in 1976, the Entity-Relationship (ER) Model is a high-level conceptual data model used to visually plan and…
Core Components of the ER Model
- The ER model is built upon three foundational building blocks:
View diagram · The Three Pillars of the ER Model
Standard ER Modeling Symbols (Chen’s Notation)
- In university examinations (DAVV BCA), students must draw ER diagrams using standard geometric shapes:
- Rectangle: Entity
- Double Rectangle: Weak Entity
- Ellipse / Oval: Attribute
- Underlined Ellipse: Key Attribute
- Dashed Ellipse: Derived Attribute
- Double Ellipse: Multivalued Attribute
Types of Entities: Strong vs. Weak Entity
- A strong entity has a key of its own.
- Strong Entity (Regular Entity) Has its own Primary Key.
- Weak Entity Set Does not have a Primary Key.
- Real-World Example of a Weak Entity: In a company database,
EMPLOYEEis a Strong Entity with primary keyEmp_ID. - An employee’s children or spouse are stored in entity set
DEPENDENT. - If an employee leaves the company, their family records have no reason to exist.
- Therefore,
DEPENDENTis a Weak Entity connected toEMPLOYEEvia an Identifying RelationshipHAS_DEPENDENT(double diamond). - Its partial discriminator is
Dependent_Name(underlined with a dotted line).
View diagram · Strong vs. Weak Entity Comparison
Types of Attributes
- Attributes characterize an entity.
- Simple vs. Composite Attributes:
- Simple (Atomic): Cannot be divided further (e.g.,
Gender,Roll_No). - Composite: Can be broken down into sub-components (e.g.,
Full_Namecan be split intoFirst_Name,Middle_Name,Last_Name;… - Single-Valued vs. Multi-Valued Attributes:
- Single-Valued: Has at most one value per entity instance (e.g.,
Aadhar_Number,Date_of_Birth). - Multi-Valued: Can store multiple values for the same entity instance (e.g., a person having three
Mobile_Numbers, or a developer with… - Stored vs. Derived Attributes:
Relationship Types, Degree, and Cardinality Ratios
- A Relationship is an association among two or more entities.
- A. Degree of a Relationship: The number of participating entity sets:
- Unary (Recursive): Degree 1.
- Binary: Degree 2.
- Ternary: Degree 3.
- B. Cardinality Ratios (Mapping Cardinality) for Binary Relationships: Specifies the maximum number of entity instances that can be associated with another entity:
- One-to-One (1:1):
- An entity in A is associated with at most one entity in B, and vice-versa.
Enhanced ER (EER) Model: Superclasses, Subclasses, Specialization, and Generalization
Overview: Start with Person and split it into Student and Teacher to specialise.
Why Do We Need the Enhanced ER (EER) Model?
- Traditional ER modeling was designed in the 1970s for simple, flat business applications (like basic payroll or accounting).
Superclass and Subclass Concepts
- Superclass (Super-Entity): A generic entity type that contains attributes common to all specialized entity types.
- Subclass (Sub-Entity): A specialized subgrouping of entity instances from the superclass that shares common attributes while having distinct unique…
- Real-World Example: In a company database:
EMPLOYEEis a Superclass with common attributes:Emp_ID,Name,Salary,Joining_Date.HOURLY_EMPLOYEEis a Subclass with specific attribute:Hourly_Wage.SALARIED_EMPLOYEEis a Subclass with specific attribute:Annual_Bonus.CONSULTANTis a Subclass with specific attribute:Contract_Duration.
Type Inheritance (Attribute and Relationship Inheritance)
- One of the greatest benefits of the EER model is Attribute Inheritance:
- A subclass entity automatically inherits all attributes of its superclass entity.
- A subclass entity automatically inherits all relationships in which the superclass participates.
- The subclass only needs to define its own specialized, local attributes!
View diagram · Inheritance in EER Modeling
Specialization vs. Generalization
- These two concepts represent the exact same end-result, but are approached from opposite directions during database design:
- Specialization (Top-Down Process) Starting with a generic entity and breaking it down into specialized subclasses based on distinguishing features.
- Generalization (Bottom-Up Process) Starting with distinct entities, recognizing their commonalities, and synthesizing them into a higher-level superclass.
- Design Direction: Top-Down approach
- Starting Point: Starts with 1 broad generic entity set (e.g.,
PERSON) - Result: Subclasses are created based on differences (
STUDENT,TEACHER) - Focus: Maximizes differences and identifies unique properties
- Process: Splitting / Refining
View diagram · Top-Down vs. Bottom-Up Design Paradigms
Constraints on Specialization and Generalization
- To prevent invalid data, database designers specify two independent constraints on superclass-subclass hierarchies:
- A. Disjointness Constraint (Disjoint vs. Overlapping): Determines whether an entity instance can belong to more than one subclass simultaneously:
- Disjoint (d): An entity instance can belong to at most ONE subclass.
- Example: In a university, a
VEHICLEis either aTWO_WHEELERor aFOUR_WHEELER. - Symbol: Drawn with a small circle containing letter d.
- Overlapping (o): An entity instance can simultaneously belong to multiple subclasses.
- Example: In a university, a
PERSONcan be both anEMPLOYEE(teaching assistant) and aSTUDENTat the same time. - Symbol: Drawn with a small circle containing letter o.
Four Possible Constraint Combinations
- 1. Disjoint & Total:
d, double line - 2. Disjoint & Partial:
d, single line - 3. Overlapping & Total:
o, double line - 4. Overlapping & Partial:
o, single line
EER Modeling: Categorization (Union Types) and Aggregation
Overview: A vehicle owner may be a person or a company.
Introduction: Handling Complex Real-World Relationships
- In basic specialization and generalization, a subclass inherits from a single superclass (or multiple superclasses sharing the same keys).
- Scenario 1: A car owner can be an individual person, a registered company, or a bank.
- Scenario 2: A doctor treats a patient during a visit, and that specific treatment needs to be billed by an insurance company.
Categorization (Union Types)
- What is a Category (Union Type)?: A Category (or Union Type) represents a single subclass that has two or more distinct superclasses where each…
- Key Characteristics of Categorization: Selective Inheritance: In ordinary generalization, a subclass inherits all attributes from its superclass.
- If Owner 1 is a
PERSON, they inheritAadhar_NoandDOB. - If Owner 2 is a
COMPANY, they inheritGSTINandCompany_Name. - Total vs. Partial Category:
- Total Category: Every instance of the superclasses must be an owner (Drawn with a double line).
- Partial Category: An entity can exist without being an owner (e.g., Not every person owns a vehicle).
View diagram · Categorization (Union Type) Architecture
Aggregation in the ER Model
- The Problem: Relationships Between Relationships: In Chen’s standard ER model, a relationship can only connect entities, never another relationship:
- Suppose
EMPLOYEEworks on aPROJECT. - Now, suppose management needs to assign specialized
MACHINERYto that specific employee-project assignment. - Drawing a line from
MACHINERYinto the diamondWORKS_ONis strictly forbidden in basic ER modeling! - The Solution: Aggregation: Aggregation is an abstraction concept where a relationship between two entities is treated as a **single higher-level…
- By enclosing the entire
[EMPLOYEE - WORKS_ON - PROJECT]relationship inside a bounding rectangle, it now behaves as an ordinary entity…
View diagram · Aggregation in Action
Comprehensive Comparison: ER Model vs. Enhanced ER (EER) Model
- Origin & Focus: Designed for traditional relational databases & simple business records
- Object-Oriented Support: No support for OOP concepts
- Hierarchies: Flat structure; cannot represent sub-types
- Abstraction Mechanisms: Basic entity-relationship mappings
- Inheritance: Does not exist; all entities are separate
- Modularity & Reuse: Low modularity; repeated definitions
ER & EER Diagram Design: Step-by-Step Practical Case Studies
Overview: Before drawing a hospital ER diagram, ask whether a patient can see the same doctor twice.
How to Solve ER Diagram Questions in DAVV BCA Exams
- In every semester examination at Devi Ahilya Vishwavidyalaya (DAVV), a 10-Mark or 14-Mark question asks students to design a complete ER…
- Identify the Entities (Nouns): Scan the problem statement for tangible things or concepts (e.g.,
Student,Doctor,Account). - Identify the Attributes (Properties): Look for details describing each noun (e.g.,
Roll_No,Name,Balance). - Identify the Relationships (Verbs): Look for actions linking the nouns together (e.g.,
Enrolls,Treats,Deposits). - Determine Cardinality and Participation: Decide if the link is
1:1,1:N, orM:N, and whether participation isTotal(double line) orPartial.
Case Study 1: University Management System (DAVV Model)
- Problem Statement: *“A university has multiple departments.
- Step-by-Step Breakdown: A student and a course each have an identity.
- Relationships and Cardinality: DEPARTMENT to COURSE (
OFFERS): - Cardinality:
1:N(One department offers many courses; a course belongs to only 1 department). - STUDENT to COURSE (
ENROLLS_IN): - Cardinality:
M:N(A student takes multiple courses; a course has multiple enrolled students). - Descriptive Attribute:
GradeorSemesteris attached to theENROLLS_INdiamond! - PROFESSOR to DEPARTMENT (
BELONGS_TO):
View diagram · Entity and Relationship Mapping: University System
Case Study 2: Hospital Management System
- Problem Statement: *“A hospital consists of doctors, patients, and rooms.
- Breakdown: Entities:
DOCTOR(Doc_ID, Name, Specialization, Contact)PATIENT(Patient_ID, Name, Age, Disease, Admission_Date)ROOM(Room_No, Room_Type, Daily_Charge)MEDICINE(Med_ID, Med_Name, Manufacturer, Price)- Relationships:
- One doctor can treat several patients in this simplified model.
View diagram · Hospital relationships
Case Study 3: Banking Database System (with EER Specialization)
- Problem Statement: *“A bank maintains customer details and multiple accounts.
- Entities:
CUSTOMER(Customer_ID, Name, Phone, Aadhar_No)ACCOUNT(Superclass: Account_No, Balance)SAVINGS_ACCOUNT(Subclass:Interest_Rate)CURRENT_ACCOUNT(Subclass:Overdraft_Limit)LOAN(Loan_No, Amount, Loan_Type)- Relationships:
View diagram · EER Hierarchy for Banking Accounts
Summary Checklist for University Exam ER Diagrams
- To ensure maximum marks from the evaluator:
- Always underline the primary key attributes (e.g.,
<u>Roll_No</u>). - Clearly label cardinality ratios (
1,N,M) next to the connecting lines. - Use a double rectangle for weak entities and a double diamond for their identifying relationships.
- If an attribute can have multiple values (like mobile numbers), use a double ellipse.
- If an attribute is derived (like age calculated from DOB), use a dashed ellipse.
- Write a brief 4-line textual description explaining your entities and relationships alongside the diagram!