Multiple choice technology databases

With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?

  1. SELECT FirstName='Peter', LastName='Jackson' FROM Persons

  2. SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'

  3. SELECT * FROM Persons WHERE FirstName<>'Peter' AND LastName<>'Jackson'

  4. SELECT WHERE FirstName='Peter' AND LastName='Jackson' FROM Persons

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

The WHERE clause filters rows after SELECT *, and AND combines multiple conditions. Option B is the only syntactically correct choice - it uses proper SELECT * FROM with WHERE containing both conditions joined by AND.