In this post, I provide different script to find table dependency in Foreign Key
Constraint, View and Stored Procedure of MySQL.
Database Architecture or Database Developer has to find table dependency before to apply any DDL changes on Tables.
Below are three different scripts to find Table dependency in MySQL.
/*Find Table Dependency in Foreign Key Constraint.*/
WHERE Constraint_Type = 'FOREIGN KEY'
AND Table_Name = 'Any_Table'
AND Table_Schema ='db_Name';
/*Find Table Dependency in Views.*/
AND Table_Name = 'table_name'
/*Find Table Dependency in Stored Procedure.*/
INNER JOIN information_schema.routines
LIKE Concat('%', tables.table_name, '%')
WHERE Table_Schema ='db_name'
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.