NonStop Systems Introduction
The Relational Database Management System
NonStop Systems Introduction—527825-001
4-4
Logical Views of Data
Views simplify the query process for end users by freeing them from having to
remember which columns are in which tables. In addition, views screen out sensitive
or unneeded data.
Once a view exists, you can select from the view as if it were an ordinary table. For
example, suppose a mail room needs a quick, easy way to find out the department
name for an employee when an envelope addressed to the employee has no
department name or has the wrong department name.
The mail room staff could select from VIEW1 (the view shown in Figure 4-2) each time
this situation comes up. Alternatively, because the situation occurs often, they could
run a very fast application that asks users to supply input values for FNAME and
LNAME and displays the value of DEPTNAME as output.
If the mail room staff selects from the view directly rather than by means of an
application, they can find out the department name for an employee named Jerry
Howard by making the following query:
SELECT DEPTNAME
FROM VIEW1
WHERE FNAME = "JERRY"
AND LNAME = "HOWARD";
Figure 4-2. A Logical View Derived From Two Tables
1
2
3
568
ROGER
JERRY
JESSICA
GREEN
HOWARD
CRINER
4000
1000
3500
100
200
300
75500.00
37000.00
39500.00
EMPLOYEE TABLE
• • • • • • • • • • • • • • • • • •
EMPNUM FNAME LNAME DEPTNUM JOBCODE SALARY
VST045.vdd
DEPARTMENT TABLE
1000
1500
FINANCE
PERSONNEL
23
213
9000
1000
CHICAGO
CHICAGO
CHICAGO
9000
81
• • • • • • • • • • • • • • •
DEPTNUM DEPTNAME MGR RPTDEPT LOCATION
JERRY
ROBERT
HOWARD
VIEW1
ROGER
FINANCE
CORPORATE
PERSONNEL
GREEN
WHITE
• • • • • • • • •
FNAME LNAME DEPTNAME