DBMS
DBMS Part-1
- DBMS Introduction
- DBMS Architecture
- Database Approach vs Traditional File System
- Advantages of DBMS
- Data Models in DBMS
- Schemas in DBMS
- Instances in DBMS
- Data Independence in DBMS
- Database Languages in DBMS
- Interfaces in DBMS
- Structure of DBMS
- Functions of DBA and Designer
- Entities and Attributes in DBMS
- ER Diagram in DBMS
- Generalization, Specialization and Aggregation in DBMS
- Converting ER Diagram to Tables in DBMS
- Difference between Object Oriented, Network and Relational Data Models
DBMS Part-2
- Relational Data Model in DBMS
- Keys in DBMS
- SQL Introduction
- DDL(Data Definition Language)
- DML(Data Manipulation Language)
- Integrity Constraints in DBMS
- Complex SQL Queries
- Joins in DBMS
- Indexing in DBMS
- Triggers in DBMS
- Assertions in DBMS
- Relational Algebra in DBMS
- Tuple Relational Calculus in DBMS
- Domain Relational Calculus in DBMS
DBMS Part-3
- Introduction to Normalization in DBMS
- Normal Forms in DBMS
- Functional Dependency in DBMS
- Decomposition in DBMS
- Dependency Preserving Decomposition in DBMS
- Lossless Join Decomposition in DBMS
- Problems with Null Values and Dangling Tuples
- Multivalued Dependency in DBMS
- Query Optimization in DBMS
- Algorithms for Select, Project and Join Operations in DBMS
- Query Optimization Methods in DBMS
DBMS Part-4
- Transactions in DBMS
- Serializability in DBMS
- Recoverability in DBMS
- Recovery Techniques in DBMS
- Log Based Recovery in DBMS
- Checkpoint in DBMS
- Deadlock in DBMS
- Concurrency Control in DBMS
- Lock Based Protocol in DBMS
- Timestamp Based Protocol in DBMS
- Validation Based Protocol in DBMS
- Multiple Granularity in DBMS
- Multi-Version Concurrency Control(MVCC) in DBMS
- Recovery with Concurrent Transactions in DBMS
DBMS Part-5
Relational Algebra in DBMS
Relational Algebra kya hota hai?
Relational Algebra ek query language hai jo hum databases (tables) se data nikaalne ke liye use karte hain. Yeh batata hai ki kaunsa operation perform karna hai taaki required result mile.
Simple words mein: Relational Algebra ek tareeka hai tables pe operations perform karne ka – jaise filter karna, join karna, columns select karna, etc.
Kya kaam aata hai Relational Algebra?
-
-> SQL (Structured Query Language) ka base hai.
-
-> Query ko mathematically samajhne mein madad karta hai.
-
-> Query optimization mein bhi kaam aata hai.
-
Basic Concept – Table ya Relation
Relational Algebra mein table ko relation bola jata hai.
Example Table: Students
RollNo | Name | Dept |
---|---|---|
1 | Aditi | CSE |
2 | Rahul | ECE |
3 | Neha | CSE |
Relational Algebra ke Operations
Do types ke operations hote hain:
-
Basic Operations (Set-based)
-
Special Relational Operations
1. Select (σ)
Yeh operation rows ko filter karta hai – jaise SQL ka WHERE
.
Example:
CSE
department ke students chahiye:
σ Dept = 'CSE' (Students)
Output:
RollNo | Name | Dept |
---|---|---|
1 | Aditi | CSE |
3 | Neha | CSE |
2. Project (π)
Yeh operation specific columns ko select karta hai – jaise SQL ka SELECT
.
Example:
Sirf students ke naam chahiye:
π Name (Students)
Output:
Name |
---|
Aditi |
Rahul |
Neha |
3. Union (⋃)
Do tables ko combine karta hai – duplicate rows hata ke.
Example:
Students_CSE
RollNo | Name |
---|---|
1 | Aditi |
2 | Raj |
Students_ECE
RollNo | Name |
---|---|
3 | Rahul |
2 | Raj |
Students_CSE ⋃ Students_ECE
Output:
RollNo | Name |
---|---|
1 | Aditi |
2 | Raj |
3 | Rahul |
4. Set Difference (−)
Pehle table mein jo rows hain lekin second table mein nahi, unko return karta hai.
Students_CSE − Students_ECE
Output:
RollNo | Name |
---|---|
1 | Aditi |
5. Cartesian Product (×)
Har row ko doosri table ki har row ke saath combine karta hai.
Example:
Students
RollNo | Name |
---|---|
1 | Aditi |
2 | Rahul |
Courses
C_ID | Course |
---|---|
C1 | DBMS |
C2 | OS |
Students × Courses
Output:
RollNo | Name | C_ID | Course |
---|---|---|---|
1 | Aditi | C1 | DBMS |
1 | Aditi | C2 | OS |
2 | Rahul | C1 | DBMS |
2 | Rahul | C2 | OS |
6. Rename (ρ)
Table ya column ka naam change karne ke liye use hota hai.
ρ NewName (Students)
Join Operations – Tables ko merge karne ke liye
Natural Join (⨝)
Common column ke basis par rows ko join karta hai.
Example:
Students(RollNo, Name, Dept)
Departments(Dept, HOD)
Students ⨝ Departments
Output:
RollNo | Name | Dept | HOD |
---|---|---|---|
1 | Aditi | CSE | Dr. Roy |
2 | Rahul | ECE | Dr. Shah |
3 | Neha | CSE | Dr. Roy |
Quick Summary Table
Operation | Symbol | Kya karta hai? | SQL Equivalent |
---|---|---|---|
Select | σ | Rows filter karta hai | WHERE |
Project | π | Columns choose karta hai | SELECT |
Union | ⋃ | Dono tables ko merge karta hai (duplicates hata ke) | UNION |
Difference | − | Pehle mein hai, doosre mein nahi | MINUS / EXCEPT |
Cartesian Product | × | Har row ko har row se match karta hai | N/A |
Rename | ρ | Table/column ka naam badalta hai | AS |
Natural Join | ⨝ | Common column par join karta hai | JOIN |
Conclusion
-
-> Relational Algebra ek toolset hai jo batata hai ki database pe kaise kaam karna hai.
-
-> Yeh SQL ke peechhe ki logic ko samajhne mein madad karta hai.
-
-> Har serious DBMS learner ko yeh samajhna chahiye, especially agar aap query optimization ya DB theory mein interest rakhte ho.