WHAT ARE VIEWS FOR?

So far in this chapter, I’ve been tacitly assuming you already know what views are for—but now I’d like to say something about that topic nonetheless. In fact, views serve two rather different purposes:

  • The user who actually defines view V is, obviously, aware of the corresponding defining expression exp. Thus, that user can use the name V wherever the expression exp is intended; however, such uses are basically just shorthand, and are explicitly understood to be just shorthand by the user in question. (What’s more, the user in question is unlikely to request any updates on V—though if such updates are requested, they must perform as expected, of course.)

  • By contrast, a user who’s merely informed that V exists and is available for use is supposed (at least ideally) not to be aware of the expression exp; to that user, in fact, V is supposed to look and feel just like a base relvar, as I’ve already explained at length. And it’s this second use of views that’s the really important one, and the one I’ve been concentrating on, tacitly, throughout this chapter prior to this point.

Logical Data Independence

The second of the foregoing purposes is intimately related to the question of logical data independence. Recall from Chapter 1 that physical data independence means we can change the way the data is physically stored and accessed without having to make corresponding changes in the way the data is perceived by the user. Reasonably enough, then, logical data independence ...

Get SQL and Relational Theory, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.