Creating a Table Alias in Information Designer


You can create a duplicate reference to a database table from Information Designer. This duplicate is called a Table Alias, and references the very same data, only using an alias. This can be useful in certain cases, most often when in need of a self join within a table (below).

  1. Select a table on the Data Sources tab.

  2. Right-click the table and select Create Table Alias.

    id_table_alias_1.png

  3. Type a name for the table alias and click OK.

    Response: A table alias of the table is created.

Self Joins

A self join is a join from a table to itself. In Information Designer this is implemented by using a table alias.

ID

Name

Manager

1

Sarah

2

2

Mike

3

3

Carla

Null

4

Vincent

2

5

Adrian

3

 

The above database table lists a number of employees at a company, and specifies who the manager of each employee is. Carla is the head of the department. Mike and Adrian report directly to Carla, whereas Sarah and Vincent report to Mike.

In order to produce a list where the ID stated in the Manager column is replaced by a name (see below), we would need a self join in the table. The table needs to look up the ID column in itself.

Name

Manager

Sarah

Mike

Mike

Carla

Carla

 

Vincent

Mike

Adrian

Carla

 

This is done by first creating a Table Alias of the table, and then creating a join between the table and its alias:

WHERE TABLE.ID=TABLE_ALIAS1.MANAGER

See also:

Data Sources Overview

Joins Overview