Introduction

    PRQL

    SQL

    1. SELECT
    2. title,
    3. country,
    4. salary + COALESCE(tax, 0) + benefits_cost AS _expr_0,
    5. salary + COALESCE(tax, 0) AS _expr_1
    6. FROM
    7. employees
    8. start_date > DATE '2021-01-01'
    9. SELECT
    10. title,
    11. country,
    12. AVG(_expr_1),
    13. SUM(_expr_0) AS sum_gross_cost,
    14. CONCAT(title, '_', country) AS id,
    15. LEFT(country, 2) AS country_code
    16. FROM
    17. _expr_0 > 0
    18. GROUP BY
    19. title,
    20. country
    21. HAVING
    22. SUM(_expr_0) > 100000
    23. ORDER BY
    24. sum_gross_cost,
    25. country DESC
    26. 20