Append

Concatenates two tables together.

Equivalent to UNION ALL in SQL. The number of rows is always the sum of the number of rows from the two input tables. To replicate UNION DISTINCT, see set operations.

PRQL

  1. from employees_1
  2. append employees_2

SQL

  1. SELECT
  2. *
  3. FROM
  4. employees_1
  5. UNION
  6. ALL
  7. SELECT
  8. *
  9. FROM
  10. employees_2

Remove

experimental

Removes rows that appear in another relation, like EXCEPT ALL. Duplicate rows are removed one-for-one.

PRQL

  1. from employees_1
  2. remove employees_2

SQL

  1. SELECT
  2. *
  3. FROM
  4. employees_1 AS t
  5. EXCEPT
  6. ALL
  7. SELECT
  8. *
  9. FROM
  10. employees_2 AS b

Intersection

experimental

PRQL

  1. from employees_1
  2. intersect employees_2

SQL

  1. SELECT
  2. *
  3. FROM
  4. employees_1 AS t
  5. INTERSECT
  6. ALL
  7. SELECT
  8. *
  9. FROM
  10. employees_2 AS b

Set operations

experimental

To imitate set operations i.e. (UNION, EXCEPT and INTERSECT), you can use the following functions:

  1. let distinct = rel -> (from t = _param.rel | group {t.*} (take 1))
  2. let union = `default_db.bottom` top -> (top | append bottom | distinct)
  3. let except = `default_db.bottom` top -> (top | distinct | remove bottom)
  4. let intersect_distinct = `default_db.bottom` top -> (top | intersect bottom | distinct)

Don’t mind the default_db. and noop, these are compiler implementation detail for now.