SELECT
a.artist_name
FROM tbl_artist a
INNER JOIN tbl_artist_music am
ON a.artist_ID = am.artist_ID
WHERE am.music_ID = [music_ID];
Songwriter too should be a junction table since a song can often be written by more than one personAlso, artist in the music table should actually be the songwriter rather than the performer although they could be the same person.
I understand and have now removed that relationship.You have too many relationships and they are still not logical. Data must be stored at the lowest level where you need it. So if you want artist by track, it is not necessary to connect artists to a record and doing so violates normal forms since it leaves the data subject to anomalies. You can derive artists for a record by summarizing the artists by track.
I thought I wanted media on track too because I could then distinguish between songs from my record collection and songs taken from Spotify or Youtube.media has noting to do with track. It is related to the physical record. There is a case for relating genre to track but the relationship is the same as for artists. If you put genre at the track level, you summarize it to get genre by record. Most records don't have different genre for different tracks although there is certainly some variability there. So again, if you keep genre by track, you should NOT keep it by record.
The same track can appear on several discs.Also, I'm not sure that track is an entity in and of itself. You don't buy a track, you buy a record so track doesn't stand alone. That means that there is not a many-to-many relationship between record and track since a track only exists on a record. The relationship is 1-m and so you don't need the junction table. It's like defining a piano key as an entity. That makes sense if you are creating a parts database and building a bill of material for a piano but not for any other reason. A piano key does not stand alone. It is useless unless attached to a piano.
If the same song occurs on multiple records and the track data is identical or at least similar, you can create a copy function to reduce your data entry task.
Did not think so far, it was wise.Then make YouTube or Spotify a "record". A "record" then becomes a collection of tracks from one source.
It is already done.You probably want to make YouTube and Spotify options for Media also to facilitate searching.
I will keep that in mind.I understand the confusion between what is defined for a track and what is defined for a record now that I know that not everything actually comes from some type of physical media. This also emphasizes the importance of attaching attributes at the lowest level. Things like media are associated with the record but the artist is associated with the track since different tracks on the same record can be performed by different artists. So use that concept to decide what attributes go where. It makes the data entry more cumbersome to put more attributes at the track level but it does eliminate the confusion and having the data in a single place eliminates the creation of anomalies which would be conflicts between what the record says and what the tracks say.
Sheet music will probably never be a subject that I will work with because I am not a musician but "just" a DJ.You also may be trying to capture too much information. Searching is important though and without the details of a tract, you won't be able to pull up a set of tracts that you want to turn into a program.
If you had a sheet music table as I thought tract was initially, that would enable you to eliminate some of the duplication of tracts.
There are songs in my record collection, e.g. 7 "and 12" where the songs have different lengths. But I have also chosen to index the image of the record because I sometimes have different editions of the same 7 ".A tract would point to the music table and that would ensure that the information about any particular tract would be as standardized as possible. I would advise this new table even if you don't also start collecting information about the authors of a song. There is still stuff that can't go into the music table such as the length of the song. Maybe every time Elvis sings the same song on a different record, he uses the same arrangement so the length remains constant but I doubt it and since you are producing programs, time is a critical element and has to be accurate. So even though 9 times the time is 2:58, the 10th time it is 3:04 so you simply can't put time in the music table. Maybe it makes sense to use the combination of music and arrangement so you can have two records for the same song. One that is 2:58 and the other that is 3:04. That way instead of entering the same data 10 times, you enter it twice and the track points to the musicArangement table.
I have started to think of different alternatives to a presentation in a form by several artists on the same song.Think about how this concept works. It is only slightly different from what you have now and might be closer to what you had originally. I didn't understand the original layout because of the duplication and the way things were named. This gives you a way to separate the physical attributes of implementation as a tract from the basic description of a piece of music. Having once been a teenager, I know a lot about music and recordings but I've never had to design a database to track all the stuff you are trying to track.
Having your data currently in a schema that isn't correct just leads to more problems as you try to develop new features. But I do understand the difficulty of converting it. Been there, done that for a number of applications I had to "fix".
Things like the concatenation function that initiated this question are nice to have but perhaps not actually critical. For your own purposes, you can probably just use subforms and subreports. The only time you would actually need to do this concatenation is if you wanted to export a flat file to Excel to send to someone else. In that case, you would want the artists to all be strung together in a single field. But for all day-to-day operations of the application, the artists should be stored in properly normalized tables. One thing you could play with for reports is making the artists' subreport multi-column. Pick a number like 5 for the number of columns. That way, the artists would only go to a second row if there were more than 5 attached. This won't work for forms but is quite useful for reports and might actually eliminate the need for the concatenation entirely.
Hi @Pat HartmanOn a form, you would use a subform because you need to allow edits. On a report, you could use a listbox because it is more compact if you don't want to use the multi-column subreport that I suggested earlier.
This is the scenario @Pat Hartman was eluding to. When you set up the Data your tbl_SongArtist needs to be a child table to the song.Hi @Pat Hartman
The first song with Bee Gees and Paul Nicholas is a new entry in the artist's table, I wish I had just added Paul Nicholas and then paired them together in an intelligent way to get the same result as in the picture.
Leif
Hi @MintyThis is the scenario @Pat Hartman was eluding to. When you set up the Data your tbl_SongArtist needs to be a child table to the song.
So in your Data the Song would have two table records in tbl_SongArtist, one for Paul Nicholas and one for Bee Gees.
You can display it however you like including using the concatrelated function, but it's a child table.
The Bee Gees & Paul Nicholas are not an artist.