| Lesson 5 || User views |
| Objective || Explain the role of requirements analysis in creating user views. |
Business Requirements Analysis Creating Views
You have already learned how to create efficient, error-free tables that enable users to
- update, and
records without making any unintended changes to the table data.
The next three modules show you how to create information by extracting data out of the tables.
Requirements Analysis, Information Users Need
During the first phase of the Database Life Cycle, Requirements Analysis
, you interviewed potential users of the database with the purpose of discovering what business
objects would need to be represented in the database and to find out what type of information users would want to derive from that data. This depends on the business objects in the database and each user's job responsibilities.
A rental car company might require a database modeling these objects:
- Vehicles available for rent
- Special offers and their expiration dates
- Maintenance records
- Accident reports
- Details of a specific rental
Customer Service Representative
A customer-service representative would require access to tables storing information about available vehicles, special offers, details of specific rentals, and customers.
Customer-service reps also could be allowed to enter data from accident reports, although the company might choose to limit which reps would be able to examine accident reports.
Once you have determined what information users need, you can create views
to present that information.
A view is a database construct that limits the database objects a user can interact with and can contain calculated fields, which are not allowed in base tables.
Calculations in Views
In our discussion of database elements, we pointed out that you should not perform calculations in a base table because the field containing the calculated value would not derive
its value from a single source. By performing a mathematical operation on the contents of two or more fields, it would derive its value from at least two sources, and violate Codd's first rule of fully relational databases:
"All information in a relational database is represented explicitly at the logical level in exactly one way, by values in tables."
Because calculations are not, strictly speaking, values in tables, calculations violate the rule. Views, however, are not base tables, so they can contain calculations.
(A view creates a virtual table but is not in itself a virtual table.) Some examples of calculations of interest to rental car agency branch managers include:
- What percentage of their fleet is currently available for rent?
- Which makes and models of car have required the most maintenance?
- What percentage of drivers exceeded their agreement's mileage limitations?
- Which car is the most popular?
- What are total revenues?
- What is the total labor cost?
- What is the total maintenance cost?
- What is the profit?
The next lesson discusses how user views are stored in a database.
User Views - Exercise
Before moving on to the next lesson, click the Exercise link below to reinforce your understanding of requirements analysis and user views.
User Views - Exercise
The stage in the database design cycle when designers find out everything they can about the data the client needs to store in the database and the conditions under which that data needs to be accessed.
A database object that enables you to define the columns and rows that a specific user can see. A view can also serve as a tool for enforcing security within your database.