How to retrieve account records where the name starts with "comp"?

Select Id,Name From Account Where Name Like 'comp%'

Does the above query guarantee at least 4 characters in length?

  • 1
    Yes it will. It will retrieve all records in the Account object that have a Name that starts with comp Nov 21, 2019 at 16:02

1 Answer 1


the expression 'comp%' will bring everything that starts with 'comp' and ends with anything

if you want to always guarantee 4 letters after 'comp' you can use it as follows LIKE 'comp____' use 4 underscore to ensure 4 characters after 'comp'

  • perfect exactly what I was looking for
    – ebar
    Nov 21, 2019 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.