What does the SQL standard say about parentheses in SQL UNION/EXCEPT/INTERSECT statements?

后端 未结 3 355
被撕碎了的回忆
被撕碎了的回忆 2021-01-18 19:15

I\'m trying to write a SQL UNION that works on both MySQL and SQLite.

(select_clause_A) UNION (select_clause_B)

SQLite doesn\'t like the pa

3条回答
  •  滥情空心
    2021-01-18 19:38

    The parens should not be required for MySQL, and from what I can tell reading the spec are not supposed to be there.

    MySQL is also nonstandard in that it supports an ORDER BY in each "part" of the union, so if you're writing it for non-MySQL you can't do that anyway.

提交回复
热议问题