SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2002
    Location
    Australia
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Linking Tables - phpmyadmin

    Hi

    I'm using phpmyadmin and mysql. I want to create a database to manage song lyrics from different movies.

    The fields i'm going to have are below-

    - Name of Song
    - Music Director
    - Song Lyrics
    - Singers

    - Movie Name
    - Director Of Movie
    - Actors in movie

    What I was thinking is have the

    - Movie Name
    - Director Of Movie and
    - Actors in movie

    in a separate table and somehow link them together. This would be necessary as one movie can have many songs and it wouldn't make sense to keep submitting the movie information each time.

    I think this is basically trying to make a relational database. I've looked around extensively for an appropriate tutorial but haven't found any that have been useful.

    I would be very grateful if you could point me in the right direction or if possible create the sql that i can import in phpmyadmin.

    Thanks

  2. #2
    does not play well with others frezno's Avatar
    Join Date
    Jan 2003
    Location
    Munich, Germany
    Posts
    1,391
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One way to achieve this is to give the move an ID and add a field in the song table for the movie id. Now you can assign every song via the movie id field to a movie.
    We are the Borg. Resistance is futile. Prepare to be assimilated.
    I'm Pentium of Borg.Division is futile.Prepare to be approximated.

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2002
    Location
    Australia
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry i don't understand that completely. And when it comes to displaying it on a php page how would it work.

    Thnx
    Web Hosting Jury -hosting reviews written by users for users.
    Browse reviews, or write a review on your experience

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,018
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    movies and actors are many-to-many -- see similar thread here: http://forums.devshed.com/showthread...threadid=83715

    movies and songs are probably one-to-many for the majority of the actual cases, but it would be better just to set them up as though they were many-to-many as well

    rudy

  5. #5
    does not play well with others frezno's Avatar
    Join Date
    Jan 2003
    Location
    Munich, Germany
    Posts
    1,391
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937
    movies and songs are probably one-to-many for the majority of the actual cases, but it would be better just to set them up as though they were many-to-many as well
    You are right. It definitely makes more sense to use a many-to-many relationship, even if it's not necessary yet.
    Who knows what will be added in the future and with m2m you're always on the save side.
    We are the Borg. Resistance is futile. Prepare to be assimilated.
    I'm Pentium of Borg.Division is futile.Prepare to be approximated.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •