Next: Which dept has Up: Simple Queries Previous: Who is older

Who works for a salary that is greater than 2500?

Here we have an illustration of how Squirrel can eliminate invalid readings of a query.

The query has three syntactic interpretations. The first and third syntactic interpretations are ruled out because they cannot be translated into Untyped Relational Calculus.

The second syntactic interpretation has two translations in the Untyped Relational Calculus, but one of these interpretations is not valid in the domain (where the salary is taken to be the boss).

```ENG: who works for a salary that is greater than 2500
SYN: (s(np(ipron(who)))(vp(v(works))(pp(prep(for))
(np(det(a))(n(n(n(n(salary)))
(pp(prep(than))(np(propn(2500)))))))))
PT: some(a,`than:`2500:lambda(\$(1),`salary:\$(1) and
`greater:`be:\$(1)):a and `for:a:`work:fva1)
FOL: exists(a,(than(a,`salary,`2500)&than(a,`greater:`be,`2500))&
for(fva1,`work,a))
CHK: Query not meaningful with respect to current database

SYN: (s(np(ipron(who)))(vp(v(works))(pp(prep(for))
(np(det(a))(n(n(n(n(salary)))
(relcl(relpro(that))(s(np)(vp(v(is))
PT: some(a,(`salary:a and `than:`2500:(`greater:`be):a) and
`for:a:`work:fva2)
FOL: exists(a,(salary(a)&than(a,`greater:`be,`2500))&
for(fva2,`work,a))
URC: {fva2;exists(a,([*,*,a,*]:emp&a>`2500)&[fva2,a]:boss)}
CHK: Query not meaningful with respect to current database

URC: {fva2;exists(a,([*,*,a,*]:emp&a>`2500)&[fva2,*,a,*]:emp)}
DRC: {fva2:emp![name];exists(a:emp![sal],([*,*,a,*]:emp&a>`2500)&
[fva2,*,a,*]:emp)}
OP1: {fva2:emp![name];exists(skf1:emp![sal],skf1>`2500&
[fva2,*,skf1,*]:emp)}
TRC: {fva2!name;fva2:emp;exists(skf1:emp,skf1!sal>2500&
exists(tuple1:emp,tuple1!name=fva2!name&tuple1!sal=skf1!sal))}
OP2: {fva2!name;fva2:emp;
exists(sk2:emp,sk2!name=fva2!name&sk2!sal>2500)}
OP3: {fva2!name;fva2:emp;fva2!sal>2500}
SQL: SELECT DISTINCT fva2.name FROM emp fva2 WHERE fva2.sal>2500;

|name      |
|----------|
|malcolm   |
|----------|
(1 rows)

SYN: (s(np(ipron(who)))(vp(v(works))(pp(pp(prep(for))
(np(det(a))(n(n(n(n(salary)))