Loading exercise…
Loading exercise…
Exercises are built for a keyboard. Read the task here, then open this page on a laptop to solve it.
Self join. A self join joins a table to itself. Give the table two aliases and treat them as two copies, each playing a role: one copy for the person, another for their manager, or one for each half of a pair. The ON condition says how a row in one copy relates to a row in the other.
select a.customer_name, b.customer_name as same_region_as from customers a join customers b on a.region_id = b.region_id and a.customer_id < b.customer_id where a.segment = 'Enterprise' and b.segment = 'Enterprise'
HR is printing the sales org chart. Every rep, from Tom Becker to Lena Fischer, should appear next to the name of the person they report to.
Return rep_name and manager_name (the rep_name of the person in manager_id) for every sales rep who has a manager.
Loading the Brightline dataset…
Language
Full plan
SQL ✓ · Excel and Power BI also included
Cancel anytime · 14-day full refund · Secure payment by Stripe