![SQL server](https://www.commvault.com/wp-content/uploads/2019/08/sql-server_logo.jpg?quality=80&w=930)
To escape a characther in the LIKE clause of SQL, use the additional ESCAPE clause which is part of the SQL standard and should work with any relational DB.
WHERE username LIKE '%^_d' ESCAPE '^';
In the example above, the ^ is used as the escape charachter, which forces the query return all usernames that end with _d
Sepcifically in Microsoft T-SQL we can use also the character range operator: [], so the query becomes:
WHERE username LIKE '%[_]d'