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
from employees_1
append employees_2
SQL
SELECT
*
FROM
employees_1
UNION
ALL
SELECT
*
FROM
employees_2
Remove
experimental
Removes rows that appear in another relation, like EXCEPT ALL
. Duplicate rows are removed one-for-one.
PRQL
from employees_1
remove employees_2
SQL
SELECT
*
FROM
employees_1 AS t
EXCEPT
ALL
SELECT
*
FROM
employees_2 AS b
Intersection
experimental
PRQL
from employees_1
intersect employees_2
SQL
SELECT
*
FROM
employees_1 AS t
INTERSECT
ALL
SELECT
*
FROM
employees_2 AS b
Set operations
experimental
To imitate set operations i.e. (UNION
, EXCEPT
and INTERSECT
), you can use the following functions:
func distinct rel -> (from t = _param.rel | group [t.*] (take 1))
func union `default_db.bottom` top -> (top | append bottom | distinct)
func except `default_db.bottom` top -> (top | distinct | remove bottom)
func intersect_distinct `default_db.bottom` top -> (top | intersect bottom | distinct)
Don’t mind the default_db.
and _param.
, these are compiler implementation detail for now.