Is it possible in SQL (more specifically PostreSQL) to match a string against the pattern stored in the table so that when I have a DB field containing %some%
I'd be able to select its row by something like
SELECT * FROM table_name WHERE field_value LIKE 'Awesome stuff'
Thanks.
The NOT LIKE operator in SQL is used on a column which is of type varchar . Usually, it is used with % which is used to represent any string value, including the null character \0 .
In MySQL, you can use NOT LIKE to perform a negation of the LIKE operator. In other words, NOT LIKE returns the opposite result to LIKE .
SQL Server REVERSE() Function The REVERSE() function reverses a string and returns the result.
The % is a wildcard that matches any character, and any number of characters. So a LIKE % matches everything. In your case, the LIKE '% %' matches anything that has a space in it.
SELECT *
FROM table_name
WHERE 'Awesome stuff' LIKE field_value
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With