| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: does a table always need a PK?
etp wrote:
> If I want to model say a book where I have a root element of
> book represented as n pages, can I do something like this:
>
> table BOOK
> -----------------------------
> pageid FK
>
> and
>
> table PAGES
> -----------------------------
> pageid PK
> content text
>
> i.e do I need to have a (f.e.) primary key in the BOOK table?
> The only reason I can see that I would want to is if I want to
> have many different books but then I would have to have BOOK,
> and then a BOOK_PAGES joining table no?
>
> Danke!
>
> -Tomas
>
> ,%%%,
> ,%%%` %==--
> ,%%`( '|
> ,%%@ /\_/
> ,%.-"""--%%% "@@__
> %%/ |__`\
> .%'\ | \ / //
> ,%' > .'----\ | [/
> < <<` ||
> `\\\ ||
> )\\ )\
>
^^^^^^^^"""^^^^^^""^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You do not need a BOOK_PAGES joining table. You could add a column for BOOK_ID to your PAGES table.
-- Once I learned how to spell DBA I became one -- Jerry GitomerReceived on Fri Aug 22 2003 - 17:18:46 CDT
![]() |
![]() |