Search⌘ K

Drop, Show, & Rename Views

Explore how to manage SQL views by listing them using SHOW FULL TABLES or information_schema queries, deleting views safely with DROP VIEW and IF EXISTS, and renaming views with RENAME TABLE or recreating methods. Understand how views are stored alongside tables and practice these commands to maintain data integrity and organization.

We'll cover the following...

SHOW, DROP & RENAME Views

There are two ways to list all views in a database; one is the SHOW FULL TABLES command and the other is querying the information_schema database. The DROP VIEW command is used to delete a view from the database. A view can be renamed in two ways. One is by using the RENAME TABLE command and the other is by deleting and recreating.

Syntax

SHOW FULL TABLES

{FROM | IN} db_name

WHERE table_type = ‘VIEW’

LIKE pattern;

DROP VIEW [IF EXISTS] view1, view2,…viewn;

RENAME TABLE old_name

TO new_name; ...