If you are a developer, you can stop these attacks using three main methods:

This is the gold standard. Instead of building a query string with user input, you use placeholders ( ? ). The database treats the input strictly as data, never as executable code.

The snippet you provided is a classic example of an attack.

Only allow the types of characters you expect. If a user is searching for a "Keyword," they probably don't need to use parentheses or semicolons.