Multiple choice technology databases

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='%a%'

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

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

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

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

The SQL LIKE operator with wildcards is used for pattern matching. The '%' wildcard matches any sequence of characters. To match names starting with 'a', use 'a%' where 'a' matches the first character and '%' matches any following characters. Option D correctly uses: 'SELECT * FROM Persons WHERE FirstName LIKE 'a%'. Option A ('%a%') matches names containing 'a' anywhere. Option B uses exact equality instead of pattern matching. Option C ('%a') matches names ending with 'a'.