Reputation: 11
I have two queries targeting the same table, and I want to determine if the filtering ranges of these two queries intersect, that is, whether the two queries will filter the same data.Even if the intersecting filtering range can be intuitively distinguished by eye, how can it be done through code.
e.p.
This is intersecting.
-- query1:
select * from table1 where data_date='2024-12-25' and age=18
-- query2:
select * from table1 where data_date='2024-12-25' and age between 12 and 20
-- Often times, the situation is more complex than this
This is not intersecting.
-- query1:
select * from table1 where data_date='2024-12-25' and age=18
-- query2:
select * from table1 where data_date='2024-12-25' and age >19
Upvotes: 0
Views: 30