Drop View In MySQL In Hindi

📔 : MySQL 🔗

अभी तक आपने View को create और use करना सीखा , इस topic में सीखेंगे कि view को drop / delete कैसे करते हैं।

MySQL DROP VIEW

Well , MySQL में किसी existing view को drop करने के लिए DROP VIEW statement का use किया जाता है। जिसका syntax कुछ इस तरह से होता है।

DROP VIEW view_name;

DROP VIEW के बाद आपको बस view का नाम देना है जिसे आप drop करना चाहते हैं।

MySQL Drop Multiple Views

हालाँकि आप एक साथ comma separated कई views का name भी दे सकते हैं हैं , जैसे -

DROP VIEW view1, view2, view3;
Check View before delete

view drop करने से पहले अच्छा होगा कि आप check कर लें कि exist है या नहीं , otherwise error आएगी। drop करते समय check करने के लिए आप IF EXISTS का use कर सकते हैं।

DROP VIEW IF EXISTS myview; or DROP VIEW IF EXISTS myview1, myview2, myview3;

MySQL List All Views

SHOW FULL TABLES statement का use करके आप किसी database के अंदर मौजूद सभी views को देख सकते हैं।

SHOW FULL TABLES WHERE Table_type="View";
+---------------------+------------+
| Tables_in_tutorials | Table_type |
+---------------------+------------+
| userorders          | VIEW       |
+---------------------+------------+

पिछले topic में हमें userorders name का view बनाया था , और उसे drop करने का example देखेंगे -

MySQL Drop View Example

DROP VIEW IF EXISTS userorders;
Query OK, 0 rows affected (0.078 sec)

Query OK है, मतलब view drop हो चुका है।

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook

b2eprogrammers