Bird
0
0

What will be the result of this PostgreSQL query?

medium📝 query result Q5 of 15
PostgreSQL - PL/pgSQL Fundamentals
What will be the result of this PostgreSQL query?
SELECT NOW()::date;
ATimestamp with time zone
BCurrent time without date
CError due to invalid cast
DCurrent date without time
Step-by-Step Solution
Solution:
  1. Step 1: Understand NOW() function

    NOW() returns current timestamp with date and time.
  2. Step 2: Understand casting to date

    Using ::date converts timestamp to date only, removing time part.
  3. Final Answer:

    Current date without time -> Option D
  4. Quick Check:

    NOW()::date returns date only [OK]
Quick Trick: Cast timestamp to date to remove time [OK]
Common Mistakes:
  • Expecting time only from NOW()::date
  • Thinking casting causes error
  • Confusing timestamp with date

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes