Bird
0
0

You want to select all products from a Products table where the Price is between 10 and 20 inclusive. Which WHERE clause is correct?

hard🚀 Application Q15 of 15
C Sharp (C#) - LINQ Fundamentals

You want to select all products from a Products table where the Price is between 10 and 20 inclusive. Which WHERE clause is correct?

APrice BETWEEN 10 AND 20 EXCLUSIVE
BPrice > 10 AND Price < 20
CPrice >= 10 OR Price <= 20
DPrice >= 10 AND Price <= 20
Step-by-Step Solution
Solution:
  1. Step 1: Understand inclusive range filtering

    Inclusive means including 10 and 20, so use >= and <= operators.
  2. Step 2: Analyze each option

    Price > 10 AND Price < 20 excludes 10 and 20 (strictly greater and less). Price >= 10 OR Price <= 20 uses OR, which selects too many rows. Price BETWEEN 10 AND 20 EXCLUSIVE is invalid syntax.
  3. Final Answer:

    Price >= 10 AND Price <= 20 -> Option D
  4. Quick Check:

    Inclusive range uses >= and <= with AND [OK]
Quick Trick: Use >= and <= with AND for inclusive ranges [OK]
Common Mistakes:
MISTAKES
  • Using > and < excludes boundary values
  • Using OR instead of AND
  • Trying invalid BETWEEN syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes