SQL COMMIT

SQL COMMIT helps analysts make every successful change in the current transaction permanent.

What & Why

The COMMIT pattern is used to make every successful change in the current transaction permanent. This keeps the SQL aligned with one concrete business question and makes the result grain explicit before the query is reused.

See How It Works

BUSINESS QUESTION

Product wants to verify the active feature rows immediately before committing a successful transaction.

idnamedescriptionteamreleased_atdeprecated_at
1Activation ChecklistGuides new users through setupgrowth2024-01-20NULL
2CSV ExportExports report dataplatform2024-02-14NULL
3Invite NudgesPrompts workspace collaborationgrowth2024-03-05NULL
4Legacy DashboardOriginal reporting surfaceanalytics2023-08-102024-06-01
EXAMPLE QUERY
-- COMMIT; makes every successful statement since BEGIN durable.
SELECT
  id AS feature_id,
  name,
  team
FROM product.features
WHERE deprecated_at IS NULL
ORDER BY feature_id;
RESULT — current non-deprecated features
feature_idnameteam
1Activation Checklistgrowth
2CSV Exportplatform
3Invite Nudgesgrowth

The practice query remains read-only while the lesson explains COMMIT semantics.

This lesson's practice is part of Pro.

Advanced business practice

Sign up free to try it on a real business scenario