1. 程式人生 > >Oracle Minus關鍵字

Oracle Minus關鍵字

效能比較:
  SELECT order_id FROM made_order
  MINUS
  SELECT order_id FROM charge_detail
  1.14 sec
  
  SELECT a.order_id FROM made_order a
  WHERE NOT exists (
   SELECT order_id
   FROM charge_detail
   WHERE order_id = a.order_id
   )
  18.19 sec
  
  SELECT order_id FROM made_order
  WHERE order_id NOT in (
   SELECT order_id
   FROM charge_detail
   )
  20.05 sec
  
  還有其它一下關鍵字:
  INTERSECT (交集)
  UNION ALL 並集