Explain to me the fool, what Schrödinger is happening here.
SELECT num, CASE WHEN num NOT IN (SELECT P FROM BST) THEN 'NOT in P' WHEN num IN (SELECT P FROM BST) THEN 'in P' WHEN num NOT IN (SELECT N FROM BST) THEN 'NOT in N' WHEN num IN (SELECT N FROM BST) THEN 'in N' ELSE 'lalala' END FROM ( SELECT num FROM( (SELECT DISTINCT N as num FROM BST) UNION (SELECT DISTINCT P as num FROM BST) ) as nums WHERE num is not NULL ORDER BY num ASC ) as tab1 LIMIT 1; Conclusion:
1 in N If you write through the if construct for each of the possible options, he writes me:
1 in P NOT in P In N In N It turns out that the element is simultaneously in P and not in P.
What am I doing wrong?
PS Table BST contains:
N | Integer P | Integer The FROM subquery table contains non-repeating elements from both columns of the BST table.
Trying to solve so