What is the correct syntax for a query that retrieves all Accounts that have __Civil_ in the Name?
SELECT Id FROM Account WHERE (Name LIKE '%_Civil_%')
You should escape the _ because the _ is a wildcard that matches exactly one character.
The query would look like:
[SELECT Id, Name FROM Account WHERE Name LIKE '%\_Card\_%']
If you want to query the underscores, then you have to escape them using
\. Like in:
...WHERE Name LIKE '\_\_Civil\_'
If you want to use them as wildcards for matching any character, then your query should work, although you don't need the
) for it to work.
Please refer to the documentation of the WHERE condition, on the Comparison Operators section: https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl_where.htm