SELECT Statement •In a parenthesized trailing block of a query expression, use of  INTO  (regardless of its position relative to FROM ) produces a warning. Example: •In the trailing query block of a query expression, use of  INTO  before  FROM  produces a warning. Example: •Only the last  SELECT  statement can use an  INTO  clause. However, the entire  UNION  result is written to the  INTO  output destination. •Locking clauses ( FOR UPDATE ,  LOCK IN SHARE MODE ) are allowed only in non- UNION  queries. This means that parentheses must be used for  SELECT  statements containing locking clauses. This statement is no longer accepted as valid: •Left-hand nesting of unions, previously permitted only in subqueries, is now permitted in top-level statements. For example, this statement is now accepted as valid: •The parser better conforms to the documented permitted placement of the  SQL_CACHE  and SQL_NO_CACHE  query modifiers. •The parser accepts parentheses around query expressions. For example,  (SELECT ... UNION SELECT ...)  is permitted. See also Section 13.2.10.4, “Parenthesized Query Expressions” . • STRAIGHT_JOIN  now permits a  USING  clause, similar to other inner joins. •Right-deep joins without parentheses are permitted (for example,  ... JOIN ... JOIN ... ON ... ON ), in compliance with standard SQL. • NATURAL JOIN  permits an optional  INNER  keyword ( NATURAL INNER JOIN ), in compliance with standard SQL. 2680 Instead, write the statement like this: (SELECT 1 FOR UPDATE) UNION (SELECT 1 FOR UPDATE); SELECT 1 FOR UPDATE UNION SELECT 1 FOR UPDATE; (SELECT 1 UNION SELECT 1) UNION SELECT 1; SELECT 1 AS foo UNION SELECT 2 ORDER BY MAX(1); ... UNION (SELECT * INTO OUTFILE ’ file_name ’ FROM  table_name ); ... UNION SELECT * INTO OUTFILE ’ file_name ’ FROM  table_name ; Those variants are deprecated because they are confusing, as if they collect information from the named table rather than the entire query expression (the  UNION ). UNION  queries with an aggregate function in an  ORDER BY  clause are rejected with an ER_AGGREGATE_ORDER_FOR_UNION  error. Example: In MySQL 8.0, the parser rules for  SELECT  and  UNION  were refactored to be more consistent (the same SELECT  syntax applies uniformly in each such context) and reduce duplication. Compared to MySQL 5.7, several user-visible effects resulted from this work, which may require rewriting of certain statements: UNION Handing in MySQL 8.0 Compared to MySQL 5.7 As of MySQL 8.0.20, these two  UNION  variants containing  INTO  are deprecated and you should expect support for them to be removed in a future version of MySQL: