I use postgresql database and the need is to return all the rows that contain a given string in any column of that table. For example, I have a table like this.

enter image description here

I need a query to return all rows that has Italy in any of their columns i.e the query shoud return 1st and 3rd rows.

1 Answer 1


You can use an IN condition for that:

select *
from the_table
where 'Italy' IN (name, native, place);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.