بتاريخ: 21 فبراير 200620 سنة comment_60745 السلام عليكمهل ممكن عمل اكثر من PRIMARY KEY فى جدول واحد وما معنى هذة الجملة ALTER TABLE MEDICINE ADD (CONSTRAINT MEDICINE_BRW_P1 PRIMARY KEY(MED_ID, COM_ID, SUP_ID)) ENABLE CONSTRAINT MEDICINE_BRW_P1;خصوصا جملة ENABLED ما المقصود بها اذا كان الconstraint اصلا enapled تقديم بلاغ
بتاريخ: 22 فبراير 200620 سنة comment_60757 There is only one primary key for each table, but may be there are many referenced keys.Enabled constraint means that you add the primary key constraint and enable it, because some times you need to disable this constraint to upload data to avoid loading data problems if the primary key is enabled.Because there is relationships between tables.This is an option from Oracle to let use the constraint enabled and disabled for this reason. Sorry I do not have Arabic now to write to you in Arabic, if you need more explanation just write , again and I will write in Arabic from home inshallah.Alsalamualaikum تقديم بلاغ
بتاريخ: 23 فبراير 200620 سنة comment_60943 لو سمحلي الأخ ريشا أن أعرب لكل جدول يمكن أنا يحتوي على Primary Key واحد فقط والـ Primary Key نفسه ممكن يكون عبارة عن كذا Column يعني مثلا الجدول التاليEmplyeesفيه ColumnsEmp_id, manager_id, salaryممكن يكون عندي شرط إن كل موظف له مدير واحد فقطفممكن إني أعمل Primary key على Emp_id و Manager_idأتمنى أن أكون قد أوضحت تقديم بلاغ
بتاريخ: 27 فبراير 200620 سنة comment_61245 السلام عليكم لقد علق الاخ reesha على الجزء الثاني من كلامك......اما الجزء الاول فانا اقول لك لايمكن ان يكون هناك اكثر من primeray key في جدول واحد...الا انك تقدر ان تربط عده اعمده تحت primeray key واحد .. وهذا ما يعرف با composte primeray keyوالذي انت مستخدمه في جملتك المرفقهوالله اعلم تقديم بلاغ
بتاريخ: 1 مارس 200620 سنة comment_61464 Thank you my brothers, this is exactly what I meant but you know the words does not help all the time, : تقديم بلاغ
بتاريخ: 1 مارس 200620 سنة comment_61472 السلام عليكم ورحمة الله وبركاته إنشاء القيود أثناء إنشاء الجدول وتطبيقها علي مستوي الجدول create table ord ( num number(5) , nam varchar2(20) , ordr number(5) , primary key ( num , nam ) ) ; create table ord1 ( num number(5) , nam varchar2(20) , ordr number(5) , foreign key ( num , nam ) references ord ( num , nam ) ) ; إدخال السجلات التالية insert into ord values( 1 , 'aa' , 1 ) ; insert into ord values( 1 ,'bb' , 1) ; insert into ord values( 2 ,'aa' , 1) ; insert into ord values( 2 ,'bb' , 1) ; insert into ord values( 1 , 'aa' , 2 ) ; à ORA-00001 insert into ord values( 1 ,'bb' , 2) ; à ORA-00001 insert into ord values( 1 , 'aa' , 1 ) ; à ORA-00001 insert into ord ( nam , ordr ) values ( 'cc' , 1 ) ; à ORA-01400 insert into ord ( num , ordr ) values ( 1 , 1 ) ; à ORA-01400 نلاحظ هنا : أنه لا يجوز أن تتكرر قيمة ( num , nam) معا في سجل ثاني كما يمكن أن تتكرر قيمة كل واحدة منهم في نفس العمودكما لا يجوز أن تكون القيمة المدخله لأي منها null إنشاء القيود أثناء إنشاء الجدول وتطبيقها علي مستوي الجدول مع تسمية القيد create table ord2 ( num number(5) , nam varchar2(20) , ordr number(5) , constraint a_pk primary key ( num , nam ) ) ; create table ord3 ( num number(5) , nam varchar2(20) , ordr number(5) , constraint a_fk foreign key ( num , nam ) references ord2 ( num , nam ) ) ; إنشاء 3 قيود أثناء إنشاء الجدول وتطبيقها علي مستوي الجدول create table ord4 ( num number(5) , nam varchar2(20) , ordr number(5) , primary key ( num , nam , ordr ) ) ; إدخال السجلات التالية insert into ord4 values( 1 , 'aa' , 1 ) ; insert into ord4 values( 1 ,'bb' , 1) ; insert into ord4 values( 1 , 'aa' , 2 ) ; insert into ord4 values( 1 ,'bb' , 2) ; insert into ord4 values( 2 ,'bb' , 2) ; insert into ord4 values( 2 ,'aa' , 1) ; insert into ord4 values( 2 ,'bb' , 1) ; insert into ord4 values( 2 ,'aa' , 2) ; insert into ord4 values( 1 , 'aa' , 1 ) ; à ORA-00001 insert into ord4 values( 2 ,'aa' , 2) ; à ORA-00001 insert into ord4 ( nam , ordr ) values ( 'cc' , 1 ) ; à ORA-01400 insert into ord4 ( num , ordr ) values ( 1 , 1 ) ; à ORA-01400 insert into ord4 ( num , nam ) values ( 1 , 'cc' ) ; à ORA-01400 إنشاء القيود أثناء إنشاء الجدول وتطبيقها علي مستوي الأعمدة( النتيجة خطأ ) create table ord5 ( num number(5) primary key , nam varchar2(20) primary key, ordr number(5) ) ; à ORA-02260 create table ord5 ( num number(5) primary key , nam varchar2(20) , ordr number(5) , primary key ( nam) ) ; à ORA-02260 حذف الجداول التي تم إنشاؤها alter table ord drop primary key cascade ; drop table ord ; drop table ord1 ; alter table ord2 drop primary key cascade ; drop table ord2 ; drop table ord3 ; drop table ord4 ; جزاكم الله كل خير وبارك لكم في أعمالكم تقديم بلاغ
بتاريخ: 8 مارس 200620 سنة comment_62232 السلام عليكم ورحمة الله وبركاتهنعم يمكن ان يكون للجدول اكثر من primary keyالطريقه create table Mo7b ( num number(10), name varchar2(20), phone number(10), add varchar2(20), sex char(1)); تم انشاء جدول الان لوضع اكثر من مفتاح اساسي حسب التعليمة التالية alter table mo7b add primary key(num,name,phone); وان شاء الله اكون وفيت في الحل تقديم بلاغ
بتاريخ: 9 مارس 200620 سنة comment_62402 ألاخ الكريم Mo7B ، يوجد primary key واحد فقط لكل جدول ، و المثال الذي أعطيته هو عبارة عن أضافة primary key واحد فقط للجدول و لكنه يتكون من 3 حقول و هذا النوع يسمى : Composit Primary Keyوقد شرح الاخوه هذا النوع في الرسائل أعلاه في هذه المشاركة.و شكرا تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.