Selecting tables and views

After you have chosen SQL Select, the Select Tables dialog box displays in front of the Table Layout view of the Select painter. What tables and views display in the dialog box depends on the DBMS. For some DBMSs, all tables and views display, whether or not you have authorization. Then, if you select a table or view you are not authorized to access, the DBMS issues a message.

For ODBC databases, the tables and views that display depend on the driver for the data source. Adaptive Server Anywhere does not restrict the display, so all tables and views display, whether or not you have authorization.

StepsTo select the tables and views:

  1. Do one of the following:

Representations of the selected tables and views display. You can move or size each table to fit the space as needed.

Below the Table Layout view, several tabbed views also display by default. You use the views (for example, Compute, Having, Group) to specify the SQL Select statement in more detail. You can turn the views on and off from the View menu on the menu bar.

The sample shows the Table Layout view of the Select painter. The view displays the contents of department and employee tables, listing the columns in each. The label and datatype for each column is shown, and the tables are joined at the dept _ i d column. The syntax tab view at the bottom of the sample screen displays a sequel Select statement.

Specifying what is displayed

You can display the label and datatype of each column in the tables (the label information comes from the extended attribute system tables). If you need more space, you can choose to hide this information.

StepsTo hide or display comments, datatypes, and labels:

  1. Position the pointer on any unused area of the Table Layout view and select Show from the pop-up menu.

    A cascading menu displays.

  2. Select or clear Datatypes, Labels, or Comments as needed.

Colors in the Select painter

The colors used by the Select painter to display the Table Layout view background and table information are specified in the Database painter. You can also set colors for the text and background components in the table header and detail areas.

For more information about specifying colors in the Database painter, see “Modifying database preferences”.

Adding and removing tables and views

You can add tables and views to your Table Layout view at any time.

Table 18-3: Adding tables and views in the Select painter

To do this

Do this

Add tables or views

Click the Tables button in the PainterBar and select tables or views to add

Remove a table or view

Display its pop-up menu and select Close

Remove all tables and views

Select Design>Undo All from the menu bar

You can also remove individual tables and views from the Table Layout view, or clear them all at once and begin selecting a new set of tables.

How PowerBuilder joins tables

If you select more than one table in the Select painter, PowerBuilder joins columns based on their key relationship.

For information about joins, see “Joining tables”.