to_rel(a)
Returns the value of a converted to a relation. a must be a tuple or a table.
Examples
tuple literal
to_rel(tuple{a:=42, b:="test"})
| a | b |
|---|---|
| 42 | test |
Note: this is the inverse of the .tuple tuple extraction.
Note: a shorthand syntax for tuple literals is to compose the sequence of scalar assignments with dee, which removes the need for to_rel, e.g.
dee(a:=42, b:="test")
| a | b |
|---|---|
| 42 | test |
tuple
to_rel($S[SNO="S3"].tuple)
| SNO | SNAME | STATUS | CITY |
|---|---|---|---|
| S3 | Blake | 30 | Paris |
table
to_rel($S#)
| SNO | SNAME | STATUS | CITY |
|---|---|---|---|
| S1 | Smith | 20 | London |
| S2 | Jones | 10 | Paris |
| S3 | Blake | 30 | Paris |
| S4 | Clark | 20 | London |
| S5 | Adams | 30 | Athens |
Note: this loses the table tuple ordering.