Professional Documents
Culture Documents
SYSTEMS
ASSIGNMENT 2
REG NO SCT221-0235/2021
Identify the primary, (alternate) and foreign keys in your 3NF relations
b. Create a view called Basic_Employee_Details that shows only the names and
addresses of the employees
CREATE VIEW Basic_Employee_Details AS
SELECT Fname ,Lname ,Address
FROM employee
WHERE Dno = 5
c. A view that has the department name, manager name, and manager salary for
every department
CREATE VIEW manager_information AS
SELECT Dname AS Department _name .Fname AS First_name ,Lname AS
Last_name,salary
FROM employee , department
WHERE Mgr_ssn=SSN;
d. A view that has the employee name, supervisor name, and employee salary for
each employee who works in the ‘Research’ department
CREATE VIEW Research _Dept AS
SELECT Fname ,Lname ,Salary ,Super_ssn AS Supervisor_name
FROM employee
WHERE Dno=5
ORDER BY Salary DESC;
e. A view that has the project name, controlling department name, number of
employees, and total hours worked per week on the project for each project
CREATE VIEW project _information AS
SELECT DISTINCT Pname AS Project _name,Dname AS
Department _name ,Hours_per_week,COUNT(Dnum)AS Employees
FROM worksonhours,department ,employee,project
WHERE Essn = SSN AND Dno = Dnumber AND Pno =Pnumber
GROUP BY Pno;