Multiple choice sql

With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?

  1. SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons

  2. SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'

  3. SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName<'Pettersen'

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The BETWEEN operator selects values within a given range and is inclusive of both endpoints. It is equivalent to using >= and <= combined with AND. BETWEEN works with text, numbers, and dates.