retagged by
527 views
1 votes
1 votes

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.

retagged by

Please log in or register to answer this question.

Related questions

0 votes
0 votes
1 answer
3
aditi19 asked Nov 26, 2018
406 views
relationparts(pid, pname, color)catalog(sid, pid, cost)find the sids of suppliers who supply every red part.can someone give the TRC and DRC expression for this?