We're Moving!

The Vertica Forum is moving to a new OpenText Analytics Database (Vertica) Community.

Join us there to post discussion topics, learn about

product releases, share tips, access the blog, and much more.

Create My New Community Account Now


Are These Two String Values Like Each Other? — Vertica Forum

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.