Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
Table A has the keys a, b, c and d with the values u = 1, 2, 3, 4. Table B has the keys b, c and e with the values v = 10, 20, 30. Find the number of rows after a merge on the key with how equal to "inner", "left", "right" and "outer". Say what each one keeps.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Plan. Build the two tables, and merge four times.
Check. The keys in both tables are b and c.
inner keeps only the keys that are in both tables: 2 rows.left keeps all the keys of A, with NaN for the v that B does not have: 4 rows.right keeps all the keys of B: 3 rows.outer keeps all the keys of both: a, b, c, d, e, which is 5 rows.Answer: 2, 4, 3 and 5 rows.
Log in to join the discussion.
Loading…