How to create MySQL foreign key between two tables?

How to create MySQL foreign key between two tables?


Learn how to create a foreign key (FK) between two MySQL tables using Devart's visual editor - dbForge Studio for MySQL
Learn more: http://www.devart.com/dbforge/mysql/studio/
Closed Caption:


Welcome to the dbForge Studio for MySQL
tutorial.
In this tutorial we will review creating a foreign
key between two tables
with the functionality of Devart's MySQL
Manager.
The process of creating a foreign key
is quite simple.
Let's assume that we have two tables


and we need to link them through a key field.
Herewith, there is no relationship between the
tables yet.

To create a foreign key, in the popup menu Constraints of the child table,
you can select the New Foreign Key command
or open a table editor
and select the Constraints tab.

Where in the popup menu
select the New Foreign Key command.

The dialog will open where we can select the
table
that we will be referring to.

Let's specify what columns will be used for a
relation.
Herewith, data types between the columns must
be identical.
On the Advanced tab you can specify
the additional properties of a foreign key.

Press OK.

The DDL of the table has been refreshed.

Save our changes.

A foreign key has been successfully created.

Your have been watching the dbForge Studio for
MySQL tutorual.
Feel free to get all the benefits using the Most
Intellegent MySQL GUI Tool by Devart.
Thank you for your time.

Video Length: 01:34
Uploaded By: Devart
View Count: 43,151

Related Software Products
dbForge Studio for MySQL
dbForge Studio for MySQL

Published By:
Devart

Description:
dbForge Studio for MySQL is the universal MySQL and MariaDB front-end client for database management, administration and development. Devart's MySQL GUI tool provides utilities to compare, synchronize, and backup MySQL databases with scheduling, and gives possibility to analyze and report MySQL tables data. dbForge Studio for MySQL now works with any MariaDB database servers, and supports all MariaDB objects types. Everyone can visually design database structures, execute SQL queries and ...


Related Videos
MySQL and MariaDB client for Windows with GUI environment
MySQL and MariaDB client for Windows with GUI environment

Video Length: 04:17
Uploaded By: Devart
View Count: 9,768

How to create a simple connection using dbForge Studio for MySQL?
How to create a simple connection using dbForge Studio for MySQL?

Video Length: 02:54
Uploaded By: Devart
View Count: 4,890

The most offbeat promo video for software!
The most offbeat promo video for software!

Video Length: 01:13
Uploaded By: Devart
View Count: 4,412

dbForge Studio for SQL Server Tutorial - Part 1
dbForge Studio for SQL Server Tutorial - Part 1

Video Length: 03:36
Uploaded By: Devart
View Count: 4,090

dbForge Studio for Oracle Tutorial
dbForge Studio for Oracle Tutorial

Video Length: 01:17
Uploaded By: Devart
View Count: 3,807

What's New in dbForge Studio for SQL Server v5.0
What's New in dbForge Studio for SQL Server v5.0

Video Length: 03:48
Uploaded By: Devart
View Count: 3,505

How to debug MySQL procedures using dbForge Studio for MySQL?
How to debug MySQL procedures using dbForge Studio for MySQL?

Video Length: 02:54
Uploaded By: Devart
View Count: 3,358

How To: Export and Import Data with dbForge Studio for MySQL
How To: Export and Import Data with dbForge Studio for MySQL

Video Length: 02:58
Uploaded By: Devart
View Count: 2,802

How to Optimize MySQL Queries with Query Profiler by Devart?
How to Optimize MySQL Queries with Query Profiler by Devart?

Video Length: 02:58
Uploaded By: Devart
View Count: 2,794

Copyright © 2026, Ivertech. All rights reserved.