next up previous contents
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&
OP1: {fv1:emp![name];
TRC: {fv1!name;fv1:emp;exists(skf1:emp,
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 FROM emp fv1 WHERE fv1.sal>2000;

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

URC: {fv1;[fv1,*,*,*]:emp&exists(a2,
CHK: Query not meaningful with respect to current database

Chris Fox, September 1995