M4rk
M4rk

Reputation: 2272

SHOW CREATE VIEW for all views in MySQL

Is there a way to show all show create view for all views at the same time?

I've hundreds of views, and it would be great if there was a built-in function in MySQL to do this

Upvotes: 1

Views: 1577

Answers (1)

bradstw
bradstw

Reputation: 103

information_schema db is your friend. This will show you all the views.

SELECT 
   TABLE_SCHEMA,
   TABLE_NAME,
   TABLE_TYPE
FROM 
    information_schema.tables
WHERE 
    table_type = 'VIEW'

If you need to see full view definitions you can use this solution - Backing Up Views with Mysql Dump

information_schema docs - https://dev.mysql.com/doc/refman/8.0/en/information-schema-introduction.html

Upvotes: 1

Related Questions