SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Compare Employee to Their Manager on Multiple Attributes

Build mastery in Self Joins Hierarchical with this scenario-based SQL challenge and live execution support.

Problem Statement

Compare each employee to their direct manager on salary, experience_years, and hire_date. Use LEFT JOIN so the CEO (no manager) still appears with comparison columns labeled 'No Manager'. For employees with managers, label each comparison Higher / Lower / Equal (use 'Earlier' / 'Later' / 'Same Date' for hire_date). Return employee_name, manager_name, salary_comparison, experience_comparison, hire_date_comparison — ordered by employee_id.

Relevant Tables

employees

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: