Database Reference
In-Depth Information
Figure 19.2
Querying a View Is
Just Like Querying
a Table.
Now let's take the simple view and add a constraint clause. The result
will be a constraint view.
19.3.2
Creating Constraint Views
A simple view usually allows you to update data in the underlying table
through the view. You will examine this capability later in this chapter.
There is a problem that sometimes crops up when using views to insert or
update data: You can create a record that does not fit the view's query and
therefore does not appear in the view. For example, imagine that you use
the USARTISTS view to update the country from USA to Canada for one
of the artists. You want to check the results, but querying the view no
longer displays the record. It is as if the record disappeared after you
updated it. Obviously, the record is in the table and simply is not displayed
in the view. However, this fact may not be obvious to other users who are
not familiar with the query that is used by the view.
To prevent users from updating or inserting records not fitting within
the view, you create a constraint view. Another good reason to use a con-
straint view is that it provides a form of security. Views are frequently used
to limit a user's access to certain rows and columns within the base table.
The user should not be able to update rows not appearing in the view, but
 
Search WWH ::




Custom Search