Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

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.