Coderguy’s Blog

Thoughts on code

About

Hello, my name is Daniel Ice. I am a software developer in the Dallas, TX area. I enjoy learning about new technology. I mostly focus on PHP and Ruby on Rails.

Here is a handy query I found the mysql reference manual for how to see all the foreign keys in a database:

SELECT ke.referenced_table_name parent, ke.table_name child, ke.constraint_name
FROM information_schema.KEY_COLUMN_USAGE ke
WHERE ke.referenced_table_name IS NOT NULL
ORDER BY ke.referenced_table_name;

Leave a Reply