Posts

Showing posts from April, 2026

Q.10)

SQL Triggers Kya Hain? Basic Concept: SQL mein Trigger ek special tarah ka stored procedure hota hai jo tab automatically execute (fire) hota hai jab database table mein koi specific event hota hai. Yeh events INSERT , UPDATE , ya DELETE operations ho sakte hain. Triggers ka use data integrity maintain karne, actions ko automate karne, aur bina manual intervention (insani dakhal) ke business rules enforce karne ke liye kiya jata hai. Yeh background mein apne aap chalte hain, isliye banking systems, student management systems aur e-commerce platforms (jahan real-time data change hota hai) mein yeh bahut useful hote hain. Definition & Syntax Trigger ek database object hai jo kisi table par specific DML (Data Manipulation Language) event aane par automatically chal jata hai. Syntax: CREATE TRIGGER trigger_name [BEFORE | AFTER] {INSERT | UPDATE | DELETE} ON table_name FOR EACH ROW BEGIN -- SQL statements yahan aayengi END; Synt...

Q.9)

SQL Triggers Kya Hain? Basic Concept: SQL mein Trigger ek special tarah ka stored procedure hota hai jo tab automatically execute (fire) hota hai jab database table mein koi specific event hota hai. Yeh events INSERT , UPDATE , ya DELETE operations ho sakte hain. Triggers ka use data integrity maintain karne, actions ko automate karne, aur bina manual intervention (insani dakhal) ke business rules enforce karne ke liye kiya jata hai. Yeh background mein apne aap chalte hain, isliye banking systems, student management systems aur e-commerce platforms (jahan real-time data change hota hai) mein yeh bahut useful hote hain. Definition & Syntax Trigger ek database object hai jo kisi table par specific DML (Data Manipulation Language) event aane par automatically chal jata hai. Syntax: CREATE TRIGGER trigger_name [BEFORE | AFTER] {INSERT | UPDATE | DELETE} ON table_name FOR EACH ROW BEGIN -- SQL statements yahan aayengi END; Synt...

Q.8)

SQL Joins Kya Hain? SQL joins relational databases mein alag-alag tables se data ko combine (jodne) karne ke fundamental (sabse zaroori) tools hain. Example: Maan lijiye hamare paas do tables hain. Ek 'Student' table jisme student ki information aur uski ID hai, aur dusri 'Marks' table jisme har student ID ke marks hain. Ab agar humein har student ka naam uske marks ke sath dekhna hai, toh humein in dono tables ko join karna padega. Note: Yaad rakhiye, hum database normalization ke rules ke hisaab se anomalies (gadbadi) aur redundancies (duplicacy) ko avoid karne ke liye data ko multiple tables mein store karte hain. Sample Tables (Examples samajhne ke liye) Joins ko ache se samajhne ke liye hum in do sample tables ka use karenge: Table: Student Roll_No Name 1 Harsh 2 Pratik 3 Riya Table: Course Roll_No Course_ID 1 C1 2 C...

Q.7

Integrity Constraints Kya Hain? Basic Concept: Integrity constraints wo rules (niyam) hote hain jo ek database par lagaye jaate hain taaki data ki correctness (sahi hona), validity (manyata), aur consistency (ek jaisa rehna) ensure ki ja sake. Yeh constraints system mein galat (invalid) data ko enter hone se rokte hain aur tables ke beech ke logical relationships ko maintain karte hain. Major types ke integrity constraints yeh hain: Domain Constraints, Entity Integrity Constraints, Key Constraints, Referential Integrity Constraints, Assertions, aur Triggers. 1. Domain Constraints (Column ke Rules) Explanation: Domain constraints yeh tay karte hain ki ek attribute (column) mein kis tarah ki values store ki ja sakti hain. Yeh ensure karte hain ki jo data enter ho raha hai wo ek valid aur pehle se define kiye gaye 'domain' ka hissa ho (jaise data integer hoga, character hoga, date hoga, ya kisi specific range ka hoga). Isme NOT NULL , CHEC...

Q.6)

1. Conflict Serializability (Takraav ko Handle Karna) Basic Concept: Jab bahut saare transactions ek sath chalte hain (concurrent schedule), toh humein yeh check karna hota hai ki kya unka final result waisa hi hoga jaise ki wo ek-ek karke (serial schedule) chale hote. Conflict serializability yahi check karne ka ek tarika hai. Points ka Explanation: i) Swapping Non-conflicting Operations: Yeh kehta hai ki agar hum un operations (jaise Read/Write) ko aapas mein swap (upar-neeche) karein jo ek dusre se 'conflict' nahi karte, toh kya hum ek serial schedule bana sakte hain? Conflict kab hota hai? Jab 3 baatein sach hon: (1) Dono operations alag-alag transactions ke hon, (2) Dono same data par kaam kar rahe hon (jaise 'A' ki value badalna), aur (3) Unme se kam se kam ek operation 'Write' (kuch change karna) ho. (Jaise: Read-Write, Write-Read, ya Write-Write conflict). ii) Conflict Equivalence & Preceden...

Q.5)

 Define deadlock in DBMS. How can deadlocks be detected and resolved? Explain with an example. Deadlock Kya Hai? (What is Deadlock?) Deadlock DBMS mein ek aisi situation (paristhiti) hoti hai jahan do ya usse zyada transactions hamesha ke liye block (atak) ho jate hain. Aisa isliye hota hai kyunki har transaction ne kam se kam ek resource (jaise koi table ya data) ko pakad rakha (lock kar rakha) hota hai, aur wo kisi dusre resource ka wait kar raha hota hai jise kisi aur transaction ne lock kiya hua hai. Kyunki saare transactions ek circular (gol) tarike se ek dusre ka wait kar rahe hote hain, unme se koi bhi aage nahi badh pata aur poora system wahin atak jata hai (stuck ho jata hai). Kahan hota hai ye? Deadlock aamtaur par multi-user database systems mein hota hai jahan bahut saare transactions ek sath chalte hain aur shared resources (jaise data items, tables, ya locks) ke liye aapas mein compete karte hain. Deadlock Ki Conditions (Conditions for Deadlock) Deadlock sirf tabhi h...

Q.4)

 What are ACID properties in DBMS? Explain each property with an example. ACID Properties Kya Hain? ACID properties DBMS (Database Management System) mein rules ka ek fundamental set hain. Yeh rules yeh ensure karte hain ki transactions safe, reliable (bharosemand), aur consistent tarike se process hon. Transaction kya hota hai? Transaction ka matlab hai database operations (jaise insert, update, delete) ka ek group jo ek single logical unit ki tarah ek sath execute hota hai. Yeh properties banking, online shopping, ticket booking, aur financial applications jaise systems mein bahut zaroori hain. Aise systems mein ek choti si galti bhi serious data inconsistency (gadbadi) ya loss (nuksan) ka kaaran ban sakti hai. ACID ka full form hai: A tomicity, C onsistency, I solation, aur D urability. Har property database system ki integrity (sacchai) aur reliability maintain karne mein ek bahut important role play karti hai. 1. Atomicity (Sab Kuch ya Kuch Nahi) Atomicity ka matlab hai ki e...

Q.3)

Image
 Describe any five operations of relational algebra along with suitable examples. Relational Algebra mein Operators Relational algebra mein kai basic operators hote hain jo humein database ki relational tables se data fetch aur manipulate karne mein madad karte hain, taaki relational data par kuch specific operations perform kiye ja sakein. Basic operators fundamental operations hote hain jisme selection (σ), projection (π), union (U), set difference (-), Cartesian product (×), aur rename (ρ) shamil hain. [Diagram: Relational Algebra mein Operators ke Types] Basic Operators → Cartesian Product (×), Select (σ), Union (U), Set Difference (-), Rename (ρ), Project (π) Derived Operators → Division (÷), Intersection (∩), Join Join → Inner, Outer Inner → Equi, Conditional (θ), Natural (⋈) 1. Selection (σ) Selection sirf un rows (tuples) ko relation se retrieve karta hai jo di gayi condition ko satisfy karti hain. Yeh ek predicate ke base par horizontal filtering perform karta hai. Yeh...

Q.2)

Image
  Illustrate and explain the complete architecture of a DBMS system in detail. Database Architecture Database Architecture DBMS ke internal components ko refer karta hai, jisme Query Processor, Storage Manager, aur Disk Storage shamil hain. Yeh in components ke beech ke interaction ko bhi define karta hai. Components of a Database System Database system mainly Query Processor, Storage Manager, aur Disk Storage mein divided hota hai. Inhe neeche detail mein explain kiya gaya hai. System Diagram Overview (Diagram Labels) DBA → Database Schema → DDL Compiler Users → Queries → Query Processor Application Programs → Application Programs → DML Compiler DBMS (dashed box) ke andar hota hai: Data Dictionary Manager Query Optimizer Scheduler Recovery Manager Authorization Control Command Processor Transaction Manager Buffer Manager Database Manager Integrity Checker Data Manager (Yeh sab Data Files aur Data Dictionary se connected hote hain). 1. Query Processor Yeh end-user se application...

Q.1)

Q1) What is normalization in databases? Why is it important? Describe the normal forms (1NF, 2NF, 3NF, 4NF, and BCNF) with appropriate examples. Normalization Normalization ek systematic process hai jisme database ke data ko organize kiya jata hai taaki redundancy (duplicacy) eliminate ho aur data integrity ensure ho sake. Yeh badi tables ko smaller, well-structured tables mein divide karta hai aur unke beech relationships establish karta hai. Yeh ensure karta hai ki har table ek single concept ko represent kare, jisse insert, update aur delete operations ke dauran aane wali anomalies (errors) kam ho jayein. Yeh repetitive data ko minimize karke aur logical data grouping ensure karke query efficiency ko improve karta hai. Yeh consistency maintain karne mein madad karta hai by ensuring ki har attribute sirf key, puri key, aur kuch nahi balki sirf key par depend kare. Yeh storage wastage ko reduce karta hai aur relational databases mein optimal performance ensure karta hai. Yeh database ...