We can give names to relation expressions by creating views (virtual relvars).
Views
To create a virtual relvar derived from other relations we can use view()
to wrap an expression.
S20 := view(S[STATUS=20] & SP)
S20
SNO | SNAME | STATUS | CITY | PNO | QTY |
---|---|---|---|---|---|
S1 | Smith | 20 | London | P1 | 300 |
S1 | Smith | 20 | London | P2 | 200 |
S1 | Smith | 20 | London | P3 | 400 |
S1 | Smith | 20 | London | P4 | 200 |
S1 | Smith | 20 | London | P5 | 100 |
S1 | Smith | 20 | London | P6 | 100 |
S4 | Clark | 20 | London | P2 | 200 |
S4 | Clark | 20 | London | P4 | 300 |
S4 | Clark | 20 | London | P5 | 400 |
The expression is re-calculated each time the view is referenced, so any changes to the referenced relvars will be reflected each time.