Two DB tables versus one DB table

I have a table of music albums. I have a second album art table. Unfortunately, not every album has some album data. So I will need to make INTERACTING between the music and the album cover.

Assumption: both tables just contain ints and varchars .. no blobs etc.

Question

  • Is it better to combine both tables into one to reduce the outer join requirement?
0


source to share


3 answers


The only reason I can see them in separate tables is that one album can contain several pieces. If each table contains only and contains only one piece of work, then gluing them into one table should be fine. If you are joining these two tables in many different instances, you can create a view to simplify your SQL queries.



+6


source


Just use one table with zeros for non-art albums. I don't see any advantage in having a second table ... unless you have a lot of albums that share the same art.



+1


source


Two tables in this case usually means one-> many relationships, which is probably not what you want, although I think some albums have multiple artwork.

So, in theory, you should merge tables into one, unless you had a good reason to split them in two. Why do you want them to be two tables?

+1


source







All Articles