Create view is_student
As
Select SnO, sname, sage
From student
Where sdept = 'is'
With check Option;
With check option;, the insert operation cannot be performed:
Insert into is_student
Values ('20140901', 'lila', 12)
Why? Do not addWith check OptionYes!
With check OptionIt can be explained as follows:The modified view must also be used to view the modified result.. For example, if you insert, the added record must be visible after refreshing the view;
If it is modified, the modified results must be displayed in this view. If it is deleted, you can only delete the records displayed in the view.
However, you only query the sdept = 'is' record. What you insert does not comply with sdept = 'is' at all, so it won't work.
that is to say, when executing insert, sdept is 'is' by default to meet with check option, right?
Does DBMS automatically add sdept = 'is? Because in the view is_student, all the ISIS selected. students!