Search code examples
mysqlnormalization

Is this DB design acceptable, or is there a better way?


Is this normalized properly ?? is there a more efficient way to design this DB ?

A Profile can have unlimited albums, any user can create an album from anyone's videos. An album may contain many videos, and a video can belong to multiple albums. This is the way I've done it. . .

[Table] Profile
   [pk] Id
        (first, Last, Email. . . ect)

[Table] Album
   [pk] Id
        Title
   [fk] Owner (Profile.Id)
        Created


[Table] AlbumContent
   [pk] Id
   [fk] Album (Album.Id)
   [fk] Video (Video.Id)

[Table] Video
   [pk] Id
   [fk] Owner (Profile.Id)

Is there a better / more efficient way. . . (should I 'merge' Album and AlbumContent into one table... or is that a no-no ?? )


Solution

  • [Table] Album
       [pk] Id
            Title
       [fk] Owner (Profile.Id)
            Created
    
    
    [Table] AlbumContent
       [fk][pk] Album (Album.Id)
       [fk][pk] Video (Video.Id)
    

    i would use composite primary key on Album content Album content doesnt realy need surrogate pk unless youe want one video multiple times in your album