Skip to content

Instantly share code, notes, and snippets.

@jfriv
Created March 4, 2018 01:58
Show Gist options
  • Save jfriv/2b6fcd9b2f8e77c20d39d57c75a584f1 to your computer and use it in GitHub Desktop.
Save jfriv/2b6fcd9b2f8e77c20d39d57c75a584f1 to your computer and use it in GitHub Desktop.

Revisions

  1. jfriv created this gist Mar 4, 2018.
    7 changes: 7 additions & 0 deletions find_all_fk_tables_for_a_table
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    ------------------------------------------------------------------------------
    --- select all tables which have FKs that reference a table
    ------------------------------------------------------------------------------
    SELECT *
    FROM information_schema.REFERENTIAL_CONSTRAINTS
    WHERE referenced_table_name LIKE '%{table}%';