Function table()
combines multiple (≥2) columns of data into one table.
When combining a column of timestamp into a table, the function uses the time value in 0 time zone for each timestamp in the column, instead of using the time value of user's current time zone.
Arguments:
- Any value <any>, auto-abstraction: UUID of NODE/EDGE
- ...
Returns:
- Table <table>
If some columns are non-homologous, Cartesian Product will be applied when the function is called in a WITH clause, or column length will be trimmed when called in a RETURN clause.
Constant
Example: return 1, "abc", and "2023-01-05 0:0:0" in the table form
return table(1, "abc", "2023-01-05 0:0:0")
Analysis: UQL statement above is equal to return [1, "abc", "2023-01-05 0:0:0"]
Alias (Homologous)
Example: find 10 cards, return their numbers and expiry dates
find().nodes({@card}) as n
limit 10
return table(n._id, n.expire_date)
Function (Homologous)
Example:calculate the neighbor's number of Card CA001, CA002, and CA003
uncollect ["CA001","CA002","CA003"] as n1
khop().src({_id == n1}).depth(1) as n2
group by n1
return table(n1, count(n2))
WITH Alias (Non-homologous)
Example:
uncollect [1,2,3] as a1
uncollect [4,5] as a2
with table(a1, a2) as a3
return a3
RETURN Alias (Non-homologous)
Example:
uncollect [1,2,3] as a1
uncollect [4,5] as a2
return table(a1, a2)