بتاريخ: 17 يناير 200521 سنة comment_24373 تابعت الدروس الملحقة فى المنتدى ووجدت مثال على ال composite primary keyفى صفحةhttp://www.araboug.org/ib/index.php?sho...869&hl=compositلكننى اعمل جدول لفهارس الكتاب منقسم الى جدولين الاول الماستر بة الابوابو الثانى بة الفصولو لكى استعمل ال constraint يجب ان يكون على الاقل unique و هذا مستحيل فى فهارس الكتب حيث انها تتماثل و تتكرر فما الحل؟ تقديم بلاغ
بتاريخ: 17 يناير 200521 سنة comment_24381 Dear Ayman there is many types of constraints1-primary key which is Unique and not null2-foreign key which is reference for PK3-not null4-unique5-checkso its not necessary to make the column just primary u can make for example not nullfor example u can make ename in the emp table on scott schema not null in the table level as follows:create table emp (ename varchar2(25),....constraint emp_ename_nn not null(ename));or u can just type not null besides the column namefor examplecreate table emp(ename varchar2(25) not null تقديم بلاغ
بتاريخ: 17 يناير 200521 سنة كاتب الموضوع comment_24389 لم تنجح و رسالة الخطئ هيهORA-02270: no matching unique or primary key for this column-list تقديم بلاغ
بتاريخ: 17 يناير 200521 سنة comment_24427 ORA-02270 no matching unique or primary key for this column-list Cause: An attempt was made to reference a unique or primary key in a tablewith a CREATE or ALTER TABLE statement when no such key exists in thereferenced table.Action: Add the unique or primary key to the table or find the correct names ofthe columns with the primary or unique key, and try again . تقديم بلاغ
بتاريخ: 17 يناير 200521 سنة comment_24450 اخى الكريمفى الحالة التى ذكرتها لا يمكن استخدام الفصل والابواب لحقل اساسى مركب compsite primary keyونلجأ فى مثل هذه الاحوال الى استخدام حقل واحد فقط ويعتبر هو الحقل الاساسى للجدول ويسمى فى هذه الحالة Artificial Primary Key تقديم بلاغ
بتاريخ: 18 يناير 200521 سنة كاتب الموضوع comment_24524 يوجل حل للموضوع ببناء جدول واحد يضم الابواب و الفهارس مع بعضو لكن التصميم الذى اريدة ان يكون الابواب فى جدول و الفصول فى جدول اخرولا يمكن الصلة بينهم للتكرار فمينفعش اخد رقم الباب و استعملة fk فى جدول الفصول لن اطيل عليكم سوف ارسل لكم صورة للمطلوب ان عرف احدكم حلهاغير ذالك يمكن وضع الجميع فى جدول واحد و تنتهى المشكلةملحوظة:فى حالة لو اردت ان تستعمل ال fkسوف يعمل مع اول كتاب لعدم تكرار ارقام الابواب و الفصولعند اضافة كتاب جديد لن يعمل تقديم بلاغ
بتاريخ: 18 يناير 200521 سنة comment_24538 The First Column(Book Series) Make it PKTHEN the other Book Series Fields Make It As FK which references The PKAND IF you want to add another PK For another Record Dont Make Unique And Not Null As Primary KeyJust Define It As Not null, or Unique or Check تقديم بلاغ
بتاريخ: 28 يناير 200521 سنة comment_25604 CREATE TABLE BOOKS( book_id NUMBER, bkname, ..., CONSTRAINT books_pk PRIMARY KEY(book_id) ); CREATE TABLE BOOKSECTIONS( book_id NUMBER, bksection NUMBER, sec_title, pgnumber, ..., CONSTRAINT booksections_pk PRIMARY KEY(book_id, bksection), CONSTRAINT booksections_bookid_fk FOREIGN KEY(book_id) REFERENCES books(book_id) ); CREATE TABLE BOOKCHAPTERS( book_id NUMBER, bksection NUMBER, bkchapter NUMBER, ch_title, pgnumber,..., CONSTRAINT bookchapters_pk PRIMARY KEY(book_id, bksection, bkchapter), CONSTRAINT bookchapters_bookid_fk FOREIGN KEY(book_id) REFERENCES books(book_id), CONSTRAINT bookid_bksection_fk FOREIGN KEY(book_id, bksection) REFERENCES booksections(book_id, bksection) ); تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.