Database / SQL query: Pattern matching with the LIKE and ~ operators :-

If you're writing a database (SQL) query to match a pattern anywhere within a string, use the LIKE operator and put percent signs (%) before and after the pattern you want to match. (You can also use a tilde operator (~) and leave out the percent signs.)

EXAMPLE:

Set to ignored all rogues where SSID contains the string 'x00':

> UPDATE rogue_ap SET ignored = 1 WHERE ssid LIKE '%x00%';

--OR--

> UPDATE rogue_ap SET ignored = 1 WHERE ssid ~ 'x00';

Here are some other operator combinations you might find useful:

~~ . . . . . . . . . . .same as: LIKE

% (percent): . . . matches any string of zero or more characters

_ (underscore): . matches any single character

ILIKE . . . . . . . . .same as LIKE, but case insensitive

NOT . . . . . . . . . .inverse; matches everything that is NOT matched by LIKE