Online Documentation for SQL Query for DB2
Working with Query Builder area
The main working area of Visual Query Builder is the Builder area. Here you can create a query by placing the database tables and views onto the area, and edit it by selecting the required data fields and setting links between objects.
To add an object to the query, you can simply drag it from the DB Explorer tree to the Builder area.
To include a field in the query, check the corresponding box located to the left from the field name in the list, or just double-click it. To include all fields of the table/view, check the box located to the left of the table/view caption. If you do not check any fields, the SQL statement is generated as SELECT * FROM <table/view_name>, i.e. all the fields are included in the query.
To exclude a field from the query, uncheck the respective box. In order to remove the entire table/view from the query, close it by clicking the corresponding cross-button at the object caption, or select the object and press the Del key.
To edit the alias of a table/view, double-click the object caption and enter the new name.
Note: Depending on which query type you need to execute, you can select one from the drop-down list at the left: Select, Insert, Update, or Delete.
To create a Union or a Subquery use the Builder context menu.
Creation of a Union is reflected in UNION statement in the query text or UNION ALL statement if the Union all by default option is enabled. Union is used to combine several queries.
Create Subquery to use it as a source for the main query.