Re: Tables and data question

From: Lennart Jonsson <lennart_at_kommunicera.umea.se>
Date: 22 Jan 2004 04:51:25 -0800
Message-ID: <6dae7e65.0401220451.58d85f09_at_posting.google.com>


eclecticmess_at_hotmail.com (Dennis) wrote in message news:<a87f231.0401211826.1909e02a_at_posting.google.com>...
> If this is the wrong place to post this, I apologize.
> I am having a problem that I just can't seem to wrap my brain around
> regarding tables and their data. Part of the problem is that
> I am not sure I can even articulate the question, but here goes.
> *
> SQL Database: Book_Collection
> One table: tblBooks: Fields = Book_ID, Title, Author_ID,
> 2nd table: tblAuthors: Fields = Author_ID, Author_Name
> *
> When I enter the Author_ID in a record in the Books table, how do I
> make sure it is the correct one that corresponds to the Author_ID in
> the Author's table? It seems to me that the only way I could ever
> accomplish this would be to make a print out of my Authors table and
> refer to it when I am entering records in my Books table. If I don't,
> I will end up with Author_Ids in the Book table that do not correspond
> to the Author-Ids in the Authors table. Does that make sense? Am I
> creating the tables incorrectly?
> *
> Any help you could give would be greatly appreciated.
> D.

First, a better place to ask this question would probably have been in comp.databases

Second, I'm not sure what you mean. Assume you have the authors Bob and Peter. Now someone would like to add the fact that Bob is the author of Book1. Are you afraid that this someone will add Peter as author, or are you afraid that they will add Bo? In the second case you should have a foreign key that prevents this. The first case is not much to do about.

Also, if there exists more than one athor for a book you will need to handle that.

HTH
/Lennart Received on Thu Jan 22 2004 - 13:51:25 CET

Original text of this message