Recall & Review
beginner
What does the SQL
BETWEEN operator do?The
BETWEEN operator filters results to include only values within a specified range, including the start and end values.Click to reveal answer
beginner
Write a simple SQL query using
BETWEEN to find ages between 18 and 30.Example: <br>
SELECT * FROM users WHERE age BETWEEN 18 AND 30;<br>This returns users aged 18 through 30 inclusive.Click to reveal answer
beginner
Does
BETWEEN include the boundary values in the range?Yes,
BETWEEN includes both the start and end values in the range.Click to reveal answer
intermediate
How is
BETWEEN different from using >= and <=?Using
BETWEEN a AND b is the same as value >= a AND value <= b. BETWEEN is just a shorter, clearer way to write it.Click to reveal answer
beginner
Can
BETWEEN be used with dates in MySQL?Yes,
BETWEEN works with dates to filter rows between two dates, including both dates.Click to reveal answer
Which of the following queries correctly selects rows where the price is between 100 and 200?
✗ Incorrect
BETWEEN 100 AND 200 includes prices from 100 to 200 inclusive. Option B excludes 100 and 200, C uses OR which is incorrect, and D is impossible.Does
BETWEEN include the boundary values in the range?✗ Incorrect
BETWEEN always includes the start and end values.Which is equivalent to
value BETWEEN 10 AND 20?✗ Incorrect
BETWEEN includes both boundaries, so it equals >= 10 AND <= 20.Can
BETWEEN be used to filter date ranges in MySQL?✗ Incorrect
BETWEEN works with numbers, dates, and strings in MySQL.What happens if you write
WHERE value BETWEEN 20 AND 10?✗ Incorrect
The
BETWEEN operator expects the first value to be less than or equal to the second. If reversed, it returns no rows.Explain how the
BETWEEN operator works in SQL and give an example query.Think about filtering values within a range.
You got /3 concepts.
Describe the difference between using
BETWEEN and using >= and <= operators.Consider how you write conditions for a range.
You got /3 concepts.