Featured Post

How to Integrate Google Tag Manager with Drupal 9 - An Easy Step-by-Step Tutorial

  Marketers are always seeking new ways to elevate website engagement and maximize interactivity. Yet, managing the countless third-party in...

What is a foreign key? Write a query to implement the same in MySQL.

 A foreign key is used to connect two tables. A FOREIGN KEY is a field (or assortment of it) in one table that alludes to the PRIMARY KEY in another table. The FOREIGN KEY requirement is utilised to forestall activities that would crush joins between tables.

To assign a foreign key, it is important to mention it while creating the table. It can be assigned by invoking the FOREIGN KEY query. Something like this:

FOREIGN KEY (Any_ID) REFERENCES Table_to_reference(Any_ID)

No comments:

Post a Comment

Popular Posts