1

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

M4rk
  • 2,172
  • 5
  • 36
  • 70
  • Note that searches against views in MySQL cannot utilise underlying indexes, rendering their usefulness questionable, – Strawberry Oct 07 '20 at 18:13

1 Answers1

1

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

bradstw
  • 103
  • 9