المفاتيح الخارجية وعلاقات قواعد البيانات
تعرف على كيفية ربط مفتاح الأجنبي بين الجداول لتحقيق الترابط.
سنغطي ما يلي...
سنغطي ما يلي...
فهم المفاتيح الخارجية في قاعدة البيانات
To establish a connection between two tables, the primary key of one table (also called the parent table) is utilized as a reference point within the other table. When utilized in a different table, this primary key is referred to as a foreign key. Foreign keys are instrumental in establishing relationships between tables, ensuring data coherence. Foreign keys act as bridges between tables, ensuring data integrity and logical connections.
على سبيل المثال، لدمج البيانات من جدول Product
الذي تم إنشاؤه مؤخرًا مع جدول SalesData
المعدل، يمكننا استخدام ProductID
، مفتاح الأساسي لجدول Product
، مفتاح خارجي داخل جدول SalesData
.