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

  2. SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName

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

  4. SELECT * FROM Persons WHERE LastName IN 'Hansen' AND 'Pettersen'


Correct Option: C
Explanation:

To solve this question, the user needs to know how to use SQL to select specific records from a table based on certain criteria. Specifically, they need to know how to use the WHERE clause to filter records based on a specified range of values.

Now, let's go through each option and explain why it is right or wrong:

A. SELECT LastName>'Hansen' AND LastName'Hansen' AND LastName

Find more quizzes: