Answer the question
In order to leave comments, you need to log in
How to determine that three predicates are equal to each other by specifying them once in an expression?
The truth table is:
A B C ?
1 1 1 1
1 1 0 0
1 0 1 0
1 0 0 0
0 1 1 0
0 1 0 0
0 0 1 0
0 0 0 1
Истина, когда либо все аргументы - истины, либо когда все аргументы - лжи.
(SELECT bool_and(a) = bool_or(a) FROM unnest(ARRAY[A, B, C]) a(a))
A::int + B::int + C::int IN (0, 3)
Answer the question
In order to leave comments, you need to log in
CREATE EXTENSION intarray;
1. sort( ARRAY[4,3,2,1] ); -- place the values in an array, sort it
2. compare the first and last element, if they are equal, then the rest are all equal
Example:
select arr[1] = arr[array_upper(arr, 1)] as isEqual
from sort(ARRAY[1,87,5,456,34,1]) as arr; -- false
select arr[1] = arr[array_upper(arr, 1)] as isEqual
from sort(ARRAY[1,1,1]) as arr; -- true
select arr[1] = arr[array_upper(arr, 1)] as isEqual
from sort(ARRAY[0,0,0,0]) as arr; -- true
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question