Count the number of occurrences
08:17 22 May 2017

How can I fulfill the conditions? I need to count the number of records satisfying the conditions

enter image description here

(A || B) && С
(A || B) && !С
(A || B) || С

For example first condition

(A || B) && С

  • num = 1 - Fits the condition. Present in CAT=A, CAT=B and CAT=C

  • num = 2 - Fits the condition. Present in CAT=A and CAT=C

  • num = 3 - Not suitable by condition. Present only in CAT=C (expression (A || B) && С is false)

So result table for expressions looks

COLUMN_EXP              COUNT
 (A || B) && С          2
 (A || B) && !С         0
 (A || B) || С          3
sql oracle-database count grouping