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 :)

  • you want to produce table names which are references of the user table? – Edgar Allan Bayron Jan 24 '18 at 3:49
  • @EdgarAllanBayron yes :) I hope to produce table names that referencing the user table only. – TYL Jan 24 '18 at 3:54

Try this:

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'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.