►►─┬─ subselect ─────────────┬────────────────────────────────────────────────►◄ ├─ full-select statement ─┤ ├─ select-statement ──────┤ └─ select-into statement ─┘
Subselect
►►─ SELECT ─┬────────────────┬────────────────────────────────────────────────► └─┬─ ALL ◄ ────┬─┘ └─ DISTINCT ─┘ ►─┬─ * ────────────────────────────────────────────┬─ FROM ──────────────────► │ ┌─ , ────────────────────────────────────────┐ │ └─▼─┬─ expression ─┬───────────────────────┬─┬─┴─┘ │ └─ AS ─ sql-identifier ─┘ │ └─┬─ table-name.* ───────┬───────────────┘ ├─ view-name.* ────────┤ └─ correlation-name.* ─┘ ┌─ , ─────────┐ ►─▼─ table-ref ─┴─┬────────────────────────────┬─────────────────────────────► └─ WHERE ─ search-condition ─┘ ►─┬──────────────────────────────┬─┬─────────────────────────────┬───────────►◄ │ ┌─ , ───────────┐ │ │ │ └─ GROUP BY ─▼─ column-name ─┴─┘ └─ HAVING ─ search-condition ─┘
Table-ref
►►─┬─┬─ table-name ─┬─┬──────┬─┬────────────────────┬─┬───────────────────────►◄ │ └─ view-name ──┘ └─ AS ─┘ └─ correlation-name ─┘ │ └─ alternate-join-type ────────────────────────────┘
Alternate-join-type
►►─┬─────┬─ table-ref ─┬─ INNER ────────────┬─────────────────────────────────► └─ ( ─┘ └─ LEFT ─┬─────────┬─┘ └─ OUTER ─┘ ►─ JOIN ─ table-ref ─┬────────────┬─┬─────┬──────────────────────────────────►◄ └─ ONs-cond ─┘ └─ ) ─┘
Full-select Statement
┌─ choice ────┐ ►►─▼─ subselect ─┴────────────────────────────────────────────────────────────►◄
Expansion of where choice is as follows
├──┬─ UNION ─────┬─────────────────────────────────────────────────────────────┤ └─ UNION ALL ─┘
Select-statement
►►─ full-select statement ────────────────────────────────────────────────────► ►─┬────────────────────────────────────────────────────────────┬─────────────►◄ ├─┬───────────────────┬─┬────────────────────────────┬───────┤ │ └─ ORDER BY clause ─┘ └─ optimize-read-fetch-list ─┘ │ │ ┌─ , ──────┐ │ └─ FOR UPDATE OF ─▼─ c-name ─┴─┬───────────────────────────┬─┘ └─ OPTIMIZE FOR ─ n ─ ROWS ─┘
Optimize-read-fetch-list
Only one use of each clause is allowed.
►►─┬──────────────────────────────────────────┬───────────────────────────────►◄ ├─ OPTIMIZE FOR ─ n ─ ROWS ────────────────┤ ├─ FOR ─┬─ READ ──┬ ─ ONLY ────────────────┤ │ └─ FETCH ─┘ │ └─ FETCH FIRST ─┬─────┬─┬─ ROW ──┬ ─ ONLY ─┘ └─ n ─┘ └─ ROWS ─┘
ORDER BY Clause
┌─ , ───────────────────────────┐ ►►─ ORDER BY ─▼─┬─ column-name ─┬─┬─────────┬─┴───────────────────────────────►◄ └─ integer ─────┘ ├─ ASC ◄ ─┤ └─ DESC ──┘
|
Copyright © 2014 CA.
All rights reserved.
|
|