0

While searching for a music database I came across musicbrainz, I found a SQLite Musicbrainz database.

You can find the database scheme here.

and a file with create table statements and explanatory comments here.

The problem is that I only need the artist names and their songs in my data base.

I tried to create a new database with the artists and song names for hours yesterday, but i couldn't get it to work.

What i'm trying to do is something like this:

Artist| Song |
--------------
Eminem|When i'm gone
Eminem|Lose yourself
The Eagles|Hotel California

Thanks everybody!

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
itailitai
  • 429
  • 1
  • 4
  • 15
  • Where would you get the data from? The main MusicBrainz database schema has changed several times over the last few years and no longer corresponds to that diagram you link to. E.g., there is no longer an `artist_name` table; the name is now a `TEXT` column in the `artist` table itself. – chirlu Mar 05 '16 at 03:13
  • Is there a reason you need the whole database and can't use the [MusicBrainz Web Service](https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2) (or any of the [libraries](https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2#Libraries_to_use_the_Web_Service))? If so, the way to go is to [install the full database together with the server](https://musicbrainz.org/doc/MusicBrainz_Database/Download). – JonnyJD Mar 05 '16 at 10:05

1 Answers1

2

You can see example on sqlfiddle

select an.name as Artist, tn.name as Song from artist_name an
    inner join artist a ON a.id = an.id
    inner join r_artist_track rat ON a.id = rat.entity0
    inner join track t ON t.id = entity1
    inner join track_name tn ON tn.id = t.id;

You need 4 joins and I show on this picture why:

enter image description here

alexander.polomodov
  • 5,396
  • 14
  • 39
  • 46