...

/

Drop, Show, & Rename Views

Drop, Show, & Rename Views

This lesson explains how to list, rename, and delete views.

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 ...