Suppose now that you want to add a condition to the SQL statement
in the previous exercise (see Advanced: the completed
statement (example 2))
to show only rows of the table PARTS with a part number greater than
12456:
Press the Exit function key (F3) to return to the syntax for the
subselect clause.
Process Options Utilities Help
──────────────────────────────────────────────────────────────────────────────
FM/Db2 (DFG2) Advanced SELECT Prototyping
Prototyping: subselect clause Status: statement complete
─ select ─ from ─┬─────────┬─┬───────────┬─┬──────────┬─
└─ where ─┘ └─ groupby ─┘ └─ having ─┘
SELECT DISTINCT * FROM PARTS
Command ===> _____________________________________________________ Scroll PAGE
F1=Help F2=Split F3=Exit F4=Deselect F5=InsRpt F6=Executed
F7=Backward F8=Forward F9=Swap F10=PrvRpt F11=NxtRpt F12=Cancel
Move the cursor to the where fragment.
Press Enter. The syntax for the WHERE clause is displayed.
Process Options Utilities Help
──────────────────────────────────────────────────────────────────────────────
FM/Db2 (DFG2) Advanced SELECT Prototyping
Prototyping: where clause Status: clause incomplete
─ WHERE ─ srchcon ─
SELECT DISTINCT * FROM PARTS WHERE
Command ===> _____________________________________________________ Scroll PAGE
F1=Help F2=Split F3=Exit F4=Deselect F5=InsRpt F6=Executed
F7=Backward F8=Forward F9=Swap F10=PrvRpt F11=NxtRpt F12=Cancel
Notice that FM/Db2 has added the required keyword WHERE
to the SQL statement.
Move the cursor to the srchcon fragment.
Press Enter. The syntax for the search condition clause is displayed.
Process Options Utilities Help
──────────────────────────────────────────────────────────────────────────────
FM/Db2 (DFG2) Advanced SELECT Prototyping
Prototyping: search condition clause Status: clause incomplete
◄───────────────────────────────────────────┐
─┬───────┬─┬─ predicate ───┬───┬───────────────────────────────────────┬─┴─
└─ NOT ─┘ └─(─ srchcon ─)─┘ └─┬─ AND ─┬─┬───────┬─┬─ predicate ───┬─┘
└─ OR ──┘ └─ NOT ─┘ └─(─ srchcon ─)─┘
SELECT DISTINCT * FROM PARTS WHERE
Command ===> _____________________________________________________ Scroll PAGE
F1=Help F2=Split F3=Exit F4=Deselect F5=InsRpt F6=Executed
F7=Backward F8=Forward F9=Swap F10=PrvRpt F11=NxtRpt F12=Cancel
Move the cursor to the first predicate fragment.
Press Enter. The syntax for the predicate clause is displayed.
Have feedback? Google Analytics is used to store comments and ratings. To provide a comment or rating for a topic, click Accept All Cookies or Allow All in Cookie Preferences in the footer of this page.