- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How does the precedence of || operator depend on PIPES_AS_CONCAT SQL mode?
As we know that in MySQL by default || operator is a logical OR operator but it depends upon PIPES_AS_CONCAT SQL mode. If PIPES_AS_CONCAT SQL mode is enabled, then || operator works as string concatenation. At that time its precedence would be between ^ and the unary operator. Following example will make it understand −
mysql> Set @C='tutorials'; Query OK, 0 rows affected (0.00 sec) mysql> Set @D='point'; Query OK, 0 rows affected (0.00 sec) mysql> Select @C||@D; +--------+ | @C||@D | +--------+ | 1 | +--------+ 1 row in set (0.00 sec)
The result set of the above query shows that || works as OR operator that is why the output is 1 for true.
mysql> Set SQL_MODE = 'PIPES_AS_CONCAT'; Query OK, 0 rows affected (0.10 sec)
After enabling the PIPES_AS_CONCAT SQL mode, || works as the synonym of CONCAT() function i.e. string concatenation function. It is shown in the following result set −
mysql> Select @C||@D; +----------------+ | @C||@D | +----------------+ | tutorialspoint | +----------------+ 1 row in set (0.00 sec)
- In MySQL, how does the precedence of ! operator in comparison with NOT operator depends upon HIGH_NOT_PRECEDENCE SQL mode?
- Does pandas depend on NumPy?
- How does the portfolio risk depend on the correlation between assets?
- According to Java Operator precedence, which operator has the highest precedence?
- PHP Operator Precedence
- How does the execution of a particular test method depend on other test methods in TestNG?
- What is the use of ALLOW_INVALID_DATES SQL mode?
- What is the use of IGNORE_SPACE SQL mode?
- What is the operator precedence in C#?
- What is Operator Precedence Parsing?
- How does running a specific test method depend on another test method in TestNG?
- How does the * operator work on a tuple in Python?
- How does * operator work on list in Python?
- Operator Precedence and Associativity in C
- How Can MySQL operator precedence affect result set?