Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2013
    Posts
    2

    How to structure a weird relationship

    Hello,

    I'm new, recent softdev grad and I'm working on a project with a weird relationship. Trying to figure out the best way to structure a couple of tables. I feel like it's pretty easy but I can't quite wrap my head around it. Any help would be appreciated. This structure will be used to store classical music.

    So I have four things, a songs, works, albums and playlists.

    A song is the base.
    A work is made up of multiple songs.
    An album is made up of multiple songs and/or a work.
    A playlist is one or a combination of any of the previous.

    I keep trying to do it with a recursive M2M with a song grouping type or something.

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Table: Music (MusicID, MusicName, MusicType[Song/Work/Album/PlayList])
    Table: MusicGroups (ParentMusicID, ChildMusicID)
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Aug 2013
    Posts
    2
    what about scalability?

    that one table is going to be a bit larger consisting of every single song,album,work and playlist

    what about all the specific information for playlists albums songs etc.. and how would the joins work?

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    What database platform are you going to use? I can't imagine that you would overload it.
    As for entity attributes, they can all be placed in the same table, allowing NULL values when they are inappropriate for the entity type, or they can be placed in distinct subtables with joins to their parent entity record.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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