Uploaded by Haseeb Ur Rehman

Assignment 3(DB, Haseeb ur rehman,17-arid1320)

advertisement
University Institute of Information Technology
_____________________________________________________________________________________
Subject Title:
DDBMS
Assignment #3
Submitted By:
Haseeb ur rehman
Arid-NO:
17-ARID-1320
Submitted To:
MAAM Saba Un Nisa
Submitted Date:
19-MAY-2020
University Institute of Information Technology Rawalpindi
1.Simple view:
CREATE VIEW empvu10 AS
SELECT eid, ename, edepart
FROM employee
WHERE eid = 10;
2.Complex view:
CREATE VIEW employee_payscale (name, minsal, maxsal, avgsal) AS
SELECT p.PNAME, MIN(e.ESALARY), MAX(e.ESALARY), AVG(e.ESALARY)
FROM employee e, project p
WHERE e.eid = p.pid
GROUP BY p.PNAME;
3.View with a check constraint:
CREATE OR REPLACE VIEW empvu10 (employee_number, employee_name,
job_title) AS
SELECT eid, ename, EDEPART
FROM employee
WHERE eid = 10
WITH READ ONLY;
4.Modify data in the view:
CREATE OR REPLACE VIEW empvu10 (employee_number, employee_name,
job_title) AS
SELECT eid, ename, EDEPART
FROM employee
WHERE eid = 10;
5.Display View definitions:
select * from empvu10;
select * from employee_payscale;
6.Removing views:
DROP VIEW empvu10;
DROP VIEW employee_payscale:
Download