List:General Discussion« Previous MessageNext Message »
From:Waldemar Jankowski Date:November 14 2006 7:01pm
Subject:RE: Find foreign key for a table
View as plain text  
Alternatively you can use:

SHOW TABLE STATUS from name_db like '%part_of_table_name%';

to get a list of all fk constraints in the database that match
a certain string. It also gives some other interesting information.

As far as dependencies go you can see which table the constraint 
references in both of the suggested methods.  Not sure if that's
what you're after though.


On Tue, 14 Nov 2006, Clyde Lewis wrote:

> Will the output from the show command also provide a list of other dependent 
> tables? From what I've seen with the "show create table <tablename>" command, 
> it only provide keys associated with that table <tablename>, but other 
> dependent tables.
> Thanks so much.
> At 01:18 PM 11/14/2006, Howard Hart wrote:
>> show create table <tablename>?
>> -----Original Message-----
>> From: Clyde Lewis [<mailto:cllewis@stripped>mailto:cllewis@stripped]
>> Sent: Tue 11/14/2006 10:16 AM
>> To: MySQL List
>> Subject: Find foreign key for a table
>> Hello,
>> How can I find the foreign keys for a table? I would like to be able
>> to find, for any table, the columns that are foreign keys and what
>> tables/columns the foreign keys are related to. Basically what I am
>> trying to do is this. My developers want to allow logical deletes of
>> data. I don't want them to be able to logically delete a record that
>> has related records.
>> Thanks in advance
>> --
>> MySQL General Mailing List
>> For list archives: 
>> <>
>> To unsubscribe: 
>> <
Find foreign key for a tableClyde Lewis14 Nov
  • Re: Find foreign key for a tablePeter Brawley14 Nov
    • RE: Find foreign key for a tableTim Lucia14 Nov
RE: Find foreign key for a tableClyde Lewis14 Nov
  • RE: Find foreign key for a tableWaldemar Jankowski14 Nov