On 7 Feb 2011, at 11:19pm, Yuzem wrote:

> One more thing:
> I have the tables "movies" and "people"
> Those two tables are related by tables "directors", "writers", etc...
> movies: id, title
> people: id, name
> 
> directors: movieId, peopleId
> writers: movieId, peopleId
> etc...
> 
> How can I normalize that so I can count directors and writers using
> count(*)?
> Should I create another table for "directors" and another for "writers",
> etc... with only the ids?
> I will end up having:
> movies > movies_directors < (directors people)


This is very basic database design.  You need to read up not on SQLite or even 
on SQL, but some books on how to arrange your data in databases.

One solution would include these three tables:

Movies: id, name, releaseDate, etc..

People: id, name, DOB, biog, etc..

MoviePeople: id, movie, person, capacity

Fill your Movies TABLE.  Fill your People TABLE with actors, directors, 
writers, etc..

Then fill the MoviePeople table with connections between the two: Clint 
Eastwood worked in one movie as actor, but he worked in another move as 
director, etc..

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to