Features of SQL-99 Queries in Hindi
Features of SQL-99 Queries
Table of Contents — SQL:1999 Features (SEO Optimized)
Features of SQL-99 Queries in Hindi
SQL-99 जिसे SQL:1999 भी कहा जाता है, Structured Query Language का एक advanced version है जो relational database systems को और भी ज्यादा powerful और flexible बनाता है। इसमें object-oriented concepts, recursive queries और data integrity features जोड़े गए थे। इस blog में हम Features of SQL-99 Queries in Hindi को step-by-step बहुत आसान भाषा में समझेंगे ताकि beginners भी इसे आसानी से सीख सकें।
1. Common Table Expressions (WITH RECURSIVE)
SQL-99 में एक बहुत ही useful feature introduce किया गया — Common Table Expressions (CTE)। इसे हम temporary result set की तरह use करते हैं जिसे बाद में main query में reference किया जा सकता है। यह code readability बढ़ाता है और complex queries को simplify करता है।
- CTE को
WITHkeyword से define किया जाता है। - Recursive CTEs की मदद से hierarchical data जैसे employee-manager structure को आसानी से fetch किया जा सकता है।
- यह performance को भी बेहतर बनाता है क्योंकि subqueries को बार-बार execute नहीं करना पड़ता।
Example:
WITH RECURSIVE EmployeeHierarchy AS (
SELECT EmployeeID, ManagerID, EmployeeName
FROM Employees
WHERE ManagerID IS NULL
UNION ALL
SELECT e.EmployeeID, e.ManagerID, e.EmployeeName
FROM Employees e
INNER JOIN EmployeeHierarchy eh
ON e.ManagerID = eh.EmployeeID
)
SELECT * FROM EmployeeHierarchy;
2. User-Defined Types (UDTs) और Structured Types
SQL-99 में developers को अपने custom data types बनाने की सुविधा दी गई जिसे User-Defined Types कहते हैं। इससे database में complex data structures को manage करना आसान हो जाता है।
- UDTs को define करके हम data को logically group कर सकते हैं।
- Structured types inheritance support करते हैं यानी एक type दूसरे type की properties को inherit कर सकता है।
- यह object-oriented approach को SQL के अंदर लाने का प्रयास था।
Example:
CREATE TYPE Address AS (
Street VARCHAR(50),
City VARCHAR(30),
ZipCode CHAR(6)
);
3. Object-Relational Features एवं Table Inheritance
SQL-99 में relational और object-oriented दोनों paradigms का combination दिया गया जिसे हम object-relational model कहते हैं। यह feature database design को ज्यादा dynamic और real-world oriented बनाता है।
- Table inheritance की मदद से एक table दूसरे table की structure और behavior को inherit कर सकता है।
- यह feature code reusability बढ़ाता है।
- Complex relationships को model करना आसान हो जाता है।
| Feature | Description |
|---|---|
| Inheritance | Parent table की properties child table में आती हैं। |
| Methods | Table types पर custom methods define किए जा सकते हैं। |
4. Integrity Constraints (Check, Assertions)
SQL-99 में data integrity को मजबूत करने के लिए नए constraints जोड़े गए। इसका उद्देश्य यह सुनिश्चित करना है कि database में डाली जाने वाली जानकारी हमेशा valid और consistent रहे।
- CHECK constraint किसी column के लिए specific condition set करता है।
- ASSERTIONS पूरे database level पर condition enforce करते हैं।
- इससे accidental data entry errors काफी कम हो जाती हैं।
Example:
CREATE ASSERTION salary_check
CHECK (NOT EXISTS (
SELECT * FROM Employees WHERE Salary < 3000
));
5. Triggers एवं Event Handling
SQL-99 में Triggers और Event Handling को standardize किया गया। यह database automation के लिए एक बड़ा कदम था। Trigger एक predefined event के होने पर अपने आप execute हो जाता है जैसे — insert, update या delete।
- Triggers business logic को enforce करने में मदद करते हैं।
- यह auditing और logging के लिए भी उपयोगी होते हैं।
- Event Handling system को reactive बनाता है।
Example:
CREATE TRIGGER salary_update
AFTER UPDATE ON Employees
FOR EACH ROW
BEGIN
INSERT INTO SalaryLog(EmployeeID, OldSalary, NewSalary)
VALUES (OLD.EmployeeID, OLD.Salary, NEW.Salary);
END;
6. Polymorphism और Methods Support
SQL-99 में Polymorphism का concept भी introduce किया गया। इसका मतलब है कि एक ही method अलग-अलग data types के लिए अलग तरह से behave कर सकता है। यह object-oriented programming की तरह flexibility प्रदान करता है।
- Methods को structured types के साथ define किया जा सकता है।
- Overloading और overriding दोनों supported हैं।
- इससे reusability और modularity बढ़ती है।
उदाहरण के लिए, अगर आपके पास "Shape" नाम का type है, तो आप "Area()" method को Circle और Rectangle दोनों के लिए अलग-अलग तरीके से implement कर सकते हैं।
अधिक जानकारी के लिए आप GeeksforGeeks पर भी पढ़ सकते हैं, जो 50+ Domain Authority वाली trusted site है।