How to view table foreign keys (FKs) in MySQL Workbench

Rene Castro - Dataedo Team Rene Castro 2018-08-05

Table of Contents:


    This guide will show you how you can view table foreign key constraints in MySQL Workbench, free management and development tool for MySQL.

    Table Inspector

    First option to view FKs is with Table Inspector. To open Table Inspector click (i) icon that shows on hover over table:

    or right click and select Table Inspector.

    When Table Inspector is open go to Foreign keys tab. What is very useful in MySQL Workbench is that, unlike most other tools, it shows foreign keys going into both directions from the table - where table is foreign (purple recangle) and primary table (blue rectangle). You can find out the direction in Table and Referenced Table columns. You can also see foreign and primary colums.

    Please note that composite keys are displayed in multiple lines.

    Table Editor

    Another option is to open Table Editor. You can do it by clicking gear icon that shows on hover over table:

    or by right clicking and selecting Alter Table... option.

    In Table Editor go to Foreign Keys tab (at the bottom). Keys are displayed in the left pane and details of selected keys are displayed on the right. You can see pair of foreign and primiary columns in Column and Referenced Column columnsin the grid in the middle of the window.

    Please be careful not to change antyhing and click apply as this will update the table you are working with.

    0
    There are no comments. Click here to write the first comment.

    By continuing to use our website, you consent to the use of cookies in accordance with our Privacy Policy.
    Accept