SQL NOW

Postgres's shorter, function-call alias for CURRENT_TIMESTAMP — identical behavior, different syntax.

What & Why

In PostgreSQL, NOW() is equivalent to CURRENT_TIMESTAMP and is stable for the transaction. The worked query fixes the timestamp while counting the real product.features rows.

See How It Works

BUSINESS QUESTION

Using a fixed teaching clock, Product records a report timestamp beside the feature count.

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
-- In a live report, replace the teaching value with NOW().
SELECT
  TIMESTAMPTZ '2024-03-31 12:00:00+00' AS checked_at,
  COUNT(*) AS feature_count
FROM product.features;
RESULT — exact output from the displayed Queryflo rows
checked_atfeature_count
2024-03-31 12:00:00+004

The fixed timestamp represents NOW() beside the real feature count.

Now You Try

Practice this concept

Return the fixed teaching timestamp 2024-03-31 12:00:00+00 beside the product.features row count.

Available schema
product

Prefix tables with product.table_name.

checked_atfeature_count
product.features
ColumnType
idinteger
nametext
descriptiontext
teamtext
released_attimestamp with time zone
deprecated_attimestamp with time zone
internal_priorityinteger
query.sql
Intermediate business practice

Sign up free to try it on a real business scenario