Formulate the following queries in relational algebra, tuple relational calculus, and domain relational calculus.

The following tables form part of a database held in a Relational Database Management System:

Employee (empID, fName, lName, address, DOB, sex, position, deptNo)
Department (deptNo, deptName, mgrEmpID)
Project (projNo, projName, deptNo)
WorksOn (empID, projNo, hoursWorked)

where Employee contains employee details and empID is the key.
Department contains department details and deptNo is the key. mgrEmpID identifies the employee who is the manager of the department. There is only one manager for each department.
Project contains details of the projects in each department and the key is projNo (no two departments can run the same project).
and WorksOn contains details of the hours worked by employees on each project, and empID/projNo form the key.

(1) List all employees.
(2) List all the details of employees who are female.
(3) List the names and addresses of all employees who are Managers.
(4) Produce a list of the names and addresses of all employees who work for the ‘IT’ department.
(5) Produce a list of the names of all employees who work on the ‘SCCS’ project.


1.
```
RA: Employee

TRC: {E | Employee(E) }

DRC: {empID, fName, lName, address, DOB, sex, position, deptNo |
Employee(empID, fName, lName, address, DOB, sex, position, deptNo) }
```

2.
```
RA: ?sex = ‘F’(Employee)

TRC: {E | Employee(E) ? E.sex = ‘F’}

DRC: {empID, fName, lName, address, DOB, sex, position, deptNo |
Employee(empID, fName, lName, address, DOB, sex, position, deptNo) ?
sex = ‘F’}
```

3.
```
RA: ?fName, lName, address(?position = ‘Manager’(Employee))

TRC: {E.fName, E.lName, E.address | Employee(E) ? E.position = ‘Manager’}

DRC: {fName, lName, address | (?empID, DOB, sex, position, deptNo)
(Employee(empID, fName, lName, address, DOB, sex, position, deptNo) ?
position = ‘Manager’}
```

4.
```
RA: ?lName, address(?deptName = ‘IT’(Department) 3 deptNo Employee)

TRC: {E.lName, E.address | Employee(E) ? (?D)(Department(D) ?
(D.deptNo = E.deptNo ) ? D.deptName = ‘IT’)}

DRC: {lName, address | (?empID, fName, DOB, sex, position, deptNo, deptNo1, deptName, mgrEmpID) (Employee(empID, fName, lName, address, DOB, sex, position, deptNo) ?
Department(deptNo1, deptName, mgrEmpID) ? (deptNo = deptNo1) ? deptName = ‘IT’)}
```

5.
```
RA: ?fName, lName (?projName = ‘SCCS’(Project) 3 projNo (WorksOn 3 empID Employee))

TRC: {E.fName, E.lName | Employee(E) ? (?P) (?W) (Project(P) ? WorksOn(W) ?
(E.empID = W.empID ) ? (W.projNo = P.projNo) ? P.projName = ‘SCCS’)}

DRC: {fName, lName | (?empID, address, DOB, sex, position, deptNo, projNo,
projName, deptNo1, empID1, projNo1, hoursWorked)
(Employee(empID, fName, lName, address, DOB, sex, position, deptNo) ?
Project(projNo, projName, deptNo1) ? WorksOn(empID1, projNo1,
hoursWorked) ? (empID = empID1) ? (projNo = projNo1) ?
projName = ‘SCCS’)}
```

Computer Science & Information Technology

You might also like to view...

The item on which the mouse pointer is resting in the accompanying figure is _________________________, which means it changes as you select different tools.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

It is _________ to pass an argument to a function that contains an individual array element, such as scores[3].

a. illegal in C++11 b. legal in C++ c. not recommended by the ANSI committee d. not good programming practice e. None of these

Computer Science & Information Technology

There are times when it is desirable to place a third ____________________ into your frameset to display a horizontal frame across the top of your browser window.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

___________ is a term describing spam that uses a deceptive message to trick victims into participating.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology