1. Introduction to Database Management System
A Database Management System (DBMS) is software that allows users to create, manage, store, retrieve, and manipulate data efficiently. It acts as an interface between the user and the database, ensuring that data is organized, secure, and easily accessible.
In simple terms, a DBMS is like a digital filing system where data is stored in a structured way so that it can be easily accessed, updated, and managed.
Example
Consider a college management system:
- Student details (name, roll number, marks)
- Faculty information
- Course details
Instead of storing this data in files manually, a DBMS stores everything in structured tables, making it easy to search, update, and analyze.
2. What is a Database?
A database is an organized collection of data stored electronically. It allows efficient retrieval, insertion, and deletion of data.
Example
A simple student database table:
| Roll No | Name | Course | Marks |
|---|---|---|---|
| 101 | Aadi | BCA | 85 |
| 102 | Rahul | BCA | 78 |
| 103 | Priya | BCA | 92 |
This table is part of a database.
3. Need for DBMS
Before DBMS, data was stored in file systems, which had many problems:
Problems with File System
- Data redundancy (duplicate data)
- Data inconsistency
- Difficulty in accessing data
- Poor security
- No data relationships
How DBMS Solves These Problems
- Reduces redundancy
- Ensures consistency
- Provides easy access
- Maintains relationships
- Improves security
4. Features of DBMS
1. Data Storage and Retrieval
DBMS stores large amounts of data and retrieves it efficiently.
Example:
Searching for a student record using a roll number.
2. Data Security
Only authorized users can access data.
Example:
Admin can modify data, but students can only view it.
3. Data Integrity
Ensures accuracy and consistency of data.
Example:
Marks cannot exceed 100.
4. Data Independence
Changes in data structure do not affect applications.
5. Multi-user Access
Multiple users can access data simultaneously.
5. Types of DBMS
1. Hierarchical DBMS
- Data is organized in a tree structure.
- One parent → many children.
Example:
Company → Department → Employees
2. Network DBMS
- Data is represented as a graph.
- Many-to-many relationships.
3. Relational DBMS (RDBMS)
- Data is stored in tables (rows and columns).
- Most widely used.
Examples:
- MySQL
- PostgreSQL
- Oracle
4. NoSQL DBMS
- Used for unstructured data.
- Flexible schema.
Examples:
- MongoDB
- Firebase
6. Components of DBMS
1. Hardware
Physical devices like computers and servers.
2. Software
DBMS software like MySQL, Oracle.
3. Data
Actual stored information.
4. Procedures
Rules for using DBMS.
5. Users
- Database Administrator (DBA)
- Developers
- End users
7. Database Schema and Instance
Schema
Structure of the database.
Example:
Table design (columns, data types).
Instance
Actual data stored in the database.
8. Keys in DBMS
1. Primary Key
Unique identifier.
Example:
Roll Number
2. Foreign Key
Links two tables.
Example:
Student table linked with course table.
3. Candidate Key
Possible primary keys.
4. Composite Key
Combination of multiple columns.
9. SQL (Structured Query Language)
SQL is used to interact with databases.
Types of SQL Commands
1. DDL (Data Definition Language)
- CREATE
- ALTER
- DROP
Example:
CREATE TABLE Students (
id INT,
name VARCHAR(50),
marks INT
);
2. DML (Data Manipulation Language)
- INSERT
- UPDATE
- DELETE
Example:
INSERT INTO Students VALUES (1, 'Aadi', 90);
3. DQL (Data Query Language)
- SELECT
SELECT * FROM Students;
4. DCL (Data Control Language)
- GRANT
- REVOKE
10. Normalization
Normalization is the process of organizing data to reduce redundancy.
Types of Normal Forms
1. First Normal Form (1NF)
- No repeating groups
2. Second Normal Form (2NF)
- No partial dependency
3. Third Normal Form (3NF)
- No transitive dependency
| Student | Course | Instructor |
|---|---|---|
| Aadi | DBMS | Sharma |
| Aadi | OS | Verma |
After Normalization
Separate tables:
- Students
- Courses
- Instructors
11. Relationships in DBMS
1. One-to-One
One record → one record
2. One-to-Many
One student → many courses
3. Many-to-Many
Students ↔ Courses
12. Transactions in DBMS
A transaction is a unit of work.
ACID Properties
1. Atomicity
All or nothing.
2. Consistency
Data remains valid.
3. Isolation
Transactions don’t interfere.
4. Durability
Data is saved permanently.
Example
Bank transfer:
- Debit from one account
- Credit to another
If one fails → entire transaction fails.
13. Indexing
Index improves data retrieval speed.
Example
Like index in a book:
- Quickly find a topic
14. Views in DBMS
A view is a virtual table.
Example
CREATE VIEW TopStudents AS
SELECT name FROM Students WHERE marks > 80;
Comments
Post a Comment