14.1. Reasons to Use Views


Views provide several benefits compared to selecting data directly from base tables:

  • Access to data becomes simplified:

    • A view can be used to perform a calculation and display its result. For example, a view definition that invokes aggregate functions can be used to display a summary.

    • A view can be used to select a restricted set of rows by means of an appropriate WHERE clause, or to select only a subset of a table's columns.

    • A view can be used for selecting data from multiple tables by using a join or union.

    A view performs these operations automatically. Users need not specify the expression on which a calculation is based, the conditions that restrict rows in the WHERE clause, or the conditions used to match tables for a join.

  • Views can be used to display table contents differently for different users, so that each user sees only the data pertaining to that user's activities. This improves security by hiding information from users that they should not be able to access or modify. It also reduces distraction because irrelevant columns are not displayed.

  • If you need to change the structure of your tables to accommodate certain applications, a view can preserve the appearance of the original table structure to minimize disruption to other applications. For example, if you split a table into two new tables, a view can be created with the name of the original table and defined to select data from the new tables such that the view appears to have the original table structure.



MySQL 5 Certification Study Guide
MySQL 5.0 Certification Study Guide
ISBN: 0672328127
EAN: 2147483647
Year: 2006
Pages: 312

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net