Database Management System

🧠 1. Introduction to DBMS

🔹 What is a Database?

database is an organized collection of related data that can be easily accessed, managed, and updated.

Example:
A college database may contain data about students, teachers, and courses.


🔹 What is DBMS?

Database Management System (DBMS) is a software that allows users to define, create, maintain, and control access to the database.

Examples: MySQL, Oracle, SQL Server, PostgreSQL, MS Access.


🔹 Need for DBMS

  • Avoids data redundancy (duplicate data).
  • Ensures data consistency.
  • Provides data security and integrity.
  • Allows concurrent access by multiple users.
  • Offers backup and recovery mechanisms.

🧩 2. Components of DBMS

ComponentDescription
HardwarePhysical devices – computers, storage, servers.
SoftwareDBMS software (e.g., Oracle, MySQL).
DataRaw facts stored in the database.
UsersPeople who use DBMS (DBA, end users, developers).
ProceduresRules and instructions for operating DBMS.

👩‍💻 3. Types of Users in DBMS

User TypeDescription
DBA (Database Administrator)Manages and maintains database systems.
Database DesignersDesign structure of database (schemas).
Application ProgrammersWrite programs to interact with DBMS.
End UsersAccess database using queries or applications.

⚙️ 4. Architecture of DBMS

🔹 Three-Level Architecture (ANSI-SPARC Model)

  1. Internal Level – Physical storage of data.
  2. Conceptual Level – Logical structure of entire database.
  3. External Level – Individual user views.

✅ Goal: Data abstraction — users don’t need to know how data is physically stored.


🧮 5. Data Models

data model describes how data is logically structured and manipulated.

Model TypeDescriptionExample
Hierarchical ModelData organized in tree structure (parent-child).IBM IMS
Network ModelData represented as graph (many-to-many relationships).CODASYL
Relational ModelData stored in tables (rows & columns).MySQL, Oracle
Object-Oriented ModelData represented as objects.OODBMS
Entity-Relationship ModelConceptual model using ER diagrams.Logical design

🧾 6. Relational Model

🔹 Basic Terminology

TermMeaning
RelationA table.
TupleA row or record.
AttributeA column or field.
DomainAllowed values for an attribute.
DegreeNumber of attributes in a relation.
CardinalityNumber of tuples (rows) in a relation.

🔑 7. Keys in DBMS

Keys are used to uniquely identify records in a table.

Key TypeDescription
Primary KeyUnique identifier for each record.
Candidate KeyAttribute(s) that can qualify as a primary key.
Alternate KeyRemaining candidate keys after primary key is chosen.
Foreign KeyAttribute that refers to primary key in another table.
Composite KeyCombination of two or more fields to uniquely identify a record.
Super KeyAny attribute(s) that can uniquely identify a record.

📊 8. Entity-Relationship (ER) Model

🔹 Entities

Objects or concepts that can have data stored about them.
Example: Student, Teacher, Course.

🔹 Attributes

Properties that describe an entity.
Example: Name, Roll_No, Address.

🔹 Relationships

Associations between entities.
Example: Student – Enrolls – in Course.

🔹 Types of Relationships

TypeDescriptionExample
One-to-One (1:1)One entity linked to one of another.Person–Passport
One-to-Many (1:N)One entity linked to many others.Teacher–Students
Many-to-Many (M:N)Many entities linked to many others.Students–Courses

💽 9. Normalization

Normalization is the process of organizing data to reduce redundancy and improve data integrity.

🔹 Normal Forms

FormConditionExample
1NF (First Normal Form)No repeating groups; atomic values only.Split multiple phone numbers into separate rows.
2NF (Second Normal Form)1NF + no partial dependency (non-key depends on part of composite key).
3NF (Third Normal Form)2NF + no transitive dependency (non-key depends only on key).
BCNF (Boyce-Codd Normal Form)Stronger version of 3NF; every determinant is a candidate key.

✅ Goal: Eliminate redundancy, anomalies (update, delete, insert).


🔄 10. Denormalization

The process of combining normalized tables to improve query performance (used in data warehouses).


🧠 11. SQL (Structured Query Language)

SQL is the standard language used to interact with relational databases.


🔸 Categories of SQL Commands

CategoryFull FormExample Commands
DDLData Definition LanguageCREATE, ALTER, DROP, TRUNCATE
DMLData Manipulation LanguageSELECT, INSERT, UPDATE, DELETE
DCLData Control LanguageGRANT, REVOKE
TCLTransaction Control LanguageCOMMIT, ROLLBACK, SAVEPOINT
DQLData Query LanguageSELECT

🔸 Common SQL Commands

CREATE TABLE student (
  roll_no INT PRIMARY KEY,
  name VARCHAR(50),
  marks INT
);

INSERT INTO student VALUES (1, 'Amit', 85);

SELECT * FROM student;

UPDATE student SET marks = 90 WHERE roll_no = 1;

DELETE FROM student WHERE roll_no = 1;

🧮 12. Relational Algebra Operations

OperationSymbolDescription
SELECT (σ)σSelects rows from a relation.
PROJECT (π)πSelects columns from a relation.
UNION (U)Combines tuples from two relations.
SET DIFFERENCETuples in one relation but not the other.
CARTESIAN PRODUCT×Combines all tuples.
JOINCombines related tuples from two relations.

🔁 13. Transactions and Concurrency Control

🔹 Transaction

A transaction is a sequence of database operations that forms a single logical unit of work.

Example: Money transfer (Withdraw + Deposit).

🔹 ACID Properties

PropertyMeaning
AtomicityAll or none of the operations complete.
ConsistencyDatabase remains consistent before and after.
IsolationTransactions execute independently.
DurabilityChanges persist after completion.

🔹 Concurrency Control Techniques

  • Locking (Shared/Exclusive locks)
  • Timestamp ordering
  • Two-Phase Locking (2PL)
  • Deadlock handling

💾 14. Backup and Recovery

TypeDescription
BackupCopy of data used for recovery.
RecoveryProcess of restoring database after failure.

Failures:

  • Transaction failure
  • System crash
  • Disk failure

Recovery Methods:

  • Checkpoints
  • Log-based recovery

🔐 15. Data Security in DBMS

  • Authorization: Controlling access.
  • Encryption: Protecting data via codes.
  • Auditing: Tracking user activities.
  • Backup: Preventing data loss.

🧮 16. Data Independence

TypeDescription
Physical Data IndependenceChange in physical storage doesn’t affect logical structure.
Logical Data IndependenceChange in logical structure doesn’t affect user views.

🗂️ 17. Indexing

Index improves search performance by maintaining a separate structure that stores pointers to records.

Types of Indexes:

  • Primary index
  • Secondary index
  • Clustered / Non-clustered index
  • B+ Tree index (used in RDBMS)

🌐 18. Distributed Database

A distributed database stores data across multiple locations or servers, but appears as a single database to users.

Advantages:

  • Reliability
  • Scalability
  • Faster local access

Challenges:

  • Synchronization
  • Data replication
  • Network dependency

🧠 19. Data Warehousing and Data Mining

ConceptDescription
Data WarehouseCentral repository for historical data used for analysis.
Data MiningProcess of discovering patterns or insights from data.

Techniques: Classification, Clustering, Association Rules, etc.


🚀 20. NoSQL Databases

NoSQL = Not Only SQL
Used for unstructured/big data.

Types:

TypeExample
Document-basedMongoDB
Key-Value StoreRedis
Column-basedCassandra
Graph-basedNeo4j

✅ 21. Important Terms (Quick Revision)

TermMeaning
SchemaStructure of database.
InstanceData at a particular moment.
TupleRow in a table.
AttributeColumn in a table.
DomainSet of possible values.
Integrity ConstraintsRules ensuring data correctness.
ViewVirtual table created using SQL queries.

🏁 Summary Chart

TopicKey Point
DBMSSoftware to manage databases
RDBMSData in tables with relationships
KeysUniquely identify records
NormalizationRemove redundancy
SQLLanguage to manage DB
TransactionACID properties
Data ModelsHierarchical, Network, Relational
Architecture3-level abstraction
SecurityAuthorization, Encryption
Modern DBNoSQL, Cloud DB, Big Data

Leave a Comment

Your email address will not be published. Required fields are marked *