SHIFTR()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns a number with its bits shifted to the right.
USAGE
SHIFTR(number, count)
Argument Name | Description |
|---|---|
| The starting number |
| The number of bit positions to shift to the right |
DETAILS
SHIFTR() is a bitwise function that returns the starting number after shifting the bits rightward count bit positions.
A NULL is returned if either argument is NULL.
The function call SHIFTR(x, y) behaves in exactly the same manner as the expression x >> y.
EXAMPLES
SELECT SHIFTR(5, 1), SHIFTR(5, 2), SHIFTR(5, 3);
+--------------+--------------+--------------+
| SHIFTR(5, 1) | SHIFTR(5, 2) | SHIFTR(5, 3) |
+--------------+--------------+--------------+
| 2 | 1 | 0 |
+--------------+--------------+--------------+
