tony gil
tony gil

Reputation: 9554

MySQL - is there any way to check if a view is referenced by other views?

I have a development MySQL db which i am cleaning up. I am deleting some test views.

How can I check if a view is referenced by other views?

Upvotes: 3

Views: 1618

Answers (1)

dehrg
dehrg

Reputation: 1741

There is an information schema table which stores view definitions. You could use something like:

SELECT * FROM information_schema.VIEWS 
WHERE table_schema = 'your schema' 
AND view_definition LIKE '%referenced_view%';

Which will give you back all views that reference 'referened_view' in their definition

Upvotes: 3

Related Questions