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.
| id | name | description | team | released_at | deprecated_at |
|---|---|---|---|---|---|
| 1 | Activation Checklist | Guides new users through setup | growth | 2024-01-20 | NULL |
| 2 | CSV Export | Exports report data | platform | 2024-02-14 | NULL |
| 3 | Invite Nudges | Prompts workspace collaboration | growth | 2024-03-05 | NULL |
| 4 | Legacy Dashboard | Original reporting surface | analytics | 2023-08-10 | 2024-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_at | feature_count |
|---|---|
| 2024-03-31 12:00:00+00 | 4 |
The fixed timestamp represents NOW() beside the real feature count.
Sign up free to try it on a real business scenario