Bjorn Barton-Pye wrote:

I am using a test database to teach myself MYSQL and am using my DVD collection as the subject. I have 3 tables in this example:

Actresses
=======
actr_id
name

Actors
======
acto_id
name

DVD
======
Title
acto_id
actr_id

The acto_id and actr_id in the DVD table indicates the id for the leading
actor or actress of the movie in question. Obviously, in the case of some
movies, it may be an all-male or all-female cast, so the id fields in the
DVD table are allowed to be NULL.

If you want to learn about outer joins this is a fine model. If you want to index your DVD collection, you should consider the following data model:


DVD:
dvd_ID PRIMARY KEY
title NOT NULL

Actor:
actor_ID PRIMARY KEY
name NOT NULL
gender NOT NULL

DVD_Actor:
dvd_ID REFERENCES DVD
actor_ID REFERNCES Actor

Add more tables if you want to plan for 1 DVD having more as 1 movie or 1 movie having more as 1 DVD ;-)

Jochem

--
I don't get it
immigrants don't work
and steal our jobs
    - Loesje


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to