You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 172 |[Create a Session Bar Chart](https://leetcode.com/problems/create-a-session-bar-chart/description/)|[Solution](solutions/172_create_a_session_bar_chart.md)| LeetCode | Easy | Histogram bins w/ `UNION`, `CASE`|
209
209
| 173 |[Customers Who Bought Products A and B but Not C](https://leetcode.com/problems/customers-who-bought-products-a-and-b-but-not-c/description/)|[Solution](solutions/173_customers_who_bought_products_a_and_b_but_not_c.md)| LeetCode | Medium |`STRING_AGG`|
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](https://leetcode.com/problems/highest-salaries-difference/description/)]
11
+
12
+
## Submitted Solution
13
+
14
+
```sql
15
+
-- Submitted Solution
16
+
WITH cte AS (
17
+
SELECT
18
+
MAX(salary) FILTER (WHERE department ='Engineering') AS engineering_sal
19
+
,MAX(salary) FILTER (WHERE department ='Marketing') AS marketing_sal
20
+
FROM Salaries
21
+
)
22
+
SELECT
23
+
ABS(engineering_sal - marketing_sal) AS salary_difference
0 commit comments