easy question

From: <sean_at_networkdata.co.uk>
Date: 2000/04/01
Message-ID: <udkF4.1563$hc7.45042_at_news2-win.server.ntlworld.com>#1/1


Hi,

Although I use MySQL - this is a basic RDBMS question.

Please help as my website project cannot proceed until I understand the following.

Example scenario.
I have two tables - People AND books. I record personal Info in one and Book info in the other.

I already know how to query the people table and I also know how to query the books table. I even know how to query both together. (Something like this):

SELECT people.name,books.title FROM people,books WHERE people.name="fred" OR books.title="mysql";

WHAT I REALLY WANT TO DO is query the database to find out which people have read the book entitled MySQL.

I think I need book_id and People_id fields which are primary keys and auto_increment but even if I do this how does MySQL know who has read which books.

Last week I had never seen MySQL and didn't know why a database should ever need more than one table. I now know why as I have done alot of studying but I just cannot understand how to RELATE data in tables.

Maybe it is something to do with the INSERT. When I enter a person maybe I must specify which book he has read and when INSERT a book maybe I must specify which people has read it?

Please help.

Thanks,

Sean Received on Sat Apr 01 2000 - 00:00:00 CEST

Original text of this message