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 new_name;
Connect to the terminal below by clicking in the widget. Once connected, the command line prompt will show up. Enter or copy and paste the command ./DataJek/Lessons/45lesson.sh and wait for the MySQL prompt to start-up.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.