Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> oracle DB design question
hello,
If I have an entity (for instance a "book") which is ALWAYS related
to another entity (for instance an "author"). I have one decoding table
for "authors" (numeric sequential code + description). Which way is
preferred when designing the "books" table:
1. *author_code *book_code au_name ... (2 primary keys)
2. *book_code bk_name author_code ... (1 primary key and FK+index
on author_code)
I am asking because suppose there is a third table containing
information on the entity "reader" whereas each reader likes to read
books by a specific author. readers table would look like this:
(*reader_code reader_name author_code(FK) age....)
If i have a table containg the books each
reader has read, where i want to verify through it, the book is by the
author he likes. Should this table have:
1. three PK for solution (1) thus verifying integrity with a FK.
(*author_code *book_code *reader_code)
2. two PK for solution (2) thus verifying integrity with say a trigger
(*reader_code *book_code)
Thanks for any help
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Thu Aug 13 1998 - 15:13:35 CDT