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
Published: 7/1/2013
View Count: 96,329

Related Software Products
dbForge Studio for MySQL
dbForge Studio for MySQL

Published By:
Devart

Description:
dbForge Studio for MySQL: A Full MySQL and MariaDB IDE With a Debugger, Compare Tools and Reports dbForge Studio for MySQL is Devart's Windows IDE for MySQL and MariaDB: a SQL editor with smart completion, a stored procedure debugger, a visual query builder and database designer, backup and restore, and, in the Professional edition, schema and data compare with sync scripts. Professional costs $179.95 a year (Standard $99.95, Enterprise $229.95...


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 (8/11/2014)
View Count: 25,437

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 (4/24/2014)
View Count: 20,026

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 (4/24/2014)
View Count: 18,197

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 (4/24/2014)
View Count: 16,438

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 (2/13/2015)
View Count: 15,187

Ultimate MySQL and MariaDB GUI Tool - #dbForge Studio for MySQL
Ultimate MySQL and MariaDB GUI Tool - #dbForge Studio for MySQL

Video Length: 06:28
Uploaded By: Devart (4/4/2018)
View Count: 13,669

What is the Best GUI tool for MySQL? Comprehensive overview of dbForge Studio for MySQL
What is the Best GUI tool for MySQL? Comprehensive overview of dbForge Studio for MySQL

Video Length: 05:51
Uploaded By: 0xSECRETenv (9/29/2022)
View Count: 6,992

How to connect to MySQL Database using dbForge Studio for MySQL [Easiest way]
How to connect to MySQL Database using dbForge Studio for MySQL [Easiest way]

Video Length: 04:58
Uploaded By: Devart (9/14/2021)
View Count: 6,606

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

Video Length: 01:13
Uploaded By: Devart (5/26/2011)
View Count: 4,729

The Ultimate Guide to Version Control in dbForge Studio for MySQL
The Ultimate Guide to Version Control in dbForge Studio for MySQL

Video Length: 02:43
Uploaded By: Devart (11/3/2023)
View Count: 790

Copyright © 2026, Ivertech. All rights reserved.