
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Foreign Key in RDBMS
A Foreign Key creates a link between tables. It references the primary key in another table and links it.
For example, the DeptID in the Employee table is a foreign key −
<Employee>
EmpID |
EmpName |
EmpAge |
DeptID |
<Department>
DeptID |
DeptName |
DeptZone |
The DeptID in the Department table is a Primary Key in the Department Table.
The DeptID in the Employee table is a Foreign Key in the Employee Table.
The below figure represents the same −
Above, you can see our two tables. The Foreign Key of the Employee table is the Primary Key of the Department table.
Advertisements