The single quote (’) and backslash (\) characters are reserved in SOQL queries and must be preceded by a backslash to be properly interpreted.
Reserved characters, if specified in a SELECT clause as a literal string (between single quotes), must be escaped (preceded by the backslash \ character) to be properly interpreted. An error occurs if you do not precede reserved characters with a backslash.
The following characters are reserved:
' (single quote)
\ (backslash)
For example, use the following SELECT statement to query the Account.Name field for “Bob's BBQ”:
SELECT Id
FROM Account
WHERE Name = 'Bob\'s BBQ'