In this video, I have demonstrated the meaning of Primary Key and Foreign Keys which is the most important concept in database.
The official way to pronounce “MySQL” is “My Ess Que Ell” (not “my sequel”), but we do not mind if you pronounce it as “my sequel” or in some other localized way.
************************************
Please watch the video till the end to get a better understanding. And If you found the video helpful then be sure to hit the like button.
Thanks for watching.
Check Out SQL In MySQL Playlist for the entire videos.
************************************
What is Primary Key?
A primary key constrain is a column or group of columns that uniquely identifies every row in the table of the relational database management system. It cannot be a duplicate, meaning the same value should not appear more than once in the table.
A table can have more than one primary key. Primary key can be defined at the column or the table level. If you create a composite primary key, it should be defined at the table level.
What is Foreign Key?
Foreign key is a column that creates a relationship between two tables. The purpose of the Foreign key is to maintain data integrity and allow navigation between two different instances of an entity. It acts as a cross-reference between two tables as it references the primary key of another table. Every relationship in the database should be supported by a foreign key.
KEY DIFFERENCES:
A primary key constrain is a column that uniquely identifies every row in the table of the relational database management system, while foreign key is a column that creates a relationship between two tables.
Primary Key never accepts null values whereas foreign key may accept multiple null values.
You can have only a single primary key in a table while you can have multiple foreign keys in a table.
The value of the primary key can't be removed from the parent table whereas the value of foreign key value can be removed from the child table.
No two rows can have any identical values for a primary key on the other hand a foreign key can contain duplicate values.
There is no limitation in inserting the values into the table column while inserting any value in the foreign key table, ensure that the value is present into a column of a primary key.
Why use Primary Key?
Here are the cons/benefits of using primary key:
The main aim of the primary key is to identify each and every record in the database table.
You can use a primary key when you do not allow someone to enter null values.
If you delete or update records, the action you specified will be undertaken to make sure data integrity.
Perform restrict operation to rejects delete or update operation for the parent table.
Data are organized in a sequence of clustered index whenever you physically organize DBMS table.
Why use Foreign Key?
Here are the important reasons of using foreign key:
Foreign keys help you to migrate entities using a primary key from the parent table.
A foreign key enables you to link two or more tables together.
It makes your database data consistent.
A foreign key can be used to match a column or combination of columns with primary key in a parent table.
SQL foreign key constraint is used to make sure the referential integrity of the data parent to match values in the child table.
************************************
Link for my other Videos:
MySQL Introduction for Beginners
• Introduction To MySQL Database | MySQL Tut...
MySQL File System vs DBMS
• File System Vs DBMS | MySQL Tutorial for B...
MySQL Server & MySQL Workbench Installation
• MySQL Workbench Installation Tutorial in H...
Introduction to SQL
• Introduction To SQL & MySQL | What Is MyS...
Creation of Database in MySQL
• Create Database In MySQL | CREATE STATEMEN...
Table Creation in MySQL
• How To Create Tables In MySQL | CREATE TAB...
Insertion of Data in MySQL
• How To Insert Data In MySQL | INSERT STATE...
***************************************
CONNECT WITH ME 📲⌨
Facebook: / vishu.5353
Twitter: / v_biswal
***************************************
#PrimaryKey #ForeignKey
mysql for beginners
learn mysql
mysql course
learn sql
sql basics
database
data
sql course
sql crash course
structured query language
sql beginners
mysql crash course
sql tutorials for beginners
sql for beginners
mysql database tutorial
database tutorial
mysql database
mysql tutorial for beginners
sql tutorials for beginners in hindi
mysql tutorial for beginners in hindi
primary key
foreign key
candidate key
super key
vidiv academy @vishmitadatalabs