Question: The ER diagram and table implementations are shown below. Please write the Relational Algebra Representation(RA Postgresql) to solve this Question: We say that a manager
The ER diagram and table implementations are shown below.
Please write the Relational Algebra Representation(RA Postgresql) to solve this Question: We say that a manager M manages an engineer E if E belongs to a department that is managed by M. We say that a manager M supervises an engineer E if E works on some project that is supervised by M. We say that a manager M is controlling if for every engineer E that is managed by M, either E is not supervised by any manager or E is supervised by only M and no other manager. Find all controlling managers. Include managers who do not manage any engineers. The schema of the output table is (eid).




CREATE TABLE Offices ( oid INTEGER, address TEXT, PRIMARY KEY (oid) ); /* eid = eid of department's manager */ CREATE TABLE Departments ( did INTEGER, dbudget INTEGER NOT NULL, oid INTEGER NOT NULL, eid INTEGER NOT NULL, PRIMARY KEY (did), FOREIGN KEY (oid) REFERENCES Offices ); CREATE TABLE Employees ( eid INTEGER, did INTEGER NOT NULL, PRIMARY KEY (eid), FOREIGN KEY (did) REFERENCES Departments ); CREATE TABLE Engineers ( eid INTEGER, PRIMARY KEY (eid), FOREIGN KEY (eid) REFERENCES Employees ); CREATE TABLE Managers ( eid INTEGER, PRIMARY KEY (eid), FOREIGN KEY (eid) REFERENCES Employees ); pid /* eid = eid of project's supervisor */ CREATE TABLE Projects ( INTEGER, pbudget INTEGER NOT NULL, eid INTEGER NOT NULL, PRIMARY KEY (pid), FOREIGN KEY (eid) REFERENCES Managers ); CREATE TABLE Works ( pid INTEGER, eid INTEGER, hours INTEGER NOT NULL, PRIMARY KEY (pid, eid), FOREIGN KEY (eid) REFERENCES Engineers, FOREIGN KEY (pid) REFERENCES Projects ); CREATE TABLE Areas ( aid TEXT, PRIMARY KEY (aid) ); CREATE TABLE Specializes ( eid INTEGER, aid TEXT, PRIMARY KEY (eid, aid), FOREIGN KEY (eid) REFERENCES Employees, FOREIGN KEY (aid) REFERENCES Areas ); eid did dbudget oid address Employees Belongs Departments In Offices Specializes ISA Manages Areas Engineers Managers Offices (oid, address) Departments (did, dbudget, oid, eid) Employees (eid, did) Engineers (eid) Managers (eid) Projects (pid, pbudget, eid) Works (pid, eid, hours) Areas (aid) Specializes (eid, aid) aid Works hours Projects pbudget pid Supervises
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
