Related Topics

Related Subjects

Views in SQL in Hindi

RGPV University / DIPLOMA_CSE / DBMS

Views in SQL in Hindi

What is View in SQL?

View एक **virtual table** होती है, जो एक या एक से अधिक tables से data को fetch करती है। View खुद में कोई data store नहीं करती, बल्कि ये एक saved SQL query होती है। जब हम view को call करते हैं, तो वह query run होती है और उसका result show होता है।

Key Points about SQL View

  • View का structure बिलकुल table जैसा होता है लेकिन इसमें data physically store नहीं होता।
  • यह एक query के result को नाम देकर use करने की सुविधा देती है।
  • View को हम SELECT, JOIN, WHERE जैसी queries से define कर सकते हैं।
  • View को बार-बार use करके complex queries को simple बनाया जा सकता है।
  • Views को हम other views के अंदर भी use कर सकते हैं।

Why use Views in SQL?

  • Data को simplify करने और presentation को बेहतर बनाने के लिए।
  • Complex queries को बार-बार न लिखना पड़े इसके लिए।
  • Security purpose के लिए — user को सिर्फ specific data दिखाने के लिए।
  • Reusable logic create करने के लिए जिससे application की performance improve हो।

Syntax of Creating a View

CREATE VIEW view_name AS SELECT column1, column2 FROM table_name WHERE condition;

Example of SQL View

मान लीजिए हमारे पास एक employee table है:
emp_idnamesalarydepartment
1Ravi50000IT
2Neha60000HR
3Amit55000IT
अब हम एक view बनाएंगे जो सिर्फ IT department के employees को दिखाए: CREATE VIEW it_employees AS SELECT name, salary FROM employee WHERE department = 'IT';

How to Use/View the Data from a View

SELECT * FROM it_employees; यह query run करते ही, सिर्फ IT department के employee का data return होगा।

Can we update data using View?

हाँ, अगर view simple है (single table से बना है और कोई aggregate function या GROUP BY नहीं है) तो हम view के through update, insert, delete operations कर सकते हैं। लेकिन complex views में ये संभव नहीं होता।

Important Notes for Students

  • View एक reusable SQL query होती है, जिससे आपका code modular बनता है।
  • View से आप data access को control कर सकते हैं (security के लिए helpful)।
  • हर बार complex query न लिखकर, view का नाम use करके output लिया जा सकता है।
  • View का data real-time होता है — जैसे ही base table का data change होता है, view का output भी बदल जाता है।

Real World Uses of Views

  • Dashboard में specific data दिखाने के लिए।
  • Reports बनाने के लिए जहां summarized या filtered data चाहिए।
  • Users को restricted data access देने के लिए — जैसे सिर्फ उनके region का data।
  • Code को modular और maintainable रखने के लिए।

Types of Views in Hindi

Overview of View Types in SQL

SQL में Views के अलग-अलग प्रकार होते हैं, जिनका उपयोग अलग-अलग scenarios में किया जाता है। हर प्रकार का view किसी खास उद्देश्य को पूरा करने के लिए design किया जाता है। Student को इन सभी views के types का deep understanding होना बहुत ज़रूरी है ताकि वो real-world applications में सही तरीके से इनका use कर सके।

1. Simple View

Simple View एक ऐसा view होता है जो सिर्फ एक single table पर based होता है। इसमें joins, group by, aggregation जैसे complex operations नहीं होते।
  • यह केवल table की कुछ specific columns को show करता है।
  • इसमें data को आसानी से insert, update, और delete किया जा सकता है।
  • Simple views performance के लिए बेहतर होते हैं और beginners के लिए ideal हैं।

Example of Simple View

CREATE VIEW emp_simple_view AS SELECT emp_id, name FROM employee;

2. Complex View

Complex View एक ऐसा view होता है जिसमें multiple tables होते हैं या aggregation, joins, group by जैसे operations शामिल होते हैं।
  • यह अलग-अलग tables से combined data दिखा सकता है।
  • Complex view को update या insert करना कठिन होता है या कभी-कभी संभव नहीं होता।
  • यह mainly reports, dashboards और data analysis के लिए use किया जाता है।

Example of Complex View

CREATE VIEW emp_dept_view AS SELECT e.name, d.department_name FROM employee e JOIN department d ON e.dept_id = d.dept_id;

3. Materialized View

Materialized View एक ऐसा view होता है जो data को **physically store** करता है। जब हम view को बनाते हैं, तब query execute होकर उसका result database में save हो जाता है।
  • यह fast performance देता है क्योंकि बार-बार query execute नहीं होती।
  • यह read-heavy systems के लिए best होता है जैसे data warehouse या reporting systems।
  • इस view को समय-समय पर refresh किया जाता है ताकि data updated रहे।

Note:

Materialized View सभी SQL databases में उपलब्ध नहीं होता। यह Oracle, PostgreSQL जैसे databases में available होता है।

Example of Materialized View (PostgreSQL Syntax)

CREATE MATERIALIZED VIEW emp_summary AS SELECT dept_id, COUNT(*) as total_employees FROM employee GROUP BY dept_id;

4. Inline View

Inline View एक temporary view होता है जो SQL query के अंदर ही लिखा जाता है। यह किसी नाम से save नहीं होता और सिर्फ उसी query तक सीमित रहता है।
  • यह subquery की तरह ही use होता है लेकिन उसे एक virtual table की तरह treat किया जाता है।
  • Inline views complex queries को logically simplify करने में मदद करते हैं।

Example of Inline View

SELECT * FROM ( SELECT emp_id, name FROM employee ) AS temp_emp;

5. Read-only View

कुछ views को ऐसा बनाया जाता है कि उनमें सिर्फ data देखा जा सकता है, update या insert नहीं किया जा सकता। इन्हें हम **read-only views** कहते हैं।
  • यह security और data integrity के लिए useful होते हैं।
  • Complex views जैसे joins या aggregation वाले views default रूप से read-only ही होते हैं।

6. Updatable View

Updatable View वो होता है जिसमें हम data को update, insert, या delete कर सकते हैं। लेकिन इसके लिए कुछ conditions होती हैं:
  • View सिर्फ एक table पर आधारित होना चाहिए।
  • View में aggregate functions या joins नहीं होने चाहिए।
  • View में NOT NULL columns को जरूर include करना चाहिए।

Important Table for Quick Revision

View Type Based On Updatable Used For
Simple View Single Table Yes Basic Access
Complex View Multiple Tables No Reports, Joins
Materialized View Saved Query Result No Performance
Inline View Subquery No Temporary Use
Read-only View Any No Data Protection
Updatable View Single Table Yes (with conditions) Data Editing

Creating Views in Hindi

What is Creating a View in SQL?

जब हम SQL में किसी View को बनाते हैं, तो हम एक **virtual table** create कर रहे होते हैं जो कि किसी existing SQL query के result को represent करता है। View create करने का मतलब है — एक ऐसा तरीका बनाना जिससे हम बार-बार उसी query को आसान तरीके से access कर सकें।

Why Create a View?

  • बार-बार लिखी जाने वाली complex query को shortcut की तरह उपयोग करना।
  • Data को logically अलग-अलग हिस्सों में divide करना ताकि user को organized तरीके से information मिले।
  • Sensitive data को hide करना और केवल जरूरी columns या rows दिखाना।
  • Code को readable, manageable और maintainable बनाना।

Syntax for Creating a View

View create करने के लिए हम नीचे दिए गए SQL syntax का उपयोग करते हैं: CREATE VIEW view_name AS SELECT column1, column2 FROM table_name WHERE condition;

Step-by-Step समझिए — View कैसे बनाते हैं?

**Step 1:** सबसे पहले हमें यह decide करना होता है कि हमें किस table या किन tables से data चाहिए। **Step 2:** फिर हम एक SELECT query लिखते हैं, जो वही data return करती है। **Step 3:** अब उस SELECT query को एक नाम देकर VIEW के रूप में save करते हैं।

Example: Creating a View in SQL

मान लीजिए हमारे पास एक `employee` नाम की table है:
emp_idnamesalarydepartment
1Ravi50000IT
2Neha60000HR
3Amit55000IT
अब हम एक view बनाएंगे जो सिर्फ IT department के employees को दिखाए: CREATE VIEW it_employees_view AS SELECT emp_id, name, salary FROM employee WHERE department = 'IT';

View Create करने के बाद उसे कैसे देखें?

View से data देखने के लिए बिल्कुल उसी तरह से SELECT query लिखते हैं जैसे किसी table के लिए लिखते हैं: SELECT * FROM it_employees_view;

Can We Create View from Multiple Tables?

हाँ, आप एक से ज़्यादा tables को JOIN करके भी view बना सकते हैं। यह especially useful होता है जब हमें relational data को एक ही जगह दिखाना हो।

Example: Creating View from Multiple Tables

मान लीजिए हमारे पास दो tables हैं: `employee` और `department` हम इन दोनों को join करके एक view बनाएंगे: CREATE VIEW emp_dept_info AS SELECT e.name, e.salary, d.department_name FROM employee e JOIN department d ON e.dept_id = d.dept_id;

Important Points to Remember While Creating View

  • View का नाम meaningful होना चाहिए ताकि उसका उद्देश्य clear रहे।
  • View के अंदर की SELECT query अच्छी तरह से optimized होनी चाहिए ताकि performance ठीक रहे।
  • View खुद कोई data store नहीं करता — ये सिर्फ एक virtual representation है।
  • View से जुड़ा data हमेशा base tables से आता है।
  • View को हम बाद में modify या delete भी कर सकते हैं।

Quick Revision Table

Feature Description
Purpose Query को reuse करना और complex logic को simplify करना
Syntax CREATE VIEW view_name AS SELECT ...
Data Storage View खुद कोई data store नहीं करता
Base One or more tables पर आधारित होता है
Access View को table की तरह access किया जाता है

Modifying Views in Hindi

What is Modifying a View in SQL?

SQL में **view** create करने के बाद, कभी-कभी हमें उसे modify भी करना पड़ता है। Modifying a view का मतलब है — किसी existing view को update करना, ताकि उसमें नया data या structure reflect हो सके। जब हम एक view modify करते हैं, तो हम उसकी underlying **SELECT query** को बदलते हैं या उसमें कुछ नया add करते हैं।

Why Modify a View?

  • अगर original data structure में बदलाव हुआ हो और हमें view के result को update करने की ज़रूरत हो।
  • अगर view में ज्यादा data show हो रहा हो और हमें उसे refine करने की जरूरत हो।
  • View में unnecessary columns को हटाना और जरूरी columns को add करना।
  • Optimized query लिखने के लिए view को improve करना।

Syntax for Modifying a View

SQL में view को modify करने के लिए हम `CREATE OR REPLACE VIEW` statement का use करते हैं। यह statement existing view को update कर देता है। CREATE OR REPLACE VIEW view_name AS SELECT column1, column2 FROM table_name WHERE condition;

How to Modify a View Step-by-Step?

**Step 1:** सबसे पहले आपको यह decide करना होगा कि किस view को modify करना है। **Step 2:** फिर उस view की current structure को check करें और यह decide करें कि कौन से changes चाहिए। **Step 3:** फिर `CREATE OR REPLACE VIEW` statement से view को modify करें।

Example: Modifying a View

मान लीजिए हमारे पास पहले से एक view है जिसका नाम `it_employees_view` है, जो सिर्फ IT department के employees को दिखाता है। अब हम इसे modify करेंगे ताकि वह department name भी show करे। Original view: CREATE VIEW it_employees_view AS SELECT emp_id, name, salary FROM employee WHERE department = 'IT'; Modified view: CREATE OR REPLACE VIEW it_employees_view AS SELECT emp_id, name, salary, department FROM employee WHERE department = 'IT';

Important Things to Remember While Modifying Views

  • **CREATE OR REPLACE VIEW** का use करने से existing view replace हो जाता है, इसलिए ध्यान से use करें।
  • View को modify करते समय ध्यान रखें कि नए changes query को सही और efficient तरीके से optimize करें।
  • Modification के बाद, view में कोई data change नहीं होगा, यह केवल structure और query को update करता है।
  • View में जो columns show हो रहे हैं, वह base table की current structure के अनुसार reflect होते हैं।
  • Modify किए गए view को फिर से query करके देख सकते हैं।

Can We Modify Views Created from Multiple Tables?

हाँ, जब view multiple tables से create किया गया हो, तो उसे modify भी किया जा सकता है। आप additional join conditions या filtering conditions add करके उसे modify कर सकते हैं। Example: CREATE OR REPLACE VIEW emp_dept_info AS SELECT e.name, e.salary, d.department_name, d.location FROM employee e JOIN department d ON e.dept_id = d.dept_id;

Quick Summary Table for Modifying Views

Action Description
Syntax CREATE OR REPLACE VIEW view_name AS SELECT ...
Modifies View's SELECT query, not the actual data
Base Tables View reflects changes made in the base tables
Replaces Existing View Yes, with the new query structure

Dropping Views in Hindi

What is Dropping a View in SQL?

SQL में जब हमें किसी **view** की अब कोई जरूरत नहीं होती या हम उसे हटाना चाहते हैं, तब हम उसे **drop** करते हैं। Dropping a view का मतलब होता है उसे permanently database से remove कर देना। यह बिल्कुल वैसे ही होता है जैसे आप किसी file को delete करते हैं ताकि वह future में use न हो सके।

Why Drop a View?

  • अगर view अब outdated हो चुका है और उसकी SELECT query अब काम की नहीं रही।
  • जब base table के structure में बदलाव हुआ हो और view error देने लगे।
  • Database को clean और optimized रखने के लिए पुराने views को delete करना जरूरी होता है।
  • Unnecessary views को हटाकर हम database performance को बेहतर बना सकते हैं।

Syntax for Dropping a View

View को हटाने के लिए SQL में हम `DROP VIEW` command का use करते हैं। इससे वो view database से हमेशा के लिए delete हो जाता है। DROP VIEW view_name;

Example: Dropping a View

मान लीजिए हमने पहले एक view बनाया था `high_salary_employees` के नाम से, और अब हमें उसे delete करना है। DROP VIEW high_salary_employees; इस command को चलते ही वो view database से पूरी तरह remove हो जाएगा।

What Happens After Dropping a View?

  • View database से हमेशा के लिए delete हो जाता है।
  • अगर कोई user या application उस view को use कर रहा हो, तो error आने लगेगा।
  • View के हटने के बाद उसका structure, query, और data memory से भी हट जाता है।

Important Points While Dropping a View

  • हमेशा verify कर लें कि जो view आप delete कर रहे हैं वो कहीं और use नहीं हो रहा।
  • Production database में view delete करते वक्त ध्यान दें क्योंकि इससे system में bugs आ सकते हैं।
  • View को drop करने से base table या actual data पर कोई effect नहीं होता।

DROP VIEW IF EXISTS - Safe Dropping

अगर आप unsure हैं कि view exists करता है या नहीं, तो आप safer तरीका use कर सकते हैं — `DROP VIEW IF EXISTS` जिससे error नहीं आता अगर view पहले से न हो। DROP VIEW IF EXISTS view_name; Example: DROP VIEW IF EXISTS high_salary_employees;

Quick Summary Table for Dropping Views

Action Description
Syntax DROP VIEW view_name;
Permanent? हाँ, यह view को पूरी तरह delete कर देता है
Data Loss View का data नहीं रहता, लेकिन base table का data safe रहता है
Error Handling IF EXISTS इस्तेमाल करके error से बच सकते हैं

Advantages of Views in Hindi

What are the Advantages of Views?

जब हम SQL में किसी complex query को बार-बार चलाने की बजाय उसे एक virtual table के रूप में बना लेते हैं, तो उसे **View** कहा जाता है। View का सबसे बड़ा फायदा यह है कि यह base table के data को बिना duplicate किए हमें desired result देता है, और इसके कई practical benefits हैं।

Key Benefits of Using Views in SQL

अब आइए एक-एक करके समझते हैं कि SQL में View के क्या-क्या फायदे होते हैं। हर point को आसान भाषा में समझाया गया है ताकि कोई भी student confusion न हो:
  • Data Abstraction Provide करता है:
    View यूज़र्स को सिर्फ वो data दिखाता है जो जरूरी होता है। जैसे अगर किसी user को employee के सिर्फ name और salary देखने हैं, तो हम एक ऐसा View बना सकते हैं जिसमें बाकी columns hide रहें। इससे data secure भी रहता है और logic भी clear होता है।
  • Security Enhance करता है:
    View एक बहुत अच्छा तरीका है sensitive data को छुपाने का। आप user को View provide कर सकते हैं, लेकिन base table तक access नहीं देंगे। इससे unauthorized users को critical data (जैसे salary, password) दिखेगा ही नहीं।
  • Complex Queries Simplify करता है:
    मान लीजिए आपको एक बहुत बड़ी और complex query बार-बार चलानी होती है। उस पूरी query को एक बार View में बना लो, और फिर हर बार सिर्फ View को SELECT करो। इससे आपका काम आसान हो जाता है और error भी कम होते हैं।
  • Reusability बढ़ाता है:
    एक बार View create करने के बाद आप उसे कहीं भी use कर सकते हैं — जैसे reports में, applications में, या दूसरे queries में। इससे बार-बार same logic को लिखने की ज़रूरत नहीं होती।
  • Logical Separation Provide करता है:
    View आपको actual data और presentation के बीच एक layer देता है। इससे आपके programs loosely coupled रहते हैं। अगर table में कोई change होता है, तो View को update करके application को as-it-is चलाया जा सकता है।
  • Memory Efficient होता है:
    View एक virtual table होता है, यानी ये actual data store नहीं करता, बल्कि base table पर depend करता है। इससे storage की बचत होती है और performance भी बेहतर रहती है।
  • Maintainability आसान हो जाती है:
    जब कई queries same logic पर आधारित होती हैं, तो उन्हें manage करना मुश्किल होता है। एक View के ज़रिए centralized logic बनाकर आप maintenance को आसान बना सकते हैं।
  • Derived Columns या Calculated Fields दिखा सकते हैं:
    View में आप ऐसे columns दिखा सकते हैं जो original table में नहीं होते, जैसे — bonus = salary * 0.10 यह feature बहुत useful होता है customized reports या dashboards के लिए।

Table: Summary of Advantages of Views

Advantage Explanation (in Hindi)
Data Abstraction User को केवल जरूरी data दिखाता है
Security Sensitive data से protection देता है
Reusability View को बार-बार इस्तेमाल किया जा सकता है
Simplified Queries Complex queries को आसान बनाता है
Performance Memory efficient और fast होता है
Maintainability Logic centralized होने से manage करना आसान होता है

Important Note for Students

  • अगर आप software development कर रहे हैं, तो View आपको business logic और database structure को अलग रखने में मदद करेगा।
  • Exam में अक्सर पूछा जाता है — "What are the advantages of Views?" तो ऊपर दिए गए points को अच्छे से याद रखो।
  • Practice करो कि real-life examples में कैसे View आपको काम आसान करने में मदद कर सकता है।

Disadvantages of Views in Hindi

What are the Disadvantages of Views?

जैसे हर चीज़ के अपने फायदे होते हैं, वैसे ही SQL Views के कुछ limitations भी होते हैं। Views देखने में तो बहुत आसान और helpful होते हैं, लेकिन जब हम इनका deep implementation करते हैं, तो हमें कुछ practical समस्याएं नज़र आती हैं जिन्हें समझना बहुत ज़रूरी है, खासकर students और developers के लिए।

Limitations or Drawbacks of Using Views in SQL

नीचे हमने views के मुख्य नुकसान या limitations को बहुत सरल और उदाहरण सहित समझाया है, ताकि study के दौरान या interview में आपको confusion न हो:
  • Performance Issues हो सकते हैं:
    चूंकि View एक virtual table होता है और हर बार execute होने पर यह base table से data fetch करता है, इसलिए complex views performance को slow कर सकते हैं। खासकर जब View में multiple joins हों या subqueries हों।
  • Updatable नहीं होते हर स्थिति में:
    हर View को आप update नहीं कर सकते। जैसे अगर View में join या group by, aggregate function (SUM, AVG आदि) हो, तो उस View में data को update या insert करना possible नहीं होता।
  • Dependency बढ़ जाती है:
    अगर View base table पर depend करता है और उस table की structure change कर दी जाती है (जैसे column delete किया जाए), तो View automatically invalid हो सकता है। इससे runtime errors आने की संभावना बढ़ जाती है।
  • Complex Views को Maintain करना मुश्किल होता है:
    अगर View बहुत complex logic के साथ बनाया गया है और उसमें कई nested views या sub-views हैं, तो future में उसे समझना और maintain करना developer के लिए एक headache बन सकता है।
  • Indexes Directly Use नहीं हो सकते:
    View खुद कोई index create नहीं करता। इसलिए अगर आप query को optimize करने के लिए index का सहारा लेना चाहते हैं, तो View में ये directly possible नहीं होता। यह भी एक performance limitation है।
  • Triggers View पर Apply नहीं हो सकते:
    आप views पर directly trigger apply नहीं कर सकते, जबकि base tables पर यह सुविधा होती है। इसका मतलब है कि View पर changes को auto-handle करने के लिए आपको दूसरे तरीके ढूंढ़ने होंगे।

Table: Disadvantages of Views in SQL

Limitation Explanation (in Hindi)
Performance Issue हर बार View को run करने पर base table से data लाना पड़ता है जिससे system slow हो सकता है
Not Always Updatable हर View को update या insert नहीं किया जा सकता
Dependency Base table में changes से View invalid हो सकता है
Maintainability Complex views को manage करना मुश्किल होता है
No Index Views पर direct indexing possible नहीं होती
No Triggers View पर direct trigger नहीं लगाए जा सकते

Important Tip for Students

  • Exam में अक्सर ये पूछा जाता है कि View के क्या limitations हैं। तो ऊपर दिए गए points को logically समझकर याद करें।
  • Interview में practical example पूछा जा सकता है, जैसे — "क्या हर View update किया जा सकता है?" — तो वहाँ real-life condition बताएं।
  • View को use करते वक्त हमेशा उसके limitation को ध्यान में रखें ताकि future में कोई error या performance issue न आए।

Examples of Views in SQL in Hindi

Introduction to Examples of Views

अब हम बात करेंगे SQL Views के practical examples की। View को समझने का सबसे अच्छा तरीका है कि हम real-world examples देखें, ताकि concept crystal clear हो जाए। यह section खासतौर पर students के लिए तैयार किया गया है, ताकि exam और interview दोनों में मदद मिले।

Example 1: Simple View for Employee Data

मान लीजिए हमारे पास एक Employee नाम की table है जिसमें बहुत सारा data है। हमें केवल कुछ specific columns को access करने के लिए एक view बनाना है। CREATE VIEW EmployeeInfo AS SELECT EmployeeID, FirstName, LastName, Department FROM Employees; 👉 यह View केवल तीन columns दिखाएगा: EmployeeID, FirstName, LastName और Department। इससे non-technical user को simplified data access मिलेगा।

Example 2: View with WHERE Clause

अगर हमें केवल उन Employees की list चाहिए जो "IT" department से belong करते हैं, तो हम View को filter भी कर सकते हैं। CREATE VIEW IT_Employees AS SELECT EmployeeID, FirstName, LastName FROM Employees WHERE Department = 'IT'; 👉 अब यह View केवल वही employees दिखाएगा जो IT department में हैं। यह technique reporting में बहुत useful होती है।

Example 3: View with JOIN

कई बार हमें दो या ज़्यादा tables को जोड़कर एक View बनाना होता है। मान लीजिए हमारे पास दो tables हैं — Employees और Departments। CREATE VIEW EmployeeDepartment AS SELECT E.EmployeeID, E.FirstName, D.DepartmentName FROM Employees E JOIN Departments D ON E.DepartmentID = D.DepartmentID; 👉 इस View से हमें employee का नाम और उनका department name एक साथ मिल जाएगा। यह business reports के लिए बहुत उपयोगी होता है।

Example 4: View with Aggregation (SUM, AVG)

अगर हमें department-wise average salary निकालनी हो, तो हम aggregate functions के साथ View बना सकते हैं। CREATE VIEW AvgSalaryByDept AS SELECT DepartmentID, AVG(Salary) AS AverageSalary FROM Employees GROUP BY DepartmentID; 👉 अब आप जब भी इस View को call करेंगे, आपको हर department की average salary दिखेगी।

Example 5: Updating Data using View

कुछ simple views के ज़रिए आप data को update भी कर सकते हैं। पर ध्यान रखें — complex views में ये हमेशा possible नहीं होता। -- मान लीजिए हमने ये View बनाया है CREATE VIEW SimpleEmployee AS SELECT EmployeeID, FirstName, Salary FROM Employees; -- अब हम View के ज़रिए update कर सकते हैं UPDATE SimpleEmployee SET Salary = Salary + 1000 WHERE EmployeeID = 101; 👉 यह update base table में directly reflect होगा। लेकिन अगर View में join या group by होता तो update possible नहीं होता।

Table: Summary of View Examples

Example Explanation
Simple View Selected columns को अलग से देखने के लिए
WHERE Clause Filtered data के लिए
JOIN View Multiple tables को जोड़कर result दिखाना
Aggregation View SUM या AVG जैसे functions के साथ
Update via View View के ज़रिए data update करना

Tips for Students

  • Exam में अक्सर पूछते हैं – “एक View कैसे create करें?” — तो एक practical example ज़रूर याद रखें।
  • Interview में aggregation या join के साथ View पूछे जाते हैं — इसलिए उनके example clear रखें।
  • Always remember — View एक virtual table है, जिससे आप data को logically present कर सकते हैं, बिना actual data को change किए।

FAQs

View एक virtual table होती है जो SQL query के result को represent करती है। इसमें original table का actual data नहीं होता, लेकिन यह हमें एक simplified और customized data structure access करने की सुविधा देती है।
हाँ, लेकिन केवल तब जब View simple हो और उसमें कोई JOIN, GROUP BY, या Aggregation ना हो। ऐसे View के ज़रिए हम base table में directly update कर सकते हैं।
View create करने के लिए हम CREATE VIEW statement का use करते हैं। Example: CREATE VIEW ViewName AS SELECT column1, column2 FROM TableName;
हाँ, हम View में JOIN statements का use करके multiple tables का data merge करके दिखा सकते हैं। इससे combined information एक ही View में देखी जा सकती है।
Views से data security बढ़ती है, complex queries simplified हो जाती हैं, और data access control maintain करना आसान होता है। यह user को unnecessary data access करने से भी रोकता है।
हाँ, View को delete करने के लिए DROP VIEW command का उपयोग किया जाता है। Example: DROP VIEW ViewName;

Please Give Us Feedback