Bird
0
0

What will be the result of this query?

medium📝 query result Q5 of 15
PostgreSQL - Advanced Features
What will be the result of this query?

SELECT daterange('2023-01-01', '2023-01-10', '[]') @> '2023-01-10'::date;
Afalse
Btrue
Cnull
Dsyntax error
Step-by-Step Solution
Solution:
  1. Step 1: Understand the daterange boundaries

    The range is from '2023-01-01' to '2023-01-10' inclusive on both ends because of '[]'.
  2. Step 2: Check if the date is contained

    The date '2023-01-10' is included because the upper bound is inclusive.
  3. Final Answer:

    true -> Option B
  4. Quick Check:

    Inclusive bounds include upper date, so result = true [OK]
Quick Trick: Inclusive bounds '[]' include end date in daterange [OK]
Common Mistakes:
  • Assuming upper bound is exclusive by default
  • Confusing bound symbols
  • Expecting false for boundary date

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes