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
Keys in DBMS
Keys ka use kyun hota hai?
DBMS (Database Management System) mein keys ka use data ko uniquely identify karne aur tables ke beech relation banane ke liye hota hai. Keys se:
-
Hum records ko unique tarike se pehchaan sakte hain
-
Tables ke beech relationship banate hain
-
Duplicate data se bachav hota hai
-
Data consistency maintain hoti hai
Types of Keys in DBMS (Simple Examples ke saath)
1. Primary Key
-
Ye table ka main key hoti hai jo har row ko uniquely identify karti hai.
-
Ye kabhi NULL nahi hoti.
-
Ye unique honi chahiye.
Example:
Student Table
| StudentID | Name | Age |
|---|---|---|
| 101 | Riya | 20 |
| 102 | Aman | 21 |
Yahan par StudentID primary key hai, kyunki ye har student ko unique tarike se pehchaan raha hai.
2. Candidate Key
-
Wo sabhi columns jo kisi record ko uniquely identify kar sakte hain.
-
Inme se ek ko primary key banaya jata hai.
Example:
Employee Table
| EmpID | Phone | |
|---|---|---|
| 1 | raj@gmail.com | 9999988888 |
| 2 | priya@gmail.com | 9999977777 |
EmpID, Email, aur Phone sabhi unique hain → sabhi candidate keys hain.
3. Alternate Key
-
Candidate keys me se jo primary key nahi banti, wo alternate key hoti hai.
Example:
Upar wale example me agar EmpID ko primary key banaya jaye, to Email aur Phone alternate keys ban jati hain.
4. Foreign Key
-
Foreign key ek aisi key hoti hai jo ek table ke primary key ko dusre table me refer karti hai.
-
Iska use tables ke beech connection banane ke liye hota hai.
Example:
Department Table
| DeptID | DeptName |
|---|---|
| 10 | HR |
| 20 | IT |
Employee Table
| EmpID | Name | DeptID |
|---|---|---|
| 1 | Raj | 10 |
| 2 | Priya | 20 |
Yahan Employee Table mein DeptID foreign key hai jo Department Table ke DeptID ko refer kar rahi hai.
5. Super Key
-
Koi bhi column ya columns ka group jo record ko uniquely identify kare → Super Key
-
Sabhi candidate keys super keys hoti hain, lekin sabhi super keys candidate nahi hoti.
Example:
| EmpID | Name | |
|---|---|---|
| 1 | Raj | raj@gmail.com |
Super Keys:
-
{EmpID}
-
{Email}
-
{EmpID, Name} → Super key hai par minimal nahi, isliye candidate nahi.
6. Composite Key
-
Jab 2 ya 2 se zyada columns milke primary key bante hain, to usse composite key kehte hain.
Example:
Enrollment Table
| StudentID | CourseID | Grade |
|---|---|---|
| 101 | DB101 | A |
| 101 | OS102 | B |
| 102 | DB101 | A+ |
Yahan StudentID + CourseID milkar ek unique record identify karte hain → Composite Key
Summary Table
| Key Type | Use / Kaam |
|---|---|
| Primary Key | Table ke har row ko uniquely identify karta hai |
| Candidate Key | Wo sabhi keys jo unique hain (Primary ban sakti hain) |
| Alternate Key | Candidate keys jo primary nahi bani |
| Foreign Key | Ek table ke column ko doosre table ke primary key se jodta hai |
| Super Key | Koi bhi column/group jo uniquely identify kare |
| Composite Key | Multiple columns milke primary key bante hain |