Primary Key and Foreign Key in MySQL Explained with Examples | MySQL Tutorial

preview_player
Показать описание


WsCube Tech is a leading Web, Mobile App & Digital Marketing company, and institute in India.

We help businesses of all sizes to build their online presence, grow their business, and reach new heights.

All the courses are job-oriented, up-to-date with the latest algorithms and modules, fully practical, and provide you hands-on projects.

📞 For more info about the courses, call us: +91-7878985501, +91-9269698122

✅ CONNECT WITH THE FOUNDER (Mr. Kushagra Bhatia) -

Connect with WsCube Tech on social media for the latest offers, promos, job vacancies, and much more:

--------------------------------------| Thanks |---------------------------
#MySQLTutorial #MySQLCourse #MySQL
Рекомендации по теме
Комментарии
Автор

01:27 Primary key and foreign key constraints in relational databases

02:54 Creating a primary key in a database for unique identification

04:21 Foreign key creates linking between two tables

05:48 Foreign keys link the primary keys of two tables, enabling joint operations.

07:15 Creating a students table with primary and foreign keys

08:42 Creating a city table with id as primary key and city_id as foreign key

10:09 City ID 522 is located in city ID 609

11:29 Enforcing primary key and foreign key constraints is crucial in large-scale relational databases.

gauravpathak
Автор

bahut achhe se samjaya sir aapne 😊❤
lekin Email id toh Unique nhi hota hai na sir ?
😊😊

namanshah
Автор

sir great work I had search more then 10 tutorials to find this concept but now it is clear

vinaymishra
Автор

Sir table banai hai lekin bol rha hai referencing column city_id and referenced column cities (id)is incompatible.😢

rabh-bo
Автор

city_id kisi or table ki primary key hone wali kyu hoga???? jbki kisi or table me to already primary ki hmne de rakhi h

RajeshKumar-jxql
Автор

Wrong teaching u have add primary key to city_id if ur refering city_id primary key to foreign key (cid)

technicalrider
Автор

PRIMARY KEY is parent
(confirm on other sources)

nikhilmore
Автор

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

This is one of the prevalent MySQL queries interview questions for both beginner and experienced candidates. 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)

theAdam
Автор

Jinka error aa rha ho vo cities ki table me primary key (Id) rakhe phrr chal jayega.

rabh-bo
Автор

I have a good doubt sir if we use primary key while creating columns then unique constraint ka koi use nhi hoga?

manyadewangan
Автор

kodular ya thunkable per ek video upload kijiye sir please

Akagarkar
Автор

missing index for constraint .... in the referenced table

coolanujkumar
Автор

failed to add the foreign key dikha raha hai isko kaise solve kre?

bhaveshmorankar
Автор

Error Code: 1822. Failed to add the foreign key constraint. Missing index for constraint

lion
Автор

failed to add misssing constraints error aa rha hai sir g??

shakmaangaming
Автор

Sir 3 br try Kara laekin failed to add missing constraints error araha hai

shelkeonka
Автор

yedee chale mat kar aaise portion tu bad mai sikha raha hai student ko ...primary key foreign key pahile sikhana tha....time wast

shubhamnimbalkar
join shbcf.ru