Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 882 Bytes

174_highest_salaries_difference.md

File metadata and controls

43 lines (30 loc) · 882 Bytes

SQL Everyday #174

Highest Salaries Difference

Site: LeetCode
Difficulty per Site: Easy

Problem

Write a solution to calculate the difference between the highest salaries in the marketing and engineering department. Output the absolute difference in salaries. [Full Description]

Submitted Solution

-- Submitted Solution
WITH cte AS (
    SELECT
        MAX(salary) FILTER (WHERE department = 'Engineering') AS engineering_sal
        ,MAX(salary) FILTER (WHERE department = 'Marketing') AS marketing_sal
    FROM Salaries
)
SELECT
    ABS(engineering_sal - marketing_sal) AS salary_difference
FROM

Site Solution

-- LeetCode Solution 
-- None

Notes

TBD

NB

TBD

Go to Index
Go to Overview