exists(a, attr)
exists(a)
Returns true if any of the specified attr for tuples in relation a are true.
If the relation has only one attribute then it is used and no attr need be specified.
∃ can be used instead of exists.
Examples
$P{*, heavy:=WEIGHT>12}
| heavy | PNO | PNAME | COLOR | WEIGHT | CITY |
|---|---|---|---|---|---|
| false | P1 | Nut | Red | 12 | London |
| false | P5 | Cam | Blue | 12 | Paris |
| true | P2 | Bolt | Green | 17 | Paris |
| true | P3 | Screw | Blue | 17 | Rome |
| true | P4 | Screw | Red | 14 | London |
| true | P6 | Cog | Red | 19 | London |
None
exists($P{*, heavy:=WEIGHT>12}[PNO="P0"], heavy)
false
Some
exists($P{*, heavy:=WEIGHT>12}, heavy)
true