Chapter 9. SQL and Views
INTUITIVELY, THERE ARE SEVERAL DIFFERENT WAYS OF LOOKING AT WHAT A VIEW IS, ALL OF WHICH ARE VALID AND ALL OF WHICH CAN BE HELPFUL IN THE RIGHT CIRCUMSTANCES:
A view is a virtual relvar; i.e., it’s a relvar that “looks and feels” just like a base relvar but (unlike a base relvar) doesn’t exist independently of other relvars—in fact, it’s defined in terms of such other relvars.
A view is a derived relvar; in other words, it’s a relvar that’s explicitly derived (and known to be derived, at least by some people) from certain other relvars. Note: If you’re wondering what the difference is between a derived relvar and a virtual one, I should explain that all virtual relvars are derived but some derived ones aren’t virtual. See the section “Views and Snapshots” later in the chapter.
A view is a window into the relvars from which it’s derived; thus, operations on the view are to be understood as “really” being operations on those underlying relvars.
A view is what some writers call a “canned query” (or, more precisely, a named relational expression).
As usual, in what follows I’ll discuss these concepts in both relational and SQL terms. Regarding SQL specifically, however, let me remind you of something I said in Chapter 1: A view is a table!—or, as I would prefer to say, a relvar. SQL documentation often uses expressions like "tables and views,” thereby suggesting that tables and views are different things—but they’re not; in many ways, in fact, it’s the whole point ...