select-statement = select-expr -+->--------------------++--------------------+-> +-> for-update-clause -++-> optimize-clause -+ select-expr = -+-+-> select-clause ------------+-+------+ | +-> ( select-expr ) -----------+ | | | +-> TABLE table-ref ----------+ | | +------ select-merge-clause <-------+ | +------------------- <-------------------+ +-+--------------------+--+------------------+--+--------------------+-> +-> order-by-clause -+ +-> offset-clause -+ +-> limit-to-clause -+ select-merge-clause = -+-> EXCEPT -+--------------+---+----+-------------------+--> | +-> DISTINCT --+ | +-> CORRESPONDING --+ +-> INTERSECT -+-------------+-+ +-> NATURAL --------+ | +-> DISTINCT -+ | +-> MINUS ---------------------+ +-> UNION --+-------------+----+ +-> ALL ------+ +-> DISTINCT -+ select-clause = SELECT -+-------------+-> select-list -------------------------------+ +-> ALL ------+ | +-> DISTINCT -+ | +------------------<-------------------------------------------------+ +-> FROM -+--> table-ref --+-----------------------------------------+ +------ , <------+ | +--------------------------------------------------------------------+ ++--------->-----------------------+-+------------->----------------++ +> WHERE predicate ---------------+ +> GROUP BY -+> <column-name> -+| +> value-expr ----+| +------- ,<-------+| +--------------------------------------<-----------------------------+ ++---------->----------+----------------------------------------------> +-> HAVING predicate -+ select-list = -+-+----> * ------------------------------------------------------+-+-> | +-+--> value-expr --+--------------------------------------+-+-+ | | | +-> AS <name> -+----------------------++ | | | | +-> edit-using-clause -+ | | | | | | | ++-> <table-name> ------+-> . * ---------------------------+ | | +-> <view-name> -------+ | | +-> <correlation-name> + | +---------------- , <----------------------------------------------+ table-ref = --+--> <table-name> --+--+-----------------------------+--> +--> <view-name> --+ +-> correlation-name-clause --+ +--> derived-table -+ | +--> joined-table -----------------------------------+ derived-table = ----> ( -+-> select-expr --+-> ) ----> +-> joined-table -+ joined-table = --+-------> qualified-join ------+----> +-------> cross-join ----------+ +-> ( --> joined-table --> ) --+ qualified-join = -+-> table-ref -+-------------+--> JOIN --> table-ref -+ | +> join-type -+ | | +---------------------------------------------------+ | ++-> ON predicate -------------------------------+-----------+> | +-> USING ----> ( -+> <column-name> +-> ) ------+ | | +------ , <------+ | +-> table-ref -> NATURAL -+-------------+-> JOIN -> table-ref -+ +> join-type -+ cross-join = ---> table-ref --> CROSS JOIN --> table-ref ---> join-type = --+-> INNER ------------------+--> +-> LEFT ---+--> OUTER -----+ +-> RIGHT --+ +-> FULL ---+ correlation-name-clause = -> AS <correlation-name> +------------------------------------+-> +-> ( -+-> <name-of-column> -+-> ) --+ +-------- , <---------+ order-by-clause = --> ORDER BY -++-> value-expr -++---------+-+--> |+-> <integer> ----++-> ASC --+ | | +-> DESC -+ | +------------ , <---------------+ offset-clause = ---> OFFSET skip-expression -+-> ROW --+--> +-> ROWS --+ limit-to-clause = -+> LIMIT TO -+-> limit-expression -+---------------------------+++---------++> | | +-> OFFSET skip-expression -+|+-> ROW -+| | | +-> SKIP skip-expression --+|+-> ROWS -+| | +-> skip-expression , limit-expression -----------+ | | | +> FETCH -+> FIRST -+--+---------------------+--+----------+-> ONLY --------+ +> NEXT --+ +-> limit-expression -+ +-> ROW --+ +-> ROWS -+ for-update-clause = --> FOR UPDATE -+-------------------------+-> +-+-> OF <column-name> -+-+ +-------- , <---------+ edit-using-clause = --> EDIT USING -+-> edit-string ---+-> +-> <domain-name> -+ optimize-clause = --+---------------------------------------------------------------+---> +-> OPTIMIZE --+-+-> FOR -+-> FAST FIRST --------+----------+-+-+ | | +-> TOTAL TIME --------+ | | | | +-> SEQUENTIAL ACCESS -+ | | | +-> USING <outline-name> ------------------+ | | +-> WITH -+-> DEFAULT --+-> SELECTIVITY -+ | | | +-> SAMPLED --+ | | | | +-> AGGRESSIVE + | | | +-> AS <query-name> -----------------------+ | +---------------- <----------------------------+