Are These Two String Values Like Each Other?

Jim_KnicelyJim_Knicely - Select Field - Administrator

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.