The Content Explorer allows you to create queries in a convenient graphical environment. Little or no SQL knowledge is required.
You can only use the Content Explorer to generate ad hoc queries, which cannot be saved to a file or to the repository. However, if you want to save the generated SQL for other purposes, you can copy it from the Generated Query window that can be opened by selecting Generated Query from the View menu. To do so, select the part of the generated query and copy it to the clipboard.
The following procedure uses the PRODUCTS table to generate a simple query that retrieves all attributes from the a table.
Click the table or view name in the Navigation area.
Drag the selected object to the Design area.
Verify the results of the generated query by clicking View the Generated Query.
To create a query using multiple tables
The following procedure uses the PRODUCTS and the SALES table to generate a query that retrieves joined information from two tables.
Click the table PRODUCTS and drag it onto the Design area.
Click the table SALES and drag it onto the Design area.
Create a join between the tables by drawing a link between the fields PR_ID of both tables. The join can also be automatically created if you select the Auto Join Generation option in the Preferences.
To use the Auto Join Generation option
Auto Join Generation is based on identical attribute names used within tables or views. If there are identical names and the Auto Join Generation option is selected, the Query Designer automatically creates a join based on those attributes.
Access the Preferences dialog box by selecting Preferences from the File menu.
Select the Workbench | Query Designer | Auto Join Generation check box in the Preferences dialog box.
To modify the default setting of a join
A join between two tables is indicated by a line that connects the joining fields. The line is labeled with a join operator. The default is Equi Join.
Right-click the line connecting the two joining fields.
Select the Modify command.
Choose a join type from the list:
= EQUI Join
+= Left outer Join
=+ Right outer Join
+=+ Full outer Join
The default setting of the join changes to the type you selected.
To add one attribute to the SELECT clause
Drag the tables to the Design area (if they are not there already).
Click the attribute names you want to add.
Right-click and select Add Items to Selection.
To select more than one attribute to the SELECT clause
Drag the tables to the design area (if they are not there already).
Hold the Ctrl key and click the attributes that you want to add to the SELECT clause.
Right-click and select the Add Items to Selection.
To select all attributes of a selected table to the SELECT clause
Click the header (name) of the table in the Design area.
Right-click and select Add Items to Select.
To view generated SQL statements
To display the statement as currently generated by the Content Explorer, click Generated Query or select Generated Query from the View menu.
To add functions to the SELECT attributes
Click the attribute and right-click to open the pop-up menu.
Select any of the available functions.