I have to solve the queries using tuple relational calculus and I just want to know if I did them correctly. I'm using this database:
EMPLOYEE: fname , minit , lname, ssn , bdate , address , sex , salary , superssn , dno
DEPARTMENT: dname dnumber , mgrssn , mgrstartdate
DEPT_LOCATIONS: dnumber , dlocation
PROJECT: pname , pnumber , plocation , dnum
WORKS_ON: essn , pno , hours
DEPENDENT: essn , dependent_name , sex , bdate , relationship
Q1: Retrieve the names of employees who make at least $10,000 more than the employee who is paid the least in the Company.
{e.Lname, e.Fname | EMPLOYEE(e) AND (∃b) (EMPLOYEE (b) AND e.Salary >=
10000 + b.Salary AND NOT (∃a) (EMPLOYEE(a) AND b.Salary > a.Salary))}
Q2: Retrieve the names of all employees who work in the department that has the employee with the highest salary among all employees.
{e.Lname, e.Fname | EMPLOYEE(e) AND (∃b) (EMPLOYEE (b) AND e.dno =
b.dno AND NOT(∃a)(EMPLOYEE(a) AND a.Salary > b.Salary))}
Any help will be much appreciated.
edit: Assume that only one employee can have the highest/lowest salary.