onkami
onkami

Reputation: 9411

Drop double-quotes found in data in a Presto SQL-compartible database (AWS Athena)?

In a Presto-compatible database (AWS Athena) I have some rows that contain values in double-quotes, mixed with values without double-quotes

e.g. column "postal code" can have "00100" and 00100.

What SQL query can I issue to remove all double-quotes found, so "00100" becomes 00100?

Upvotes: 0

Views: 3041

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269823

You can use replace():

replace(postal_code, '"', '')

This can be in an update or select.

Note: This removes all double quotes. If you have some values that could have double quotes in them, then you need more complicated expressions. In my experience, though, a column named postal_code would never have double quotes so this is safe.

Upvotes: 2

Related Questions