- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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)
- Related Articles
- In MySQL, how does the precedence of ! operator in comparison with NOT operator depends upon HIGH_NOT_PRECEDENCE SQL mode?
- According to Java Operator precedence, which operator has the highest precedence?
- PHP Operator Precedence
- Does pandas depend on NumPy?
- On which factors does friction depend?
- How does the portfolio risk depend on the correlation between assets?
- On what factors does the resistance of a conductor depend?
- What is Operator Precedence Parsing?
- On what factors does our type of clothing depend?
- What is the operator precedence in C#?
- How Can MySQL operator precedence affect result set?
- On what factors does the kinetic energy of a body depend?
- On what factor/factors does the weight of a body depend?
- Operator Precedence and Associativity in C
- What is the use of IGNORE_SPACE SQL mode?

Advertisements