The Calm After the Storm or The Calm Before the Storm? #Day 8
Combining two tables (I4G 10 Days Of Code Challenge)
The past 7 days of this challenge have been progressively getting harder and harder with yesterday acting like a breaking point. Today's challenge, however was easy. This makes me ask myself, "Is this the calm after the storm or the calm after the storm?". Honestly, only time will tell.
The Challenge
Approach to Solution
Compared to the past two or three days, Today's challenge was straightforward. Basically, the challenge asks us to merge the Person
table to the Address
table but retain all the rows in the Person
table. The merging is based on the personId
column in both tables.
The solution to the problem was to use the JOIN
command in SQL. There are multiple types of the JOIN
command in SQL. The one which was used in this case was the
LEFT JOIN
command which retains all the rows in the first table (which is the Person
table in this case) and combines the second table (Address
) based on a common column (personId
).
The rows which have nothing in common in the two tables automatically have null values for the columns without an item for the row.