Filters
Use filters to display a formatted view of specific DB2 data in the Data window. Specify the filter criteria depending on your the type of data that you want to see and the data type of the columns.
If you do not have permissions to submit a query on an object, use a different SQLID for submitting.
Column Selection
Use the Column Selection section of the Layout-Filter dialog to select the required columns from the object. Only the selected columns are displayed and populated in the Data Window. You cannot move the not-null and primary key columns from the Selected Columns list to the Available Columns list.
Example:
An employee table contains employee number, employee name and salary columns. You can choose only to display employee number and employee name columns in the Data Window.
Follow these steps:
-
Right-click on an object from Data Source Explorer.
-
Select the Browse option.
The Layout-Filter dialog appears. -
(Optional) Select the columns from the Selected Columns list that you do not want to be displayed and click Remove.
The selected columns are moved from the Selection Columns list to the Available Columns list. All the columns of the object are available in the Selected Columns list by default. -
Arrange the columns in an order using the Move Up and Move Down buttons.
When the Data Window is populated with the object's data, the selected columns are displayed in the same order.
After you select and arrange the required columns in an order, specify the other filter criteria.
Where Clause
To receive only records that match the specified criterion, use the Where Clause section of the Filter-Layout dialog. A where clause helps you narrow down the search results of an object.
Example: Specify to return rows only when the employee name is JOHN from an employee table.
Follow these steps:
-
Select the field below the Start Bracket heading and select ( from the drop-down list. The right parenthesis ( specifies the start of the where clause.
-
Click <--SELECT COLUMN--> and select a column from the drop-down list.
-
Click the = field and select an operator depending upon the data type of the column from the drop-down list. The operator depending on the data type of the column. The available operators are:
-
=
Specifies equal. -
<>
Specifies not equal. -
>
Specifies greater than. -
<
Specifies less than. -
<=
Specifies greater than or equal to. -
>=
Specifies less than or equal to. -
LIKE
Specifies like predicate. -
IN
Specifies that a value must be in the form of value1, value2, and so on. -
NOT IN
Specifies that a value is in a group of values. -
IS NULL
Specifies that a value is null. -
IS NOT NULL
Specifies that a value is not null.
-
-
Select the field below the Value heading and enter the field value that you are searching for.
-
Select the field below the End Bracket heading and select ) from the drop-down list. The left parenthesis ) specifies the end of a where clause.
-
(Optional) If you want to specify a where clause for another column, select the field below the Conjunction and select a conjunction, AND or OR.
-
AND
Indicates that a row must meet all the conditions. -
OR
Indicates that a row must meet only one of the conditions.-
Click the + field next to the conjunction column.
A row is added for another Where Clause. -
Repeat the steps 1 through 5 for a column.
-
-
After adding Where Clause for the required columns, specify the other filter criteria.
Order By Clause
Order By is an optional clause that sorts and displays data in a column in ascending or descending order for a SELECT statement.
Follow these steps:
-
Click the Order By pane.
The Order By section appears. -
Select one or more columns from the Available Columns list.
-
Move the selected columns to the Selected Columns list using Add > button.
-
Arrange the selected columns in an order using the Move up and Move down buttons.
-
Select a column name from the Selected Columns list and select ASC for ascending or DESC for descending order.
Modify a Filter
You can modify a filter even after an object's filtered data is populated in the Data Window.
To modify an existing filter, click the modify existing filter icon and update the filter criteria as required.