例:
select count(*) from my table
where
column1 is not null
and
(column1 = 4 OR column1 = 5)
例 2:
select count(*) from my table
where
column1 is not null
and
column1 = 4 OR column1 = 5
実際の列名を持つデータベースでは、2 つの異なる結果が得られます。私がそうするなら、括弧付きのものは正しいです:
select count(*) from my table
where
column1 is not null
and
column1 = 4
その後
select count(*) from my table
where
column1 is not null
and
column1 = 5
それらを足し合わせると、正しい答えが得られる...と思います。上記の括弧を使用した最初の例と同じです。
OR テストで優先順位を変更すると、異なる結果が得られるのはなぜですか?