DBMS Architecture & Basics
Yeh topic DBMS ka foundation hai. Yeh batata hai ki DBMS parde ke peeche kaam kaise karta hai aur iski zaroorat hi kyun padi.
Three-Level Architecture (ANSI-SPARC)
Iska main maksad hai Data Independence achieve karna. Iske 3 levels hote hain:
- Physical/Internal Level: Sabse low-level. Yeh batata hai ki data actually hard disk par kaise store ho raha hai (e.g., files, B-Trees).
- Logical/Conceptual Level: "Beech" ka level. Yeh poore database ka structure define karta hai - kaun se tables honge, unme kya columns honge, aur unke beech me kya relationships honge.
- View/External Level: Sabse high-level, jo end-user ko dikhta hai. Har user ko database ka sirf utna hi hissa (view) dikhaya jaata hai jitna uske kaam ka hai.
DBMS vs. File Processing System
DBMS, traditional file system se kai maamlon me behtar hai:
- Data Redundancy & Inconsistency: DBMS me normalization se duplicate data kam hota hai, jabki file system me data alag-alag files me copy hota hai jisse inconsistency aati hai.
- Data Access: DBMS me
SQLjaisi powerful languages se data access karna aasan hai. File system me complex program likhne padte hain. - Security & Integrity: DBMS me user access control aur data par rules (constraints) lagana aasan hai.
- Concurrency Control: DBMS multiple users ko ek saath safely kaam karne deta hai (ACID properties). File system me yeh bahut mushkil hai.
Types of Keys
- Super Key: Ek ya ek se zyada columns ka set jo ek row ko uniquely identify kare.
- Candidate Key: Ek minimal Super Key (jisme se koi attribute hata na sakein).
- Primary Key: Wo Candidate Key jisko DBA table ka main key chunta hai. Yeh
NOT NULLaurUNIQUEhona chahiye. - Foreign Key: Ek table ka column jo doosre table ki Primary Key ko refer karta hai, jisse do tables ke beech me link banta hai.
- Alternate Key: Wo Candidate Keys jo Primary Key nahi banin.