Are SQL queries guaranteed to execute atomically when using UNION?

前端 未结 3 1504
夕颜
夕颜 2021-01-02 08:29

I am issuing a single SQL query consisting of multiple SELECTs grouped using UNION:

SELECT *
FROM   employee 
       LEFT JOIN department 
          ON emplo         


        
3条回答
  •  离开以前
    2021-01-02 08:43

    Using UNION will remove any duplicate records that may be returned from either of the unioned queries, so not exactly atomic. Use UNION ALL if you want all records from all unioned queries. UNION ALL can be much faster that UNION also.

提交回复
热议问题