Rational Developer for System z


< Previous | Next >

Adding table aliases

This tutorial will guide you through creating an alias for each of the tables in the SELECT statement. An alias is an indirect method of referencing a table so that a SQL statement can be independent of the qualified name of that table. If the table name changes, only the alias definition must be changed.
Table aliases can be added when you add the table to the statement, or after the table is added, by using the context menu in the Tables pane. You can also use this context menu to delete tables or create joins between tables.

The aliases for the CUSTOMERS, RENTALS, and VIDEOS table will be C, R, and V respectively.

  1. In the Tables pane, right-click the header in the CUSTOMERS table, and select Update Alias from the context menu.
  2. In the Change Table Alias window, type C as the alias for the table, and then click OK. In the Tables pane, the alias is shown in the header for the CUSTOMERS table. In the SQL Source pane, the alias is represented by the addition of theAS C code for the CUSTOMERS table.
  3. Repeat steps 1 and 2 to add aliases for the RENTALS (R) and VIDEOS (V) tables.
< Previous | Next >

Feedback