written 8.0 years ago by | modified 2.9 years ago by |
Mumbai University > Information Technology > Sem 3 > Database Management System
Marks: 10M
Year: May 2016
written 8.0 years ago by | modified 2.9 years ago by |
Mumbai University > Information Technology > Sem 3 > Database Management System
Marks: 10M
Year: May 2016
written 8.0 years ago by |
Definition of Views:
Creation of View:
Following is the syntax of view.
CREATE VIEW viewname AS
SELECT column1, column2
FROM tablename
WHERE columnname=expressionList;
Consider a table Tbl_Employee with the fields Emp_ID, Emp_Name, Emp_DOB, Emp_Address, Emp_DateOfJoining, Emp_Gender, Emp_EmailID. Following is the view vw_EmployeeContactDetails which contains the name and Email ID of the employee.
CREATE VIEW vw_EmployeeContactDetails SELECT Emp_Name, Emp_EmailID FROM Tbl_Employee
It results in the creation of view. To fetch the items of view, a select statement can be written as follows:
SELECT * FROM vw_EmployeeContactDetails
DROP VIEW viewname
Example: To drop the view vw_EmployeeContactDetails, following SQL statement must be executed:
DROP VIEW vw_EmployeeContactDetails