Reputation: 47
In a general sense in SQL joins, what is the benefit to joining tables with multiple versus one column?
Upvotes: 1
Views: 1171
Reputation: 2785
It depends on the structure of your data. One column may not be enough to properly identify matching rows.
Consider joining on Address
data (as an example). If you only join on the Address
line, but not City/State
, you might have rows match to both
123 Front St, New York City, NY
and
123 Front St, Los Angeles, CA
even though your person only lives in one place.
side note: joining on address lines probably means your database needs normalizing. I use it as an example only
Upvotes: 5