So in my previous video I have discussed about primary key constraints in mysql
Today's topic is foreign key constraint in mysql
The FOREIGN KEY constraint is used to prevent actions that would destroy links between tables.
A FOREIGN KEY is a field (or collection of fields) in one table, that refers to the PRIMARY KEY in another table.
The table with the foreign key is called the child table, and the table with the primary key is called the referenced or parent table.
Syntax of Foreign key in MySQL
CREATE TABLE table2(
column1 datatype,
column2 datatype,
column3 datatype,
......
columnN datatype,
PRIMARY KEY(column_name)
FOREIGN KEY (column_name)
REFERENCES table1(column_name)
);
I Hope this content will help you all
If its so then don't forget to subscribe my channel Code with Neha
And press the Bell Icon to never miss an update
I will be back soon with another interesting topic
Till then Stay tuned to the channel
#foreignkeyinmysql
#primaryandforeignkeytutorialinmysql
#mysqlprimarykey
#mysqlforeignkey
#howtouseprimarykey
#howtouseforeignkey
#learnmysql
#primarykeytutorial
#foreignkeytutorial
#howtouseprimarykeyandforeignkeyinmysql #createprimarykeyinmysql
#howtocreateprimaryandforeignkeyinmysql
#howtocreateforeignkeyinmysql
#howtosetforeignkeyinmysql
#mysqlprimarykeyforeignkey
#mysqltutorial
#mysql
#mysqlcourse
#dbms
#dbmstutorials
#databaseconcepts