I have addresses like this
420 CONSUMER SQUARE (PET SMART PARKING LOT)
in a column and I want to remove the brackets and the word in that and the result should look like
420 CONSUMER SQUARE
How can I do this in PostgreSQL?
You need to use regexp_replace function
SELECT regexp_replace('420 CONSUMER SQUARE (PET SMART PARKING LOT)', '^(.*)\\(.*?\\)', '\\1')
-- or
SELECT regexp_replace('420 CONSUMER SQUARE (PET SMART PARKING LOT)', '\\(.*?\\)$', '')
Both examples will return 420 CONSUMER SQUARE
SELECT regexp_replace(address_column_name, '\\(.*?\\)$', '')