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
Assertions in DBMS
Assertion kya hota hai?
DBMS (Database Management System) mein Assertion ek condition ya rule hota hai jo hamesha true (sahi) rehna chahiye database ke data ke liye.
Ye automatic check karta hai ki database mein galat ya rule ke khilaaf data na jaaye.
Socho jaise ek rule-setting alarm hai – agar koi galti se rule todta hai, to system turant uss action ko reject kar deta hai.
Assertions ki zarurat kyun padti hai?
-
Ye data ko correct aur consistent banaye rakhte hain.
-
Galat data ko database mein enter hone se rok dete hain.
-
Ye business rules ko database ke level pe enforce karte hain.
Example Samajho:
Students Table:
StudentID | Name | Department | TotalCredits |
---|---|---|---|
101 | Aditi | CSE | 120 |
102 | Rahul | ECE | 70 |
Rule:
University ka rule hai ki koi bhi student graduate nahi ho sakta jab tak uske paas kam se kam 100 credits na ho.
Is rule ko hum Assertion ke through enforce kar sakte hain.
SQL mein Assertion Create karne ka syntax
CREATE ASSERTION assertion_name
Hamare example main:
CREATE ASSERTION CreditCheck
CHECK (
NOT EXISTS (
SELECT * FROM Students
WHERE TotalCredits < 100
)
);
Iska matlab:
-
Ye check karta hai ki Students table mein kisi bhi student ke credits 100 se kam na ho.
-
Agar koi student <100 credits ke saath add/update hota hai, to DBMS uss operation ko reject kar dega.
Assertion ke Important Points
Feature | Description |
---|---|
Scope | Assertion poore database pe apply hota hai |
Power | Ye multiple rows/tables ke data pe rule laga sakta hai |
Use | Complex business rules ko enforce karne ke liye |
Example | “Har student ke paas ≥ 100 credits hone chahiye” |
Support | Har DBMS mein support nahi hota (e.g. MySQL mein nahi, PostgreSQL mein hota hai) |
Assertions ke Limitations
-
Har DBMS mein support nahi hota (e.g., MySQL X)
-
Complex rule hone par performance slow ho sakti hai
-
Debugging mushkil ho sakta hai agar assertion bada ho
Alternatives agar Assertion support nahi kare:
Agar aapka DBMS CREATE ASSERTION
support nahi karta, to aap ye options use kar sakte ho:
-
Triggers banayein (action ke pehle ya baad check karne ke liye)
-
Check Constraints (agar single row ya table ke liye rule hai)
-
Stored Procedures ke through manual checks lagayein
Summary:
-
-> Assertions aise rules hote hain jo database mein hamesha true rehne chahiye
-
-> Ye rules poore database pe apply hote hain
-
-> Assertions se invalid data enter nahi ho sakta
-
-> Helpful in enforcing important business logic