How To Remove Spaces Between Characters In PostgreSQL? I want to match two tables based on a specific column which is a card number, there are spaces between characters in some of card numbers in the second table like below:

'NES 123_4_5'
'MTS 678_9_0'


What i want is to remove the space between the characters and numbers and change it to following form:

'NES123_4_5'
'MTS678_9_0'


What would be the SQL query of function to do this?
simplest way - use REPLACE function

select REPLACE('NES 123_4_5', ' ', '')
Result - NES123_4_5


full list of string functions - https://www.postgresql.org/docs/9.6/static/functions-string.html