Pure.Krome
Pure.Krome

Reputation: 86947

Two DB tables vs one DB Table

I have a table of music albums. I have a second table of album art. Unfortunately, not every album has some album art data. As such, i will need to do an OUTER JOIN between music and album art.

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

Question

Upvotes: 0

Views: 275

Answers (3)

cbp
cbp

Reputation: 25628

Two tables in this case would usually imply a one->many relationship which is probably not what you want, although I guess some albums come with multiple artwork.

So theoretically you should merge the tables into one, unless you had a very good reason to have them split into two. Why do you want them as two tables?

Upvotes: 1

Kibbee
Kibbee

Reputation: 66112

The only reason I can see to keep them in separate tables is if one album can contain multiple pieces of artwork. If each table only contains, and will only ever contain, 1 piece of artwork, then sticking them in the same table should be fine. If you are joining these two tables in a lot of different instances, you may want to create a view in order to simplify your SQL statements.

Upvotes: 6

Ryan Lundy
Ryan Lundy

Reputation: 210090

Just use one table, with nulls for albums with no art. I don't see any advantage to having a second table...unless you have a lot of albums that share the same art.

Upvotes: 1

Related Questions