MySQL + SQL · Lesson 93

MySQL Views

View क्या है?

View एक saved query है जो virtual table की तरह व्यवहार करती है। यह खुद data store नहीं करती — हर बार query करने पर underlying tables का live data दिखाती है।

View बनाना

CREATE VIEW toppers AS
SELECT name, marks FROM students WHERE marks >= 90;

-- table की तरह use करें
SELECT * FROM toppers;
हर बार "toppers" query करने पर यह current data पर saved SELECT चलाती है।

Views क्यों Use करें?

  • जटिल joins को एक simple नाम के पीछे छुपाएं।
  • Users को सिर्फ कुछ columns दिखाएं (security)।
  • एक common query हर जगह reuse करें।

View हटाना

DROP VIEW toppers;

सारांश

  • View एक saved query है जो virtual table की तरह काम करती है।
  • यह data store नहीं करती; base tables का live result दिखाती है।
  • Queries सरल करने और access सीमित करने के लिए अच्छी।
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

💻 लाइव कोड एडिटर

इस पेज के प्रोग्राम यहीं तैयार हैं — चलाएँ, बदलें और सीखें। कुछ भी इंस्टॉल किए बिना।
OneCompiler द्वारा संचालित। कोड एडिटर में अपने आप आ जाता है — Run दबाकर आउटपुट देखें। अगर एडिटर न खुले तो नए टैब में खोलें.