Introduction
PRQL
SQL
SELECT
title,
country,
salary + COALESCE(tax, 0) + benefits_cost AS _expr_1,
salary + COALESCE(tax, 0) AS _expr_2
FROM
employees
WHERE
start_date > DATE '2021-01-01'
),
SELECT
country,
AVG(_expr_2) AS _expr_0,
SUM(_expr_1) AS sum_gross_cost
FROM
table_3 AS table_2
WHERE
_expr_1 > 0
GROUP BY
title,
country
)
country,
_expr_0,
sum_gross_cost,
CONCAT(title, '_', country) AS id,
LEFT(country, 2) AS country_code
FROM
table_1 AS table_0
WHERE
sum_gross_cost > 100000
ORDER BY
sum_gross_cost,
country DESC
20