
How to Query Past Data with Flashback Query in Oracle
See data as it was minutes ago, put back rows changed by mistake, and list every committed version of a row with VERSIONS BETWEEN.

See data as it was minutes ago, put back rows changed by mistake, and list every committed version of a row with VERSIONS BETWEEN.

Treat query results as arrays of cells and compute projections with spreadsheet-like rules, using UPSERT, CV, PRESENTV, and ITERATE.

Find runs, V shapes, and other sequences in ordered rows with MATCH_RECOGNIZE, using PATTERN, DEFINE, MEASURES, and AFTER MATCH SKIP.

Turn side-by-side columns into rows with UNPIVOT, replace UNION ALL chains, keep NULLs when you need them, and unpivot column groups.

Build cross-tab reports in one query with PIVOT, compute several aggregates, control the grouping, and avoid ORA-56902 when rounding.

Filter rows on ROW_NUMBER, RANK, and other analytic results in one query block with QUALIFY, new in Oracle AI Database 26ai.

Control which rows an analytic function sees with PARTITION BY and ROWS, RANGE, or GROUPS frames, and reuse windows with the WINDOW clause.

Walk trees down and up with START WITH and CONNECT BY, show paths, roots, and leaves, prune branches, and handle loops with NOCYCLE.

Use procedural logic in a single query without creating stored functions, run it in SQLcl, and call it from UPDATE with the WITH_PLSQL hint.

Walk hierarchies and networks to any depth with a recursive common table expression, order the rows with SEARCH, and stop loops with CYCLE.

Name subqueries at the top of a statement so long queries read step by step, chain common table expressions, and reuse them.

Stack, intersect, and subtract query results with UNION, INTERSECT, MINUS, and EXCEPT, including the duplicate-counting ALL versions.

Compare every row with its own group, compute per-row values in the select list, and see the analytic alternative to a correlated subquery.

Nest one query inside another to supply a value, a list, pairs of values, or a whole table, and avoid ORA-01427 and the NOT IN trap.

List exactly the groupings you need in one query, replace UNION ALL chains, and identify subtotal rows with GROUPING, GROUPING_ID, and GROUP_ID.

Get detail rows, totals for every dimension, and a grand total in one query with CUBE, then filter or label the total rows with GROUPING_ID.

Compute detail rows, subtotals, and a grand total in one grouped query with ROLLUP, and learn how to read, sort, and label the extra rows.

Keep only the groups you need by filtering on counts, sums, and other aggregates, and learn when a condition belongs in WHERE instead.