Consider the ODL schema for the COMPANY database:

interface Employee (extent employees, key(ssn)) {
  attribute string ssn,
  attribute string name,
  attribute string address,
  attribute float salary,
  relationship Department worksFor
               inverse Department::employees,
  relationship Department manages
               inverse Department::manager,
  relationship Set(Project) worksOn
               inverse Project::employees,
  relationship Set(Employee) supervisees
               inverse supervisor,
  relationship Employee supervisor
               inverse supervisee,
}
interface Department (extent departments, key(dno)) {
  attribute string dno,
  attribute string dname,
  attribute Set(string) locations,
  relationship Set(Employee) employees
               inverse Employee::worksFor,
  relationship Employee manager
               inverse Employee::manages,
  relationship Set(Project) projects
               inverse Project::controllingDept
} 
interface Project (extent projects, key(pno)) {
  attribute string pno,
  attribute string pname,
  attribute string location,
  relationship Department controllingDept
               inverse Department::projects,
  relationship Set(Employee) employees
               inverse Employee::worksOn
}


Recall that in this database there are DEPARTMENTS, PROJECTS
and EMPLOYEES; each project is controlled by one department
and each department may control several projects;
each employee works for one department and each department
may have many employees; each department has one manager
and each employee may manage at most one department; 
each employee may supervise several other employees
and each employee may have at most one supervisor;
each department may be located in several cities.

Write OQL statements to answer the following queries:

(1) Find the names of employees who are directly supervised by Franklin Wong

    select s.name
    from   employees e, e.supervisees s
    where  e.name = "Franklin Wong";

(2) Find the names and addresses of employees who work for the 
    Research department.

    select e.name, e.address
    from   employees e
    where  e.worksFor.dname = "Research";

(3) Find the names of projects that involve an employee named Smith
    either as a worker or as a manager of the department that controls
    the project.

    select p.pname
    from   projects p
    where  (exists e in p.employees: e.name = "Smith") or
           (p.controllingDept.manager.name = "Smith");

(4) Find the names of employees who work for all projects controlled by
    department 5..

    select e.name
    from   employees e
    where  (forall p in (select p
                         from   projects p
                         where  p.controllingDept.dno = 5): p in e.worksOn);

(5) Find names of employees who work on at least one project located in
    Houston but whose department has no location in Houston.

    select e.name
    from   employees e
    where  (exists p in e.worksOn: p.location = "Houston") and
           not (exists l in e.worksFor.locations: l = "Houston");

(6) Find the average salary of employees who work for project number 25.

    avg(select e.salary
        from   projects p, p.employees e
        where  p.pno = 25);