Advantages of Views

To clarify the advantages of using views, consider several possible users of the bookbiz database. Let's say that the promotion manager needs to know which authors are connected to which books and who has first, second, and third billing on the cover. Prices, sales, advances, royalties, and personal addresses are not of interest, but the promotion manager does need some information from each of the three tables: titles, authors, and titleauthors. Without a view, a query something like the following might be used:

SQL
select titles.title_id, au_ord, au_lname, au_fname
from authors, titles, titleauthors
where authors.au_id = titleauthors.au_id and
     titles.title_id = titleauthors.title_id

This query involves a lot of typing, ...

Get Practical SQL Handbook, The: Using SQL Variants, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.