Check if two “select”s are equivalent

前端 未结 4 605
忘掉有多难
忘掉有多难 2020-12-15 17:22

Is there a way to check if two (non-trivial) select are equivalent?

Initially I was hoping for a formally equivalence between two selects, but the answers in proving

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-15 17:55

    If you want to compare the query results try the following:

    (select * from query1 MINUS select * from query2) 
    UNION ALL
    (select * from query2 MINUS select * from query1)
    

    This will result in all rows that are returned by only one of the queries.

提交回复
热议问题