When using UNION ALL
in MySQL, if there is no ORDER BY
, the elements will basically return in the order of UNION.
Can I expect the UNION ALL
set to return elements in the order of UNION as MySQL or SQL specifications?
Or, if certain conditions (storage engine, etc.) are met, will each element of UNION ALL be acquired in a mix?
As a MySQL or SQL specification, can I expect UNION ALL
sets to return elements in the order of UNION?
Or, if certain conditions (storage engine, etc.) are met, will each element of UNION ALL be acquired in a mix?
mysql sql
The MySQL reference does not have an order guarantee, so I don't think it's guaranteed.You should add ORDER BY.
(No matter how many times you test it, you often get good results.)
© 2024 OneMinuteCode. All rights reserved.