You might try querying the information_schema
database:
USE `information_schema`;
SELECT * FROM `VIEWS` WHERE `VIEW_DEFINITION` LIKE '%year_joining%';
SELECT * FROM `ROUTINES` WHERE `ROUTINE_DEFINITION` LIKE '%year_joining%';
This should return a list of views/routines which reference the field year_joining
.
I think I'm right in saying that, in either case, the column TABLE_NAME
will contain the name of the view/procedure, and the column VIEW_DEFINITION
or ROUTINE_DEFINITION
will contain the definition of the view/procedure.
To restrict the search to a particular database, include TABLE_SCHEMA
or ROUTINE_SCHEMA
in your query, e.g.
SELECT * FROM `VIEWS` WHERE `VIEW_DEFINITION` LIKE '%year_joining%' AND `TABLE_SCHEMA` = 'my_database';
SELECT * FROM `ROUTINES` WHERE `ROUTINE_DEFINITION` LIKE '%year_joining%' AND `ROUTINE_SCHEMA` = 'my_database';