SQL - Structured Query Language

CREATE View



To create a view, type CREATE VIEW expression followed by a view name and then use AS keyword to define view with specific SELECT query. The following query is used to create view that helps to list out Employee Detail with Department Name by using SQL join concept.

-- Example 54 --

 

USE EBusiness

GO

 

CREATE VIEW EmpDept

AS

SELECT EMP.Emp_Code, EMP.Emp_Name, EMP.Dept_Code, DEPT.Dept_Name FROM EMP, DEPT

WHERE EMP.Dept_Code = DEPT.Dept_Code

GO

 

SELECT * FROM EmpDept


Query Output Screen



* * * * *


Email Your Comment To AUTHOR