Next: Which dept is Up: Simple Queries Previous: Edna earns which

### Which employee earns more than 2000?

This example illustrates a query that is ambiguous according to the mapping of First Order Logic into the Untyped Relational Calculus However, information about the domain rules out the second interpretation, where 2000 is interpreted as an employee's name.

```ENG: which employee earns more than 2000
SYN: (s(np(det(which))(n(n(employee))))(vp(v(earns))
PT: `employee:fv1 and `than:`2000:(`more:`earn):fv1
FOL: employee(fv1)&than(fv1,`more:`earn,`2000)
URC: {fv1;[fv1,*,*,*]:emp&exists(rr,[fv1,*,rr,*]:emp&rr>`2000)}
DRC: {fv1:emp![name];[fv1,*,*,*]:emp&
exists(rr:emp![sal],[fv1,*,rr,*]:emp&rr>`2000)}
OP1: {fv1:emp![name];
exists(skf1:emp![sal],[fv1,*,skf1,*]:emp&skf1>`2000)}
TRC: {fv1!name;fv1:emp;exists(skf1:emp,
exists(tuple1:emp,tuple1!name=fv1!name&tuple1!sal=skf1!sal)&
skf1!sal>2000)}
OP2: {fv1!name;fv1:emp;exists(sk2:emp,sk2!name=fv1!name&sk2!sal>2000)}
OP3: {fv1!name;fv1:emp;fv1!sal>2000}
SQL: SELECT DISTINCT fv1.name FROM emp fv1 WHERE fv1.sal>2000;

|name      |
|----------|
|malcolm   |
|ted       |
|----------|
(2 rows)

URC: {fv1;[fv1,*,*,*]:emp&exists(a2,
exists(a3,[fv1,*,a2,*]:emp&[`2000,*,a3,*]:emp&a2>a3))}
CHK: Query not meaningful with respect to current database
```

Chris Fox, September 1995