Skip to main content

الجزء الرابع: قيد سلامة المرجع المتتالي Cascading Referential Integrity Constraint

الجزء الرابع: قيد سلامة المرجع المتتالي
Cascading Referential Integrity Constraint

هذا الجزء يعد مكمل للجزء الثاني والثالث, قيد الCascading Referential Integrity  ينطبق على قيد الForeign key  الذي سبق ذكره في الجزء الثاني,  للوصول الى اعدادات هذا القيد:  



ولكن ماعمل هذا القيد؟ يتحكم هذا القيد بكيفية معالجة القيم في الجدول الذي به المفتاح الخارجي FK , اذا تم حذف او تعديل الحقول المرتبطة معه في الجدول الذي به المفتاح الرئيسي PK , بعبارة ابسط كما في الجدولين ادناه, اذا تم حذف او تعديل في جدول tblGender  المعرف رقم 2 , ماهي القيم التي ستكون في حقول المرتبطة بهذا المعرف؟ هل ستحذف او تعدل؟ هل ستتغير هل ستبقى؟  






الجواب كالأتي:

الخيارات المتاحة عند أعداد قيد سلامة المرجع المتتالي Cascading Referential Integrity :

1.      عدم فعل شيء No Action : هذا هو التصرف الأفتراضي, مايعنيه هو عند محاولة حذف او تعديل لسجل في جدول وكان هذا السجل فيه قيد المفتاح الرئيسي Primary Key يشير الى مفتاح خارجي Foreign Key  في جدول
اخر , سيظهر خطأ عند محاولة الحذف او التعديل وتسترجع هذه العمليات
Rollback اي لا يتم تطبيقها.


2.      التوالي Cascade : عند محاولة حذف او تعديل لسجل في جدول وكان هذا السجل فيه قيد المفتاح الرئيسي Primary Key يشير الى مفتاح خارجي Foreign Key  في جدول اخر , سيتم حذف او تعديل كلا السجلين!


3.      وضع قيمة ملغية Set Null : عند محاولة حذف او تعديل لسجل في جدول وكان هذا السجل فيه قيد المفتاح الرئيسي Primary Key يشير الى مفتاح خارجي Foreign Key  في جدول اخر , جميع الحقول التي تشير الى ذلك المفتاح الرئيسي Primary Key سيتم وضع قيمة باطلة او ملغية وهي الNULL   في تلك الحقول.



4.      وضع قيمة افتراضية Set Default : عند محاولة حذف او تعديل لسجل في جدول وكان هذا السجل فيه قيد المفتاح الرئيسي Primary Key يشير الى مفتاح خارجي Foreign Key  في جدول اخر , جميع الحقول التي تشير الى ذلك المفتاح الرئيسي Primary Key سيتم وضع قيمة أفتراضية في تلك الحقول.

Comments

Popular posts from this blog

How to fix the disk is write protected

in this video tutorial, I'll show you how to remove/solve/fix the disk is write protected from USB flash drive. To download the necessary 2 files: Download >  SAFAA_ALHAYALI.IMG  - 1.18 MB Download >  Win32DiskImager-0.9.5-install.exe - 11.7 MB write protection,remove write protection,write protected,How to fix the disk is write protected,how to solve the disk is write protected,how to remove the disk is write protected,USB write protected,fix USB write protected,fix HDD write protected,how to,windows,USB flash drive ERROR,fix USB flash drive write protected,USB flash drive write protected

How To Play .srt Subtitles File in Windows Media Player

How To Play .srt Subtitles File in Windows Media Player links: https://sourceforge.net/projects/wmpsub/ wmp,.srt Subtitles File in Windows Media Player,How To Play .srt Subtitles File in Windows Media Player,How To,Safaa Al-Hayali,saf3al2a,srt subtitle in WMP,Windows,Windows Media Player,media,.ass,local subtitles

How to Download and Play PlayStation 1 / PSX Games on Android Phones -Tablets

How to Download and Play PlayStation 1 / PSX Games on Android Phones -Tablets Get the chance to get and play PS1 (Playstation 1/PSX) games on your android the process is pretty simple just follow the steps and you'll be up and running in no time. Download Links: PS1 / PSX Emulator on android PS1 iso games Archiver for android Playstation,PSX,How to,Safaa Al-Hayali,Android,Android games,PS1 on android,android emulator,gaming ps1 on android,android tablet,saf3al2a,download,play,ps1,play station 1,emulator,best emulator for android