Use the WITH CHECK OPTION keywords
You can insert into a view a row that does not satisfy the conditions of the view; that is, a row that is not visible through the view. You can also update a row of a view so that it no longer satisfies the conditions of the view.
CREATE VIEW response (user_id, received, resolved, duration) AS
SELECT user_id,call_dtime,res_dtime,res_dtime - call_dtime
FROM cust_calls
WHERE user_id = USER
UPDATE response SET user_id = 'lenora'
WHERE received BETWEEN TODAY AND TODAY - 7
CREATE VIEW response (user_id, received, resolved,duration) AS
SELECT user_id, call_dtime, res_dtime, res_dtime - call_dtime
FROM cust_calls
WHERE user_id = USER
WITH CHECK OPTION
The preceding UPDATE operation by user tony is rejected as an error.
CREATE VIEW order_insert AS
SELECT * FROM orders O
WHERE order_date = TODAY -- no back-dated entries
AND EXISTS -- ensure valid foreign key
(SELECT * FROM customer C
WHERE O.customer_num = C.customer_num)
AND ship_weight < 1000 -- reasonableness checks
AND ship_charge < 1000
WITH CHECK OPTION
Because of EXISTS and other tests, which are expected to be successful when the database server retrieves existing rows, this view displays data from orders inefficiently. However, if insertions to orders are made only through this view (and you do not already use integrity constraints to constrain data), users cannot insert a back-dated order, an invalid customer number, or an excessive shipping weight and shipping charge.