A company stores employees and their immediate supervisors in the following Staff table. The column staff_id uniquely identifies each employee, and manager_id contains that employee's supervisor's staff_id. NULL indicates no supervisor.
staff_id
name
office
manager_id
301
Nora
West
NULL
302
Omar
East
303
Priya
304
Quinn
305
Rosa
306
Seth
The company runs this query:
SELECT e.name AS employee, m.name AS supervisor FROM Staff AS e INNER JOIN Staff AS m ON e.manager_id = m.staff_id WHERE m.office = 'West' ORDER BY e.staff_id;
Complete the three output rows below in the order returned by the query. Enter each person's name exactly as shown in the source table.
Unlock full course notes by signing up
Row count of a left join with unmatched rows
The tables below come from a small company database, where each employee belongs to at most one department.
departments
employees
Row counts for every join type
An online shop imported its reviews table from an old system without a foreign-key constraint, so one review refers to a product that no longer exists.
products
reviews
General properties of equality joins
Two tables A and B are joined with the equality condition A.k = B.k on a column k that exists in both tables, and no WHERE clause is applied. Select every statement that is true for all such tables.
Diagnosing inflated totals across two detail tables
An online retailer stores orders, ordered quantities and payments in three tables. The tables below contain all records relevant to this report. Each line_id and each payment_id is unique. Payments apply to whole orders rather than individual order lines, and all monetary amounts are in Canadian dollars (CAD).
Orders
OrderLines