Multiple choice technology databases

  1. With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?

  1. SELECT * FROM Persons WHERE FirstName<>'Peter'

  2. SELECT [all] FROM Persons WHERE FirstName='Peter'

  3. SELECT * FROM Persons WHERE FirstName='Peter'

  4. SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'

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

To select records where a column equals a specific value, use SELECT * FROM table WHERE column='value'. The correct syntax uses single quotes for string values and the equals operator. Option A uses <> (not equals), B uses invalid [all] syntax, and D uses LIKE which is for pattern matching, not exact matches.