Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1. Maximum & Minimum number of relations. Table 1: Minimum number of relations Item Qty #Rel Strong Entities 6 6 Weak Entities 2 2 3 3 m-m relationships 1-m, 1-1 relationships 6 4 4 Multi-valued attributes Total 21 15
3a. Get the last name and SSN of employees whose departments are managed by persons that do not have any dependents. E essn (ssn (Employee)) ED essn (Dependent) S E ED D S essn=mgrssn Department R D dnumber=dno Employee R
dnumber=dno
D Table 2: Maximum number of relations Item Qty #Rel Strong Entities 6 6 2 2 Weak Entities m-m relationships 3 3 6 6 1-m, 1-1 relationships 4 4 Multi-valued attributes Total 21 21
essn=mgrssn
Employee
2a. In the three-schema architecture, schemas can be dened at three levels (a) External level (b) Conceptual level and (c) Internal level. Its uses are, 1. Insulation of programs and data (programdata and program-operation independence). 2. Support of multiple user views. 3. Use of a catalog to store the database description (schema).
3b. Get the last name and SSN of employees whose immediate supervisees are all men. SF superssn (sex=F (Employee)) S superssn (Employee) SM (mssn) S SF R lname, (Employee ssn=mssn SM)
ssn
R 2b. What is physical data independence and how is it achieved? Physical data independence is the capacity to change the internal schema without having to change the conceptual schema. Hence, the external schemas need not be changed as well. The physical schema is hidden beyond the logical schema. Physical data independence is achieved by suitably modifying the CL/PL mapping.
lname,
ssn
ssn = mssn
4. Find the project that has the maximum number of employees from the relation numEmp(PID, empCount). PC p,c (numEmp) PLT pid (numEmp P pid (numEmp) R P PLT
5a. Get the last name and SSN of all employees along with the last name and SSN of their respective supervisors. e.lname, e.ssn, s.lname, s.ssn Employee(e)
empcount<c
PC)
Employee(s) e.superssn = s.ssn 5b. Get the projects that have the property that all the persons working on the project belong to the same department. p.pname, p.number Project(p)
= e Employee(e) e.ssn = w.essn e.dno = d.dnumber p.pname, p.number Project(p) w1 e1 WorksOn(w1 ) w1 .pno = p.pnumber Employee(e1 ) e1 .ssn = w1 .essn w2 e2 WorksOn(w2 ) Employee(e2 )
numEmp
p ,c numEmp
R p LE
empcountc
p.pname, p.number Project(p) w1 e1 WorksOn(w1 ) w1 .pno = p.pnumber Employee(e1 ) e1 .ssn = w1 .essn w2 WorksOn(w2 ) w2 .pno = p.pnumber
numEmp
= e2 Employee(e2 ) e2 .ssn = w2 .essn e2 .dno = e1 .dno p.pname, p.number Project(p) w1 w2 e1 e2 WorksOn(w1 ) w1 .pno = p.pnumber WorksOn(w2 ) w2 .pno = p.pnumber Employee(e1 ) e1 .ssn = w1 .essn Employee(e2 ) e2 .ssn = w2 .essn e2 .dno = e1 .dno E N D 2