Views are derived from tables. Therefore, they share many similarities with tables. Users can query views and, with certain restrictions, perform DML operations on them. The operations performed on views will impact data in certain base tables, and they are controlled by the integrity constraints and triggers of those base tables.
In the following example, a view named staff_dept_10 is defined on the employees table. This view specifically displays information about employees in department 10. By using the CHECK OPTION keyword when creating the view, it indicates that DML operations can only affect the data defined by the view. Therefore, it is possible to insert rows of employees in department 10, but not rows of employees in department 30.
CREATE VIEW staff_dept_10 AS
SELECT employee_id, last_name, job_id, manager_id, department_id
FROM employees
WHERE department_id = 10
WITH CHECK OPTION CONSTRAINT staff_dept_10_cnst;