Selecting a table

Which tables and views display?

When you choose Quick Select, the Quick Select dialog box displays. The Tables box lists tables and views in the current database.

NoteDisplaying table comments To display a comment about a table, position the pointer on the table and click the right mouse button, or select the table. The comment displays in the Quick Select dialog box below the list box for tables.

The DBMS determines what tables and views display. SQL Anywhere does not restrict the display, so all tables and views display, whether or not you have authorization.

Tables with key relationships

When you select a table, the table's column names display in the Columns box, and any tables having a key relationship with the selected table display in the Tables box. These tables are indented and marked with an arrow to show their relationship to the selected table. You can select any of these related tables if you want to include columns from them in the DataWindow object.

Figure 17-7: Table and column selection using Quick Select

Shown is the Quick Select page of the Data Window wizard. It has a Tables box at left with employee table selected. Indented below the employee table are the linked department and sales _ order tables. Under the box is the descriptive comment for the selected table.  A Columns list box on the right shows the available columns in the selected table. At the bottom is a scrollable area that remains empty until a column or columns are selected.  The columns you select are added to the row labeled Columns in the scrollable area. The other rows in the scrollable area are labeled Sort, Criteria, and Or. The row labeled Sort displays a drop down list with the values Ascending, Descending, and Not Sorted when you click in the row below a selected column.

Meaning of the up and down arrows

An arrow displays next to a table to indicate its relationship to the selected table. The arrow always points in the many direction of the relationship—toward the selected table (up) if the selected table contains a foreign key in the relationship and away from the selected table (down) if the selected table contains a primary key in the relationship.

Figure 17-8: Arrow direction indicating table key mappings

Shown is a list of tables from the Quick Select page of the Data Window wizard. The sales _ order table is displayed as the selection at the top of the tables list. Under this table are the customer, employee, and fin _code tables, all with arrows pointing up, and the sales _ order _ items table with an arrow pointing down. A foreign key in the sales _ order table is mapped to the primary key in the customer, employee, and fin _ code tables. A foreign key in the sales _ order _ items table is mapped to the primary key in the sales _ order table.

In Figure 17-8, sales_order is the selected table. The Up arrows indicate that a foreign key in the sales_order table is mapped to the primary key in the customer, employee, and fin_code tables. The Down arrow indicates that the sales_order_items table contains a foreign key mapped to the primary key in the sales_order table.

How columns from additional tables display

The column names of selected tables display in the Columns box. If you select more than one table, the column names are identified as:

tablename.columnname

For example, department.dept_name and employee.emp_id display when the Employee table and the Department table are selected.

NoteTo return to the original table list Click the table you first selected at the top of the table list.