Jun 19th, 2022,
Say you need to list all views in your MySQL database. There are a few ways to get a list of all views in the database. This article will show you how to get the job done.
Let’s have a look at the first way to show all views in the MySQL database, using a SQL script:
SELECT table_schema, table_name FROM information_schema.views WHERE table_schema not in ('information_schema','mysql', 'performance_schema','sys') ORDER BY table_schema, table_name;
Sample results
The result of the given query will look like this:
To get a list of all the views in a MySQL database using MySQL shell command line you can use the following command: show full tables where table_type = ‘VIEW’;
The output of the show views command will be:
There’s another way to list all views in your database and that using ERBuilder Data Modeler which can list all views in the MySQL database.
For more details like the view's defining query, you just have to double-click on the view name and from there you can get all details of the view as you can edit it, add a new one, or delete the needless one.
A view’s defining query is shown in the screenshot below.
Subscribe to our email newsletter today to receive updates of the latest news, tutorials and special offers!