Introduction
4. Filtering – exercise
Dictionary database
Summary

Instruction

Good! How about a little exercise on filtering?

Exercise

Show the name of the apprentice, their specialization and the ID of the project if the project they are working on is not directly supervised by their master, i.e. the master currently works on another project.

Stuck? Here's a hint!

Type:

SELECT
  apprentice.name,
  apprentice.specialization,
  apprentice.project_id
FROM workshop_workers apprentice
JOIN workshop_workers master
  ON apprentice.master_id = master.id
WHERE apprentice.project_id != master.project_id

Console

Code editor

Result

TableConsole