List views in MySQL database

Query below lists all views in MySQL database

Query

select table_schema as database_name,
       table_name as view_name
from information_schema.views
where table_schema not in ('sys','information_schema',
                           'mysql', 'performance_schema')
        -- and table_schema = 'database_name' -- put your database name here
order by table_schema,
         table_name;

Columns

  • database_name - name of database (schema) containing view
  • view_name - view name

Rows

  • One row represents one view in a database
  • Scope of rows: all views in MySQL database
  • Ordered by database name, view name

Sample results

Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
0
There are no comments. Click here to write the first comment.