How do I escape a single quote in Presto? How do I escape a single quote in Presto? sql sql

How do I escape a single quote in Presto?


The answer, provided by a_horse_with_no_name, is to use another '.

'Driver''s License'


Put a single quotes two times in place of single quotes, which you need to escape:

select count(*) as count from uploadswhere title not in ('Driver''s License')


Use the CHR(39) character function anywhere you need a single quote. Use with either the concat function or using double pipe ||:

select count(*) as count from uploadswhere title not in (concat('Driver', CHR(39), 's License'))

or

select count(*) as count from uploadswhere title not in ('Driver' || CHR(39) || 's License')