Description\n-----------\n\nParentheses are sometimes called precedence operators - this means that they can be used to change the other operator's precedence in an expression. The expressions that are written between parentheses are computed before the expressions that are written outside. Parentheses must always contain an expression (that is, they cannot be empty), and can be nested.\n\nFor example, the following expressions could return different results:\n\n NOT a OR b\n NOT (a OR b)\n\nIn the first case, NOT applies to a, so if a is FALSE or b is TRUE, the expression returns TRUE. In the second case, NOT applies to the result of a OR b, so if at least one of a or b is TRUE, the expression is TRUE.\n\nWhen the precedence of operators is not intuitive, you can use parentheses to make it immediately clear for whoever reads the statement.\n\nThe precedence of the NOT operator can also be affected by the HIGH_NOT_PRECEDENCE SQL_MODE flag.\n\nOther uses\n\nParentheses must always be used to enclose subqueries.\n\nParentheses can also be used in a JOIN statement between multiple tables to determine which tables must be joined first.\n\nAlso, parentheses are used to enclose the list of parameters to be passed to built-in functions, user-defined functions and stored routines. However, when no parameter is passed to a stored procedure, parentheses are optional. For builtin functions and user-defined functions, spaces are not allowed between the function name and the open parenthesis, unless the IGNORE_SPACE SQL_MODE is set. For stored routines (and for functions if IGNORE_SPACE is set) spaces are allowed before the open parenthesis, including tab characters and new line characters.\n\nSyntax errors\n\nIf there are more open parentheses than closed parentheses, the error usually looks like this:\n\n``sql\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual that\ncorresponds to your MariaDB server version for the right syntax to use near '' a\nt line 1\n`\n\nNote the empty string.\n\nIf there are more closed parentheses than open parentheses, the error usually looks like this:\n\n`sql\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual that\ncorresponds to your MariaDB server version for the right syntax to use near ')'\nat line 1\n``\n\nNote the quoted closed parenthesis.\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/bit-functions-and-operators/parentheses