The closure of a Functional Dependency is defined as the set of all attributes that can be derived from that particular dependency, using the FD rules defined.
In the above example, we have 2 FD rules:
1. ssn -> ename, bdate, address, dnumber
2. dnumber -> dname, dmgrssn
For calculating closure for a particular attribute, we initially add that attribute to the set. Then we add all the attributes derived from that original attribute, from the FD rules defined previously. After this operation, we add the attributes derivable from the attributes present in the closure set. This process is repeated, till no more attributes can be added.
-----------------------------------------------------------------------------------------------------------------------------------------------
For calculating closure of ssn,
Step 1 : {ssn}+ = {ssn}
Step 2 : {ssn}+ = {ssn, ename, bdate, address, dnumber}
(from ssn -> ename, bdate, address, dnumber)
Step 3 : {ssn}+ = {ssn, ename, bdate, address, dnumber,
dname, dmgrssn} (from dnumber -> dname, dmgrssn)
For calculating closure of ssn,
Step 1 : {dnumber}+ = {dnumber}
Step 2 : {dnumber}+ = {dnumber, dname, dmgrssn} (from
dnumber -> dname, dmgrssn)
-----------------------------------------------------------------------------------------------------------------------------------------------
Therefore, the closure will be given as:
{ssn}+ = {ssn, ename, bdate, address, dnumber, dname, dmgrssn}
{dnumber}+ = {dnumber, dname, dmgrssn}
Exercisel Consider the relation schema EMP DEPT(ename,ssn,bdate,address,dnumber,dname,dmgrssn) an...
Problem 1 (25 points) Consider the following database schema: Employee (fname, Iname, ssn, address, salary, mgrssn, dnumber) Department (dname, dnumber, mgrssn, mngrstartdate) Project (pname, pnumber, plocation, dnumber) Works_On (ssn, pnumber, hours_per_week) Dependent (ssn, dependent name, bdate, relationship) The above relations store information about a company. The meaning of most of the relations and attributes is straightforward. For example, the first relation stores information about employees. The mgrssn is the SSN of the manager (supervisor) of the given employee. A manager...
can you answer part e of the question Q.31 Answer the following questions (a) Explain difference between lossy decomposition and lossless decomposition (b) If you write a SQL statement to inner join the following two tables based on Plocation value as inner join condition, is the result table lossy or lossless? (Explain why?) EMP LOCS P.K EMP PROJ1 Hours Pname Plocation Р.К. (c) Given a relation schema R ={SSN, Ename, Pnumber, Pname, Plocation, Hours) R is decomposed to R1, R2,...
Consider the relational database schema for a company below. EMPLOYEE/NAME, SSN, BDATE, ADDRESS, SEX, SALARY, SUPERSSN, DNA) TA DEPARTMENT(DNAME, DNUMBER. MESSINS, MGRSTARTDATE) DEPT_LOCATIONS(DNUMBER. DLOCATION PROJECT(PNAME, PNUMBER. PLOCATION, DNLIM) WORKS_ONCESSN.PNG, HOURS) DEPENDENTESSN, DEPENDENT-NAME, SEX, BDATE, RELATIONSHIP) Write SQL statements for the following queries: a) List the names of those employees who work in the "Production" department (6 marks). b) Find the maximum salary, minimum salary, and the average salary among employees who work for the "Production department (6 marks). Count the...
Answer each of the following questions. The questions are based on the following relational schema: Emp(*eid: integer¬, ename: string, age: integer, salary: decimal, doj: date) Works(*eid: integer, *did: integer, no_of_hours: integer) Dept(*did: integer, dname: string, budget: real, managerid: integer) a) Give an example of a foreign key constraint that involves the Dept relation. b) What are the options for enforcing this constraint when a user attempts to delete a Dept tuple? c) Define the Dept relation in SQL so that...
Complete a decomposition into BCNF for the following relation: Student(ssn, studentName, address, schoolCode, schoolName, schoolCity, gpa, priority) with the functional dependencies: ssn --> studentName, address, gpa, schoolCode gpa --> priority schoolCode --> schoolName, schoolCity You can start with the closure you derived earlier for the same relation. Your output (Answer) should be expressed as a collection of relations all in BCNF. You should also ensure that all Functional Dependencies are paired with the correct derived relations.
Consider the following relational schema. An employee can work in more than one department; the pct time field of the Works relation shows the percentage of time that a given employee works in a given department. Emp(eid: integer, ename: string, phone: integer, salary: real) Works(eid: integer, did: integer, pct_time: integer) Dept(did: integer, dname: string, budget: real, managerid: integer) Write the following SQL queries. d) Find the enames of managers who manage the departments with the largest budgets. e) Find the...
For the relation schema Player (ID, Name, Birthday, Address, Email, PhoneNumber, PlayPos) assume that ID is the primary key and no Player’s names are the same (i.e., a Players’s name can uniquely identify a Player). 1. Please write down all the non-trivial functional dependencies that hold in the schema Player. 2. Please state all the candidate keys of the schema Player.
Consider the following relation R(A,B,C,D,E,G) and the set of functional dependencies F = { A → BCD BC → DE B → D D → A} Give a 3NF decomposition of the given schema based on a canonical cover
Consider the following relation R= {A, B, C, D, E} and the following set of functional dependencies F={ A → BC CD → E B + D E + A} Give a lossless, dependency-preserving decomposition into 3NF of schema R
consider the schema R-(A,B.C,D,E) and the following set F of functional dependencies holds on R ABC CD-E B- D E-A Problem 2. Suppose that we decompose the relation schema R into R, -(A, B, C) and R, (C, D,E). Show that this decomposition is not a lossless-join decomposition.