The Vertica Forum is getting a makeover! The site will be undergoing maintenance from Tuesday 8/13 to Friday 8/16. We appreciate your patience and cooperation during this time.

Are These Two String Values Like Each Other?

The Vertica built-in function LIKE is used to determine if two strings are like one another, while the NLIKE function is used to determine if two strings are not like one another.

Example:

dbadmin=> SELECT LIKE('ABCDEF', 'ABCDEF');
LIKE
------
t
(1 row)

dbadmin=> SELECT NLIKE('ABCDEF', 'ABCDEF');
NLIKE
-------
f
(1 row)

You can even include wildcard symbols!

dbadmin=> SELECT LIKE('ABCDEF', '%DE%');
LIKE
------
t
(1 row)

dbadmin=> SELECT NLIKE('ABCDEF', '%DE%');
NLIKE
-------
f
(1 row)

dbadmin=> SELECT LIKE('ABCDEF', 'A%F');
LIKE
------
t
(1 row)

dbadmin=> SELECT NLIKE('ABCDEF', 'A%F');
NLIKE
-------
f
(1 row)

Have fun!

Sign In or Register to comment.

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.