The view is now essentially finished, but for this example, you only
want to view those items that have been ordered in the last 14 days. To specify
this information, you need to create a WHERE clause:
- Click Select Rows.
- On the Select Rows window, enter the following command: WHERE
LAST_ORDER_DATE > CURRENT DATE - 14 DAYS. You can select the elements
that make up this WHERE clause by selecting them from the options shown, or
you can enter them in the Clause field.
- Click OK.
- To view the SQL used to generate this view, click Show SQL.
- Click OK to create the view.
- To display the contents of RECENT_ORDERS, right-click RECENT_ORDERS
and select View Contents.
You should see the following information displayed:
ITEM_NUMBER |
LAST_ORDER_DATE |
QUANTITY_ON_HAND |
303476 |
2003-09-22 |
100 |
In the preceding example, the columns in the view
have the same name as the columns in the table because you did not specify
new names. The schema that the view is created into does not need to be the
same schema as the table it is built over. You can use any schema.