Integer Array Operation Using Operators:
To Check the Equality Between Two Arrays (=)
We can compare the Equality of two Integer arrays using the operator (=) . Which will produce the boolean result as true or false.
Ex:
SELECT ARRAY[1,2,3]::INT[] = ARRAY[1,2,3]::INT[] AS a
The above query will produce the result as given below,
a
-----
true
To Check the inequality Between Two Arrays (<>)
We can compare the Inequality of Two Arrays using the operator (<>). Which also produce the Boolean result as true or false.
To Check the Equality Between Two Arrays (=)
We can compare the Equality of two Integer arrays using the operator (=) . Which will produce the boolean result as true or false.
Ex:
SELECT ARRAY[1,2,3]::INT[] = ARRAY[1,2,3]::INT[] AS a
The above query will produce the result as given below,
a
-----
true
Ex:
SELECT ARRAY[1,2,3]::INT[] = ARRAY[1,2]::INT[] AS a
The above query will produce the result as given below,
a
------
false
To Check the inequality Between Two Arrays (<>)
We can compare the Inequality of Two Arrays using the operator (<>). Which also produce the Boolean result as true or false.
Ex:
SELECT ARRAY[1,2,3]::INT[] <> ARRAY[1,2,3]::INT[] AS a
The above query will produce the result as given below,
a
------
false
Ex:
SELECT ARRAY[1,2,3]::INT[] <> ARRAY[1,2]::INT[] AS a
The above query will produce the result as given below,
a
------
true
Similarly We can do the other comparison like Less Than(<), Greater Than(>),
Less Than Or Equal to(<=), Greater Than
Or Equal to(>=) based on the above example.
No comments:
Post a Comment