|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 --
CREATE VIEW EmployeeDepartment
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
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.
* * * * *