Previous Topic: Operation CommandsNext Topic: SQL Keywords


DQL Statements

FIND Statement with Count

►►─ FIND ─┬─────────┬─ table-name ─┬────────────┬─┬────────┬──────────────────►
          └─ count ─┘              └─ (status) ─┘ └─ ROWS ─┘

 ►─┬───────────────┬─┬───────────────────────┬────────────────────────────────►◄
   └─ with-clause ─┘ └─ relationship-clause ─┘

COUNT Statement

►►─ COUNT ─ table-name ─┬────────────┬─┬────────┬─┬───────────────┬───────────►
                        └─ (status) ─┘ └─ ROWS ─┘ └─ with-clause ─┘

 ►─┬───────────────────────┬──────────────────────────────────────────────────►◄
   └─ relationship-clause ─┘

WITH Clause in a FIND Statement

►►─ FIND ─┬─────────┬─ table-name ─┬────────────┬─┬────────┬─┬────────┬───────►
          └─ COUNT ─┘              └─ (status) ─┘ └─ ROWS ─┘ └─ WITH ─┘

 ►─ operand1 ─ comparison-operator ─ operand2 ─┬───────────┬──────────────────►◄
                                               └─┬─ AND ─┬─┘
                                                 └─ OR ──┘

WITH Clause in a RELATED BY Statement

►►─ FIND ─┬─────────┬─ table-name ─┬────────────┬─┬────────┬─ RELATED ────────►
          └─ COUNT ─┘              └─ (status) ─┘ └─ ROWS ─┘

 ►─┬──────┬─ key-name ─┬───────┬─┬──────┬─┬─────────┬─ table-name ────────────►
   └─ BY ─┘            └─ KEY ─┘ └─ TO ─┘ └─ FIRST ─┘

 ►─┬────────────┬─┬───────┬─┬────────┬─ operand1 ─ comparison-operator ───────►
   └─ (status) ─┘ └─ ROW ─┘ └─ WITH ─┘

 ►─ operand2 ─┬───────────┬───────────────────────────────────────────────────►◄
              └─┬─ AND ─┬─┘
                └─ OR ──┘

WITH Clause Arithmetic Expression

►►─┬────────┬─ operand1 ─ comparison-operator ─ operand2 ─────────────────────►◄
   └─ WITH ─┘

RELATED OUTER-JOINED, LEFT-JOINED, RIGHT-JOINED, OUTER-DISJOINED, LEFT-DISJOINED, RIGHT-DISJOINED

Complex Relationship

►►─ relationship-word ─┬──────┬───────────────────────────────────────────────►
                       └─ BY ─┘

 ►─┬─ common-key-join ───────────────────────┬─┬──────┬─┬─────────┬───────────►
   └─ complex-join-key ─┬───────┬─ key-name ─┘ └─ TO ─┘ └─ FIRST ─┘
                        └─ VIA ─┘

 ►─ table-name ─┬────────────┬─┬───────┬──────────────────────────────────────►◄
                └─ (status) ─┘ └─ ROW ─┘

Simple Relationship Statement

►►─ relationship-keyword ─┬──────┬─ key-name ─┬───────┬─┬──────┬──────────────►
                          └─ BY ─┘            └─ KEY ─┘ └─ TO ─┘

 ►─┬─────────┬─ table-name ─┬────────────┬─┬───────┬──────────────────────────►◄
   └─ FIRST ─┘              └─ (status) ─┘ └─ ROW ─┘

Outer Join Clause

►►─ FIND ALL TABLE1 ─┬───────────┬─ outer-join-clause ─ 'key1' ─ VIA ─ key2 ──►
                     └─ RECORDS ─┘

 ►─ TO TABLE2 ────────────────────────────────────────────────────────────────►◄

RELATED BY with a WITH Clause

►►─ RELATED ─┬──────┬─ key-name ─┬───────┬─┬──────┬─┬─────────┬─ table-name ──►
             └─ BY ─┘            └─ KEY ─┘ └─ TO ─┘ └─ FIRST ─┘

 ►─┬────────────┬─┬───────┬─┬────────┬─ operand1 ─ comparison-operator ───────►
   └─ (status) ─┘ └─ ROW ─┘ └─ WITH ─┘

 ►─ operand2 ─┬───────────┬───────────────────────────────────────────────────►◄
              └─┬─ AND ─┬─┘
                └─ OR ──┘

SET

►►─ SET ─ result ─┬─────────┬─┬─ numeric-column-name ───┬─────────────────────►◄
                  └─ (n.d) ─┘ ├─ arithmetic-expression ─┤
                              └─ numeric-literal ───────┘

SET Statement with a Numeric Column Result

►►─ SET ─ result ─┬─────────┬─ =numeric-column-name ──────────────────────────►◄
                  └─ (n.d) ─┘

SET Statement with an Arithmetic Expression Result

►►─ SET ─ result ─┬─────────┬─ =arithmetic-expression ────────────────────────►◄
                  └─ (n.d) ─┘

SET Statement with a Numeric Literal Result

►►─ SET ─ result ─┬─────────┬─ =numeric-literal ──────────────────────────────►◄
                  └─ (n.d) ─┘

Mathematical Functions (Standard)

►►─┬─ MAX(arg1,arg2,...,argn) ─┬──────────────────────────────────────────────►◄
   ├─ MIN(arg1,arg2,...,argn) ─┤
   ├─ AVG(arg1,arg2,...,argn) ─┤
   └─ ABS(arg1) ───────────────┘

User-Defined Functions

►►─ UDF(arg1,arg2,...,argn) ──────────────────────────────────────────────────►◄

SORT Statement

►►─ SORT ─┬──────┬─┬─────────────────────────────┬─┬─────┬────────────────────►
          └─ BY ─┘ └─ table-name ─┬────────────┬─┘ └─ ( ─┘
                                  └─ (status) ─┘

 ►─┬─ key-name ────┬─┬─────┬─┬────────────┬───────────────────────────────────►◄
   ├─ column-name ─┤ └─ ) ─┘ └─┬─ UP ───┬─┘
   └─ result ──────┘           └─ DOWN ─┘

Complex PRINT Statement

►►─ PRINT ─┬────────────────────────────────────┬─────────────────────────────►
           └─┬─ TITLE1 ─┬─ ' report-heading1 ' ─┘
             └─ TITLE ──┘

 ►─┬────────────────────────────┬─┬────────┬──────────────────────────────────►
   └─ TITLE2 'report-heading2' ─┘ └─ FROM ─┘

 ►─┬─────────────────────────────┬─┬─────┬─┬─ key-name ────┬─┬─────┬──────────►
   └─ table-name ─┬────────────┬─┘ └─ ( ─┘ └─ column-name ─┘ └─ ) ─┘
                  └─ (status) ─┘

 ►─┬─────────────────────────────────┬─┬──────────────────────────┬───────────►◄
   └─ 'heading1 ─┬─────────────┬─ ' ─┘ └─ PICture 'edit-pattern' ─┘
                 └─ /heading2 ─┘

PRINT Statement with PICTURE Clause

►►─ PRINT ─┬────────┬─┬─────────────────────────────┬─┬─────┬─────────────────►
           └─ FROM ─┘ └─ table-name ─┬────────────┬─┘ └─ ( ─┘
                                     └─ (status) ─┘

 ►─┬─ key-name ────┬─┬─────┬─┬─────────────────────────────────┬──────────────►
   └─ column-name ─┘ └─ ) ─┘ └─ 'heading1 ─┬─────────────┬─ ' ─┘
                                           └─ /heading2 ─┘

 ►─┬──────────────────────────┬───────────────────────────────────────────────►◄
   └─ PICture 'edit-pattern' ─┘

DISPLAY

►►─ DISPLAY ─┬────────┬─┬─────────────────────────────┬───────────────────────►
             └─ FROM ─┘ └─ table-name ─┬────────────┬─┘
                                       └─ (status) ─┘

 ►─┬─ key-name ────┬─┬─────────────────────────────────┬──────────────────────►
   └─ column-name ─┘ └─ 'heading1 ─┬─────────────┬─ ' ─┘
                                   └─ /heading2 ─┘

 ►─┬──────────────────────────┬───────────────────────────────────────────────►◄
   └─ PICture 'edit-pattern' ─┘

DISPLAY with PICTURE Clause

►►─ DISPLAY ─┬────────┬─┬─────────────────────────────┬───────────────────────►
             └─ FROM ─┘ └─ table-name ─┬────────────┬─┘
                                       └─ (status) ─┘

 ►─┬─ key-name ────┬─┬──────────────────────────┬─────────────────────────────►◄
   └─ column-name ─┘ └─ PICture 'edit-pattern' ─┘

WHEN/DO Statement

►►─ WHEN ─ table-name ─┬────────────┬─ named-control-break ───────────────────►
                       └─ (status) ─┘

 ►─┬────────────┬─ DO ────────────────────────────────────────────────────────►
   ├─ BREAKS ───┤
   └─ FINISHED ─┘

 ►─┬─ PAGE-BREAK ─┤ more-choices ├ ─────────────────────┬─────────────────────►
   └─┬───────────────────┬─ function ─┤ more-choices ├ ─┘
     └─ 'report-legend' ─┘

 ►─┬──────────────────────────┬───────────────────────────────────────────────►◄
   └─ PICture 'edit-pattern' ─┘

Expansion of more-choices

├──┬─ 'table-name ─┬────────────┬─ 'column-name ─┬─────────────────────────────┤
   │               └─ (status) ─┘                │
   └─ result-name ───────────────────────────────┘

Complete WHEN/DO Statement for End of Report

►►─ WHEN FINISHED DO ─┬───────────────────┬─ function ────────────────────────►
                      └─ 'report-legend' ─┘

 ►─┬─ 'table-name ─┬────────────┬─ 'column-name ─┬────────────────────────────►
   │               └─ (status) ─┘                │
   └─ result-name ───────────────────────────────┘

 ►─┬──────────────────────────┬───────────────────────────────────────────────►◄
   └─ PICture 'edit-pattern' ─┘

WHEN/DO Statement for Page Break at a Control Break

►►─ WHEN ─ table-name ─┬────────────┬─ named-control-breakBREAKS ─────────────►
                       └─ (status) ─┘

 ►─ DO PAGE-BREAK ─┬──────────────────────────┬───────────────────────────────►◄
                   └─ PICture 'edit-pattern' ─┘