MySQL Forums
Forum List  »  MySQL Workbench

Re: Working out table relationships
Posted by: Martin Flammia
Date: June 19, 2009 03:27PM


Here is an example of what it looks like I need, as I am running InnoDB:

SELECT c.table_schema,u.table_name,u.column_name,u.referenced_column_name
FROM information_schema.table_constraints AS c
INNER JOIN information_schema.key_column_usage AS u
USING( constraint_schema, constraint_name )
WHERE c.constraint_type = 'FOREIGN KEY'
AND u.referenced_table_schema='db'
AND u.referenced_table_name = 'table'
ORDER BY c.table_schema,u.table_name;

Just wondering how to translate this into my DB, not sure exactly what references above I need to change for database info e.g

u.table_name = name of table I want to query?


Options: ReplyQuote

Written By
June 19, 2009 01:28PM
Re: Working out table relationships
June 19, 2009 03:27PM
June 23, 2009 07:01PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.