中文网站
  Advanced Search
Read the latest Blogs from IT professionals in the field. Read and write community created documents. Need IT help? Ask our staff. Connect with your peers. Check our Tech Shop for posters, books and software tools. Home

4.8.4 Database Systems: Update of a view

1. The view update anomaly previously mentioned in Chapter 3 exists also in SQL.

2. An example will illustrate: consider a clerk who needs to see all information in the loan relation except amount.

Let the view branch-loan be given to the clerk:

create view branch-loan as
select bname, loan#
from loan

Since SQL allows a view name to appear anywhere a relation name may appear, the clerk can write:

insert into branch-loan
values ("SFU", "L-307")

This insertion is represented by an insertion into the actual relation loan, from which the view is constructed.However, we have no value for amount.

This insertion results in ("SFU", "L-307", null) being inserted into the loan relation.
As we saw, when a view is defined in terms of several relations, serious problems can result. As a result, many SQL-based systems impose the constraint that a modification is permitted through a view only if the view in question is defined in terms of one relation in the database.

Database System Structure: