Mysql
 SQL >> Datenbank >  >> RDS >> Mysql

Musikdatenbank mit MySQL: Ein sinnvolles Tabellenmodell

Ein guter Startpunkt ist ein Schema mit Künstlern, Alben, Titeln und Genres:

Table artists
----
id (primary key)
name
description
years_active
otherinfo (whatever you need)

Table albums
----
id (primary key)
artistid (foreign key to artists table)
name
releasedate
genreid (foreign key to genres table)
picture

Table tracks
----
id (primary key)
albumid (foreign key to albums table)
name
override_artist (overrides album artist if not null)
playtime
lyric
otherstuff as needed

Table genres
----
id (primary key)
name
description

Erweiterungsideen: Eine eigene Tabelle track_artists als n:m-Beziehung, wenn Titel mehrere Interpreten haben (Features, Kooperationen). Ebenso praktikabel: album_genres für mehrere Genres pro Album und eine playlists-Tabelle mit playlist_tracks für benutzerdefinierte Sammlungen.