Consider the following schema of a Company database: Employees(eid: integer, ename:…
- User
Consider the following schema of a Company database: Employees(eid: integer, ename: string, address: string, supereid: integer, salary: integer) Departments(did: integer, dname: string) Projects(pid: integer, pname: string, did: integer, budget: integer) Works_on(eid: integer, pid: integer, hours: integer) Primary keys are underlined. Each Employee has a supervisor (another Employee) referenced by their supereid. Projects are uniquely assigned to a Department. The Works_on relation records which Employee works on which Project for how many hours a week. The primary key of a relation consists of all its underlined attributes. There are foreign key constraints between Employees.supereid and Employees.eid, between Works_on.eid and Employees.eid, between Works_on.pid and Projects.pid and between Projects.did and Departments.did. For assignments 1.1 to 1.7, formulate the natural language question as relational algebra (RA) query or explain why the query cannot be formulated in RA. You must use the exact notation for the RA operations introduced in class. In particular, you cannot use dot notation to refer to attributes but must rename attributes, where necessary.
Return the eid of the Employees who are working for the maximum number of Departments. The max number of departments is 3.
You are a database professor completing the assignment. You need to write each step by step reasoning through latex.
Answer: Self join with itself on the employee id value And that will combine it with other instances of employee id And ra is inherently unique so don’t have to worry about copies And only the ones that have equal to or greater than 3 other instances of the same employee id would be left in the table
- Assistant