الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

سؤال عن الـ Foreign Key

Featured Replies

بتاريخ:

السلامـ عليكم 

 

لدي سؤال عن الـ Foreign Key 

 

هل نستطيع ادراج الـ Foreign Key في الـ TABLE LEVEL فقط 

 

ام نستطيع ادراجه في الـ COLUMN LEVEL ايضا 

 

وشكرا

 

 

 

غدا امتحاني الاول في الاوراكل 

 

دعواتكم  :mellow:

بتاريخ:

وعليكم السلام ورحمة الله

 

أدعوا لك بالتوفيق في الإمتحان

 

ال Foreign key  يمكن كتابة أمر إنشاؤه على مستوى الجدول  Table

اليك هذا المثال البسيط

فى العلاقة بين جدول الموظفين وجدول رموز الإدارات

create table department  (
   dep_code           NUMBER                          not null,
   dep_name           VARCHAR2(60),
   constraint PK_DEPARTMENT primary key (dep_code)
);

create table employee  (
   emp_no             NUMBER                          not null,
   dep_code           NUMBER                          not null,
   emp_name           VARCHAR2(60),
   constraint PK_EMPLOYEE primary key (emp_no),
   constraint FK_EMPLOYEE_REFERENCE_DEPARTME foreign key (dep_code)
         references department (dep_code)
);

بمكن كتابة الأمر على مستوى الschema الجداول كلها مثل

باستخدام أمر alter table

create table department  (
   dep_code           NUMBER                          not null,
   dep_name           VARCHAR2(60),
   constraint PK_DEPARTMENT primary key (dep_code)
);

create table employee  (
   emp_no             NUMBER                          not null,
   dep_code           NUMBER                          not null,
   emp_name           VARCHAR2(60),
   constraint PK_EMPLOYEE primary key (emp_no)
);

alter table employee
   add constraint FK_EMPLOYEE_REFERENCE_DEPARTME foreign key (dep_code)
      references department (dep_code);
بتاريخ:
  • كاتب الموضوع

شكرا لكم

 

لان هذه النقطة لم اجدها في كتاب الاوراكل 

 

وامتحان الاوراكل 0z1-051 

 

 

الحل يقول باننا نستطيع ادراج الforeign key and primary key in table level and culmn level 

 

لهذا اردت ان اتاكد اذا كان يوجد خطا في حل الامتحان

بتاريخ:
  • كاتب الموضوع

الان فهمت مكتوب بانه بأمكاننا اضافة الـ Foreign key  في الـtable level و الـ column level 

 

 

ولاكن في حالة الـ  composite foreign key  يجب ان نضيفه في الـtable level

 

:rolleyes:

بتاريخ:
  • كاتب الموضوع

الحمد لله نجحت في الامتحان الاول بدرجة 650 من 1000

درجة غير ممتازة لاكن الحمد لله انتهى الامتحان الاول على خير :)

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.