Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
2. Get to know the workshop_workers table
Dictionary database
Summary

Instruction

We'll start with the workshop_workers table from the Sesame Brothers Workshop.

Exercise

The workshop_workers table consists of a few columns:

  • id – the ID of a given worker,
  • name – the first and last name of a given worker,
  • specialization – a given worker's specialization,
  • master_id – the ID of a given worker's supervisor,
  • experience – number indicating a given worker's years of experience, and
  • project_id – the ID of the project a given worker is currently assigned.

Show all workers' names together with the names of their direct supervisors. Rename columns to apprentice_name and master_name, respectively. Consider only workers who have a master.

Stuck? Here's a hint!

You have to give an alias to either both or at least one table. Type:

SELECT
  apprentice.name apprentice_name,
  master.name master_name
FROM workshop_workers apprentice
JOIN workshop_workers master
  ON apprentice.master_id = master.id