Specifying result columns

Use the Columns page to specify the columns that will be included in the result set. The column names are displayed in the SELECT clause of the SQL statement on the Review page.

If you do not specify any columns, all columns are selected, because the default SQL statement that is generated is SELECT * FROM tablename.

../rule.gif

To specify columns:

  1. Click on one or more columns in the Available columns list. The list displays all of the columns that are in the tables specified on the Tables page. You can expand or collapse a table to display or hide the columns that are included in that table.

  2. Click > to add the columns to the Selected columns list. Click >> to add all of the columns from all of the tables in the Available columns list to the Selected columns list.

  3. To remove one or more columns from the Selected columns list, click on the columns, then click <. To remove all of the columns from the Selected columns list, click <<.

The columns will be displayed in the result set in the same order that they are specified in the Selected columns list. To change the order, click on a column name, then click Move Up or Move Down.

Creating column expressions

You can add column expressions to your SQL statement. For example, suppose you have a column called SALARY, another column called BONUS, and a third column called COMM. You want your result set to contain the sum of the data in these three columns. You can create a column expression called TOTAL_COMP to sum the values in the SALARY, BONUS, and COMM columns.

To create a column expression, click Add. The Expression Builder - Columns window is displayed. Build your expression or type it in the Expression field, then click OK.

After you build a column expression, you can change it by clicking on the column name in the Selected columns list on the Columns page, then clicking Edit. The Expression Builder - Columns window is displayed.

For help on using the Expression Builder, see Building expressions.

../rule.gif

Related information

Columns page - Fields and controls

Specifying the tables for an SQL statement

Joining tables

Specifying search conditions for rows

Grouping rows and specifying search conditions for groups

Sorting the result set

Verifying the SQL statement

Inserting column values

Updating column values

Completing your SQL statement

Remapping data to another SQL data type

Creating SQL statements with SQL Assist

Logging on to SQL Assist

Selecting the type of SQL statement to create