Convert SQL query(on the rank function to get second record)to pyspark
Asked in the technical interview stage. Use the provided employee records to return every record whose salary has the second distinct rank. The result should preserve ties at that rank.
employee_id, employee_name, salary, and salary_rank.salary_rank = 2, ordered by employee_id ascending.salary_rank must rank salaries from highest to lowest, with equal salaries sharing a rank.| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee full name |
| salary | DECIMAL(12,2) | Employee annual salary |
| job_title | VARCHAR(100) | Employee job title |