Visualizar todas as chaves estrangeiras (foreign keys) do banco de dados

SQL Pra listar todas as chaves estrangeiras criadas

select
CONSTRAINT_NAME as 'foreign_name',
concat(table_name, '.', column_name) as 'foreign _key',
concat(referenced_table_name, '.', referenced_column_name) as 'references'
from
information_schema.key_column_usage
where
referenced_table_name is not null;

OBS: Deve ter um jeito mais fácil, mas esse quebra bem o galho 😉

———————————————-
Posted Listening: “Hot for Teacher – Van Hallen”