MySQL has different storage mechanisms. MyISAM default storage engine in most MySQL drives the IDE. If you use this storage engine for your tables, you cannot create any relation between their columns, and you must delete the related columns yourself.
For what you want, innoDB is the best solution. This type of storage engine makes it possible to create relationships between columns in different tables. You will need primary keys and foreign keys in your tables, and after creating these relationships, you must specify the following functions:
ON UPDATE CASCADE and ON DELETE CASCADE
Therefore, after deleting the master record, you will not need to delete the corresponding column values.
Check out this link to compare them in a test case.
source share