3.30. View Data

The View Data option enables you to browse the data in tables and views. Right-click on any table or view to bring up the context menu, then choose VIEW DATA to bring up the Data Viewer dialog.

Figure 3-91. The Data Viewer Dialog

3.30.1. Selection Criteria And Ordering Options

By default, the Data Viewer displays all tuples contained in the relation in question (up to the limit on the number of results to be shown). However, you can filter and sort the tuples. To filter the data, use the Where, Limit Results To First, Offset, and Show OIDs options. To sort the data, use the Order By option.

Figure 3-92. The Data Viewer Dialog: Options

The Where field allows you to display only the tuples that satisfy a specified condition; this field corresponds to the WHERE clause of a SELECT statement. For example, if viewing a table column col_name of type Integer, you could display only tuples that have a value greater than 100 by typing in the Where field:

col_name > 100

The Order By field allows you to sort the results in ascending or descending order; this field corresponds to the ORDER BY clause of a SELECT statement. For example, entering col_name or col_name asc sorts the results in ascending order (by default, ascending order is assumed, so the asc is not necessary). To order results by more than one data field, type in a comma-separated list of columns.

The Limit Results To First field allows you to specify the maximum number of tuples to be displayed; this field corresponds to the LIMIT clause of a SELECT statement. To set the default for this field, choose Preferences => Data Viewer Configuration. In the Configure Data Viewer dialog that appears, you can set the maximum number of results displayed, the number of tuples to display on each page of results, and whether or not to display the values for the oid field when viewing (user-defined) table data.

Figure 3-93. The Configure Data Viewer Dialog

The Offset field allows you to specify the number of tuples (at the beginning of the set of result tuples) to be skipped over when displaying the data; this field corresponds to the OFFSET clause of a SELECT statement. By default this number is 0 (skip no results).

The Show OIDs check button allows you to specify whether or not to display the OID column of the relation when displaying data. Currently, this option is only available when viewing data from user-defined tables. For viewing data from system tables or views, this option is greyed out. To set the default for this option, choose Preferences => Data Viewer Configuration and set the default on the Configure Data Viewer dialog that appears.

3.30.2. Data Display

Data in the Data Viewer dialog is displayed in the standard tabular format, with column headers indicating the fields of the relation, and all other rows being the tuples in the relation.

Figure 3-94. The Data Viewer Dialog: Table Data Display

For columns whose values are too long to be displayed in a particular table cell, only a portion of the contents are shown. However, you can view the rest of the contents by resizing the column width. To resize the column width, move your cursor between two column headers until the cursor becomes a bi-directional arrow (<->), then click and drag the cursor until the column width is adjusted to your liking.

3.30.3. Page Options And Status Information

Just as web search results are served up over a sequence of pages, relational data in this dialog is also displayed over a number of pages.

Just below the table displaying the relational data is a row of options and indicators that provide page information. These options allow for both linear and non-linear traversal across the pages that contain the data.

Figure 3-95. The Data Viewer Dialog - Page Options and Status Information

In Figure 3-95, the Tuples Per Page field allows you to specify the number of tuples on each page. If you change this value, you can reorganize the current data in the dialog by pressing [Enter] while the focus is in the entry box, or by clicking the Set button. You can set the default value by choosing Preferences => Data Viewer Configuration and setting the default on the Configure Data Viewer dialog that appears.

The Jump To Page field allows you to go to a particular data pages; the current page information is displayed on the left. When you enter that page number, the Go button becomes enabled; click the Go button to be taken to that page. The remaining buttons enable you to page through the data.

In addition to the page information provided, the Data Viewer dialog also provides status information for the SQL SELECT statement used to retrieve the data displayed in the dialog. It also shows the current subset of tuples shown, the total number of tuples in the result, and the best estimate of the total number of tuples in the relation.