SQL - Structured Query Language

WITH CHECK OPTION - VIEW



WITH CHECK OPTION is used to forces all data modification statements executed against the view to follow the criteria set within select statement. When a row is modified through a view, the WITH CHECK OPTION makes sure the data remains visible through the view after the modification is committed.

The following query is used to create view that helps to list out and maintain System Department Employee Detail by using SQL join concept.

-- Example 59 --

 

USE EBusiness

GO

 

CREATE VIEW EmployeeDepartment

AS

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

WHERE EMP.Dept_Code = DEPT.Dept_Code

AND DEPT.Dept_Name = 'System'

WITH CHECK OPTION

GO

 

SELECT * FROM EmployeeDepartment


Query Output Screen



Note: Any updates performed directly to a view's underlying tables are not verified against the view, even if CHECK OPTION is specified.

* * * * *


Email Your Comment To AUTHOR