What is a Foreign Key Constraint? Understanding Primary & Foreign Keys
HTML-код
- Опубликовано: 13 июн 2024
- In this short video we'll cover what foreign keys are, why they are important, how they differ from Primary Keys and how they function in a relational database.
00:00 Introduction
0:21 Example of Foreign Keys in a database
0:32 What is a Primary key?
1:19 What is a foreign key?
2:02 What do foreign keys do?
3:27 Review of Foreign Keys
In this video, we are focusing on foreign keys that link one column in a table to one column (the primary key) in another table for the sake of simplicity. Your own use of a foreign key can be more complex: foreign keys can link to a compound (more than one column) in another table, and foreign keys do not have to link to another table's primary key.
Just keep in mind that whatever your foreign key is referencing in the other table must have a unique constraint (this is why using a foreign key to reference another table's primary key is often a good idea, since we know that has a unique constraint by default).
Next video: how to use foreign keys in SQL: • How to Create Tables w...
More documentation on foreign keys: www.cockroachlabs.com/docs/st...
#ForeignKeys #PrimaryKeys #RelationalDatabase #CockroachDB
wow
u saved me a lot of time
And you just made my day with this comment.
Perfect explanation. No Bloatware!
Clear and helpful, thanks!
Best lecture to clear key confusions arising from definitions.
The best video. Thank you!
Very well explained and clearly illustrated. And I mean it!
Thank you Hristo!
Thank you for such a comprehensive way of presenting the information!
Glad it was helpful!
Well explained , Impressive illustrated 🤝Good job
🤝 Thanks Ali!
Thank you so much!
great explanation, thank you!
great video
Concise and comprehensive explanation! Thanks very much!
We're happy to hear that it helped!
Excellent explanation!
Clear, basic, thanks!
Thanks for watching Tim. Let us know if there are other concepts that you think would be helpful to learn about in this format.
Thank you! I couldn't understand this concept from the Coursera course I'm taking. Your video effectively cleared my confusion!
We're so glad to hear that this video helped clear your confusion.
Thank you!'
Our pleasure Jesper!
Excelllent video.
Thank you Heber!
Really great explantion
Thanks for watching ShenShaw!
Is there a way to use this concept to avoid duplicating data across tables? For example - there is an Orders table and a MyOrders table. I'd like MyOrders table to automatically reference Orders without duplicating the data in it....
Great but is it also possible that a column is both a primary key and foreign key in the same table
tnx
So it's not possible to insert data only into a parent table without having an error?
it took me at least 30 minutes to find an understanding video. That doesn't have an overly thick uninteresting indian guy making 0 sense. And i finally found someone who explains it in under 10 minutes and is short, simple and awesome. Thank you very much
Clear and helpful, thanks!