If I want to retrieve all entries such that the column foo
value contains a string 'bar'
, is there a simple way to do this in SQL, or Postgresql?
Something like ' WHERE foo = "bar"'
but instead of =
it would be something like ' WHERE foo CONTAINS "bar"'
.
Postgres Version 9.3
Use the SQL LIKE
statement. With that, you use a %
as a wildcard. So, your WHERE
statement could be something like:
WHERE foo LIKE '%bar%'
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