A FOREIGN KEY is a field (or set of fields) in one table that refers to the PRIMARY KEY in a different table. The child table is the one with the foreign key, while the referred or parent table is the one with the primary key.
A foreign key (FK) is a column or set of columns used to create and enforce a link between data in two tables in order to limit the amount of data that may be stored in the foreign key table.
In relational database design, the FOREIGN KEY constraint is critical. It allows us to link data based on our requirements. It also helps us determine what to do with ON UPDATE and ON DELETE actions done on the rows of the primary table because it introduces certain dependencies between the columns of the primary and foreign tables.
Foreign keys do have an influence on INSERT, UPDATE, and DELETE statements because they execute data checks, but they also increase a database's overall performance. Foreign keys' main advantage is that they guarantee data consistency, which means that they keep the database clean.
At the data level, foreign keys assist maintain referential integrity. They also help with performance because they're usually indexed. Create an index if you require one, but FKs should not be used for this purpose.
Learner's Ratings
4.2
Overall Rating
53%
33%
3%
0%
11%
Reviews
K
Karan kadam
5
thank you sir!!!
S
savnesh daksh
5
Good
S
Sparsh Gaur
4
arey kiske barabar
ARPIT ARORA
5
Error is 11:35:07 SELECT * FROM PRODUCTS group by PROD_CODE LIMIT 0, 1000 Error Code: 1055. Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'learn_vern.PRODUCT
S
Swapnil Chilwant
5
Well, a structured course, with amazing teaching techniques by meet shah sir Thank you, LearnVern team.
S
Sunil Bhargav
5
good
G
Ganesh Kandu
5
you didn't mentioned about self join
M
mukul kumar
4
please make a assignment solution video, explanation is very good
S
saurabh kushwah
5
Thank you LearnVern to teach us the best courses at no cost these courses are very amazing keep going and keep teaching as same as you doing. Please add DSA course also.
M
Manabendra Nath
4
Bahoot ascha samjhate hain lekin, thora sa slow samjhata hain jo thora booring lagte hain,(Just my opinion). Thank you.
Share a personalized message with your friends.