Example 4 (Removing part of the SQL statement)
To remove part of a SELECT statement you have built using advanced SELECT prototyping, use the Deselect function key (F4). The effect of the Deselect function key depends on which fragment of the syntax is currently active. For more information, see the description of the DESELECT command.
Suppose that you want to remove the condition you added to the SQL statement in the previous exercise (see Advanced: the completed statement (example 3)) that restricted the rows shown to those with a part number greater than 12456. This means that you need to remove the WHERE clause from the SELECT statement.
You can remove the WHERE clause by either of these methods:
- Using the Deselect function key (F4):
- Place the cursor on the WHERE clause in the generated SELECT statement.
- Press Enter to select the WHERE clause. It changes to green, and the syntax for the WHERE clause is redisplayed.
- Place the cursor on the command line.
- Press the Deselect function key (F4).
- Returning to the prototyping panel that contains the where fragment
and
deselecting
it:Note: The following steps assume the current panel on your screen is the last panel in Example 3 as shown in Advanced: the completed statement (example 3).- Press the Exit function key (F3). FM/Db2 returns you to the syntax for the basic predicate clause.
- Press the Exit function key (F3). FM/Db2 returns you to the syntax for the predicate clause.
- Press the Exit function key (F3). FM/Db2 returns you to the syntax for the search condition clause.
- Press the Exit function key (F3). FM/Db2 returns you to the syntax for the WHERE clause.
- Press the Exit function key (F3). FM/Db2 returns you to the syntax for the subselect clause. This panel contains the where fragment.
- Move the cursor to the where fragment.
- Press the Deselect function key (F4). The panel shows the SELECT statement without the WHERE clause:
SELECT DISTINCT * FROM PARTS
Related tasks