Add a foreign key to a database table

In this topic, you learn how to integrate a key from another database table to your database table.

You add foreign keys to link multiple database tables by using a shared key.

Procedure

  1. In the Cockpit, go to Tools and click Table Definition.

  2. Open your database table.

  3. Navigate to the Properties tab and click Foreign Keys on the toolbar.

    Result: The Foreign Keys dialog opens.

  4. On the dialog toolbar, click + Add Foreign Key.

    table definition foreign key add

    Result: The Table Definition dialog opens.

  5. Click the table you want to take the keys from.

    Result: You return to the Foreign Keys dialog.

  6. From the dropdown menu on the toolbar, select the column from your current table that you want to bind the keys to.

  7. Click + Add Column.

    table definition foreign key add column

  8. In Referenced Columns, select the column from the other table you want to get the keys from.

  9. Click Apply.

Result

  • You have added a foreign key to the database table.

  • You can see the number of foreign keys added next to Foreign Keys on the table toolbar.