SQL Views   «Prev 

What is a view in SQL?

The people responsible for developing the database schema and those who write application programs for use by non-technical users have knowledge of the entire schema, including direct access to the base tables of the database. However, it is usually undesirable to have end users working directly with base tables, primarily for security reasons. The relational data model includes a way to provide IT users with their own view of the database. This view hides the details of the overall database design and prohibits direct access to the base tables which should not be accessed.

CustomerTable explained in the following diagrams

1) Columns for a table named MyTable

2) You can think of a view as a window into the database. This particular view represents the statement;
SELECT * FROM MyTable WHERE State = 'UT'

SQL Programming
3) In one particular instance, you might use the view (i.e., look through the window) and see the customer name Jane Doe, whose customer ID=1234

4) The next time you use the same view, (look through the same window) you may see different data.