Mysql – How to list all the inherited tables from the parent table

inheritanceMySQL

I have 3 tables (janitor, security & manager) which inherited from the user table.
enter image description here

What is the query can be used to produce the following result(list all the name of the child tables)?
enter image description here

Thank you. Cheer 🙂

Best Answer

Try this:

SELECT
table_name
FROM information_schema.KEY_COLUMN_USAGE
WHERE table_schema = 'database_name'
AND referenced_table_name = 'user';

This will list of referenced tables under table 'user'.