Your question is SQL, Tableau, and Modeling Choices. Start with the requirements and the three tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
CME Group is building a compensation view in Tableau to help Data Science and HR stakeholders compare current salaries across employers and roles. Tableau should consume a clean SQL result containing the five highest-paid active employees.
Write a PostgreSQL query that joins the employee, employer, and compensation data.
ROW_NUMBER(), with employee_id as a deterministic tie-breaker.| Column | Type | Description |
|---|---|---|
| employer_idPK | INT | Unique employer identifier |
| employer_name | VARCHAR(150) | Employer name |
| exchange_segment | VARCHAR(50) | Market or business segment |
| headquarters_city | VARCHAR(80) | Employer headquarters city |
| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employer_id | INT | References employers.employer_id |
| employee_name | VARCHAR(100) | Employee full name |
| role | VARCHAR(100) | Employee job role |
| employment_status | VARCHAR(20) | Current employment status |
| Column | Type | Description |
|---|---|---|
| compensation_idPK | INT | Unique compensation record identifier |
| employee_id | INT | References employees.employee_id |
| annual_salary | NUMERIC(12,2) | Annual salary amount |
| effective_date | DATE | Date the compensation record became effective |
| is_current | BOOLEAN | Whether this is the current compensation record |