Syntax\n------\n\n(  expression )\n[ORDER BY [column[, column...]]]\n[LIMIT {[offset,] row_count | row_count OFFSET offset}]\n\nDescription\n-----------\n\nUsing parentheses in SQL allows to control the order of execution for SELECT statements and Table Value Constructor, including UNION, EXCEPT, and INTERSECT operations. MariaDB executes the parenthetical expression before the rest of the statement. You can then use ORDER BY and LIMIT clauses the further organize the result set.\n\nThe Optimizer may rearrange the exact order in which MariaDB executes different parts of the statement. When it calculates the result set, however, it returns values as though the parenthetical expression were executed first.\n\nExamples\n--------\n\nCREATE TABLE test.t1 (num INT);\n\nINSERT INTO test.t1 VALUES (1),(2),(3);\n\n(SELECT  FROM test.t1 \n UNION \n VALUES (10)) \nINTERSECT \nVALUES (1),(3),(10),(11);\n+------+\n| num  |\n+------+\n|    1 |\n|    3 |\n|   10 |\n+------+\n\n((SELECT  FROM test.t1 \n  UNION \n  VALUES (10)) \n INTERSECT \n VALUES (1),(3),(10),(11)) \nORDER BY 1 DESC;\n+------+\n| num  |\n+------+\n|   10 |\n|    3 |\n|    1 |\n+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/precedence-control-in-table-operations