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

Arithmetic Bit-shifting

A fun way to manipulate bits in Vertica SQL is with the use of arithmetic bit-shifting, which moves the bits in a number either left or right and fills in the new values with 0s.

Bit-shifting left is an easy way to multiply by powers of 2, while bit-shifting right divides by powers of 2.


dbadmin=> SELECT 5 << 2 "5*4=";
(1 row)

dbadmin=> SELECT 20 >> 2 "20/4=";
(1 row)

Helpful Link:

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.