Roger Federer Roger Federer - 8 months ago 37
SQL Question

How do I make a SQL query to select all items that contain a certain sub-string?

For example I have a table named "location" and a column "name". I want all names that contain the sub-string "abe" for example. I am using postegresql.


As you mention postgresql in your tag you should have a look at the PostgreSQL documentation.

There is a topic about pattern matching

One solution for your query would be:

select *
from location
where name like '%abe%'

LIKE is also explained on w3schools.