DBMS Fundamentals: Architecture, Data Models, and SQL Languages
1. DBMS – Introduction
Data
Data means raw facts and figures.
Example: 101, Vikas, CSE, 1st Year
Database
A database is an organized collection of related data that can be easily accessed, managed, and updated.
DBMS
DBMS (Database Management System) is software used to create, store, retrieve, update, and manage data in a database.
Examples: MySQL, Oracle, PostgreSQL, SQL Server.
Functions of DBMS
- Data storage
- Data retrieval
- Data insertion and updating
- Data security
- Backup and recovery
- Concurrency control
- Integrity enforcement
2. DBMS Architecture
DBMS architecture describes how users interact with stored data.
Three-Level Architecture
USER
↓
┌──────────────┐
│ External │
│ Level │
└──────┬───────┘
↓
┌──────────────┐
│ Conceptual │
│ Level │
└──────┬───────┘
↓
┌──────────────┐
│ Internal │
│ Level │
└──────┬───────┘
↓
DATABASE1. External Level
- Highest level.
- Shows only the data required by a particular user.
- Different users can have different views.
Example: Student sees marks; accounts department sees fees.
2. Conceptual Level
- Describes the complete logical structure of the database.
- Contains tables, relationships, constraints, etc.
3. Internal Level
- Lowest level.
- Describes how data is physically stored.
- Deals with files, indexes, storage blocks, etc.
3. File Processing System
A file processing system is a traditional system where data is stored in separate files and individual application programs manage those files.
Example
Student File
↓
Marks File
↓
Fee File
↓
Attendance FileEach application may maintain its own data files.
4. Limitations of File Processing System
1. Data Redundancy
Same data may be stored in multiple files.
Example: Student name is stored in both marks and fee files.
2. Data Inconsistency
If duplicated data is changed in one file but not another, different values may exist.
3. Difficulty in Data Access
Obtaining specific information may require writing a new program.
4. Data Isolation
Data is scattered among different files and formats.
5. Integrity Problems
It is difficult to enforce rules on data.
Example: Marks should be between 0 and 100.
6. Security Problems
Providing different access permissions to different users is difficult.
7. Concurrent Access Problems
Multiple users accessing the same data simultaneously can create inconsistencies.
8. Atomicity Problems
If a transaction fails halfway, restoring the correct state is difficult.
9. Backup and Recovery Problems
Recovering data after a system failure is difficult.
5. Advantages of Database System
A DBMS solves many problems of the traditional file system.
Advantages
- Reduced data redundancy
- Reduced data inconsistency
- Data sharing
- Improved security
- Data integrity
- Data independence
- Backup and recovery
- Concurrency control
- Easy data access
- Centralized data management
One-line answer
A database system provides efficient, secure, consistent, and reliable storage and retrieval of data.
6. Schema
A schema is the overall logical structure or design of a database.
Example:
STUDENT(Roll_No, Name, Branch, Semester)Here, the structure of the Student table is the schema.
Important point
Schema changes rarely.
7. Instance
An instance is the actual data stored in a database at a particular point in time.
Example:
| Roll_No | Name | Branch |
|---|---|---|
| 101 | Vikas | CSE |
| 102 | Rahul | CSE |
This actual data is the database instance.
Schema vs Instance
| Schema | Instance |
|---|---|
| Database structure | Actual data |
| Changes rarely | Changes frequently |
| Describes design | Describes current state |
| Example: Student(Roll, Name) | Example: 101, Vikas |
⭐ Easy trick
Schema = Structure
Instance = Information
8. Data Independence
Data independence is the ability to change the database at one level without affecting the next higher level.
There are two types:
A. Physical Data Independence
Changes at the internal/physical level do not affect the conceptual level.
Example
Changing:
- File organization
- Storage method
- Indexing technique
does not require changing the logical database structure.
B. Logical Data Independence
Changes at the conceptual level do not affect external views or applications.
Example
Adding a new attribute to a table without changing existing user views.
Difference
| Physical | Logical |
|---|---|
| Physical storage changes | Logical structure changes |
| Internal level | Conceptual level |
| Easier to achieve | More difficult to achieve |
9. Data Dictionary
A data dictionary is a collection of information about the data stored in a database.
It is also called metadata.
Metadata
Metadata = Data about data
For example:
| Information | Example |
|---|---|
| Table | Student |
| Column | Roll_No |
| Data type | Integer |
| Size | 10 |
| Constraint | Primary Key |
Data dictionary contains
- Table names
- Attribute names
- Data types
- Constraints
- Relationships
- Indexes
- User information
10. Functions of DBA
DBA = Database Administrator
A DBA is responsible for the overall management of a database system.
Functions
- Database design
- User authorization
- Security management
- Backup and recovery
- Performance monitoring
- Storage management
- Integrity management
- Concurrency control
- Database maintenance
- Managing access permissions
Exam definition
DBA is responsible for managing, securing, maintaining, and ensuring the proper functioning of a database system.
11. Database Languages
Database languages are used to define, manipulate, control, and manage data.
1. DDL – Data Definition Language
Used to define the database structure.
Commands:
CREATEALTERDROPTRUNCATE
Example:
CREATE TABLE Student (
Roll_No INT,
Name VARCHAR(50)
);2. DML – Data Manipulation Language
Used to manipulate data.
Commands:
INSERTUPDATEDELETESELECT
Example:
INSERT INTO Student VALUES (101, 'Vikas');3. DCL – Data Control Language
Used to control access and permissions.
Commands:
GRANTREVOKE
4. TCL – Transaction Control Language
Used to manage transactions.
Commands:
COMMITROLLBACKSAVEPOINT
Quick Revision Table
| Language | Purpose | Commands |
|---|---|---|
| DDL | Define structure | CREATE, ALTER, DROP |
| DML | Manipulate data | INSERT, UPDATE, DELETE, SELECT |
| DCL | Control permissions | GRANT, REVOKE |
| TCL | Manage transactions | COMMIT, ROLLBACK |
12. Data Models
A data model is a collection of concepts used to describe the structure of data and relationships among data.
Your syllabus includes:
- Hierarchical Data Model
- Network Data Model
- Relational Data Model
- E-R Model
13. Hierarchical Data Model
The Hierarchical Data Model organizes data in the form of a tree.
COLLEGE
|
┌────────┴────────┐
CSE ECE
|
STUDENTS
/ \
Vikas RahulCharacteristics
- Tree structure
- Parent-child relationship
- One parent can have many children
- Mainly supports 1:N relationships
Advantages
- Simple structure
- Easy navigation
- Fast access
Disadvantages
- Difficult to represent M:N relationships
- Can cause data redundancy
- Less flexible
14. Network Data Model
The Network Data Model represents data as a graph/network of records.
A record can have multiple parent records.
Student
/ \
Course 1 Course 2
\ /
TeacherCharacteristics
- Graph-like structure
- Supports 1:1
- Supports 1:N
- Supports M:N relationships
Advantages
- Flexible
- Handles complex relationships
- Efficient navigation
Disadvantages
- Complex to design
- Difficult to maintain
- Less simple than relational model
15. Relational Data Model
The Relational Data Model represents data using tables.
A table contains:
- Rows → Tuples
- Columns → Attributes
Example:
| Roll_No | Name | Branch |
|---|---|---|
| 101 | Vikas | CSE |
| 102 | Rahul | CSE |
| 103 | Aman | ECE |
Advantages
- Simple
- Easy to understand
- Flexible
- Uses SQL
- Easy data manipulation
- Reduces redundancy through normalization
- Widely used
Examples
- MySQL
- Oracle
- PostgreSQL
- SQL Server
16. E-R Model
E-R = Entity-Relationship Model
It is a conceptual model used to represent entities, attributes, and relationships.
Main Components
1. Entity
An entity is a real-world object.
Examples:
- Student
- Teacher
- Course
- Employee
2. Attribute
An attribute is a property of an entity.
For Student:
Student
├── Roll_No
├── Name
├── Branch
└── Semester3. Relationship
A relationship shows an association between entities.
Student ─── ENROLLS ─── CourseCommon ER Symbols
| Component | Symbol |
|---|---|
| Entity | Rectangle |
| Attribute | Oval |
| Relationship | Diamond |
| Key Attribute | Underlined oval |
Simple ER diagram
[STUDENT] ─── ◇ ENROLLS ◇ ─── [COURSE]17. Comparison Between Models
| Feature | Hierarchical | Network | Relational | E-R |
|---|---|---|---|---|
| Structure | Tree | Graph | Tables | Diagram |
| Basic unit | Record | Record | Table | Entity |
| Relationship | Mainly 1:N | 1:1, 1:N, M:N | Through keys | Explicit |
| Flexibility | Low | High | High | High |
| Complexity | Low | High | Low/Medium | Low |
| Data representation | Parent-child | Network | Rows & columns | Entities & relationships |
| Main use | Older DB systems | Complex relationships | Modern DBMS | Database design |
