Ga naar inhoud

Header

Merging Data with RIGHT-, INNER- and FULL JOIN - Exercises

1. Most Used

We are now familiar with different types of JOIN statements.

Which of the following is the most used?

  1. 🔲 INNER JOIN
  2. 🔲 FULL JOIN
  3. 🔲 LEFT JOIN
  4. 🔲 RIGHT JOIN




2. RIGHT JOIN

We are now familiar with different types of JOIN statements.

Which statements are true for a RIGHT JOIN:

  1. 🔲 It is the reverse of a LEFT JOIN.
  2. 🔲 It returns all results from both tables.
  3. 🔲 It only returns results with a match in both tables.
  4. 🔲 You sometimes use it for better overview when merging more than 2 tables.




3. (Extra) Which JOIN?

We have a database with HR data.

Header

In it, we have 2 tables: * employees * First and last names of employees. * addresses * Addresses.

Consider the following: * Not every employee has a known address. * The addresses table contains addresses of employees, as well as suppliers and customers. * You want to send a newsletter to all employees. * For this, you want to compile a list of addresses.

Which JOIN would you use for this?

  1. 🔲 INNER JOIN
  2. 🔲 FULL JOIN
  3. 🔲 LEFT JOIN
  4. 🔲 RIGHT JOIN




Write a query that returns the following: * Data of all employees with their addresses. * Only where an address is known.

Note, these tables are not in the database we use. You do not need to test your query.

...