Multiple choice technology databases

With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?

  1. SELECT * FROM Persons WHERE FirstName LIKE '%a'

  2. SELECT * FROM Persons WHERE FirstName ='a'

  3. SELECT * FROM Persons WHERE FirstName LIKE 'a%'

  4. SELECT * FROM Persons WHERE FirstName='%a%'

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

In SQL, the LIKE operator combined with the wildcard % is used for pattern matching. The pattern 'a%' matches any string that starts with the character 'a' followed by any sequence of characters. Other options either look for an exact match or look for strings ending with 'a'.