- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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 Can MySQL operator precedence affect result set?
MySQL follows operator precedence and it has the following list of operators, having the same precedence which is on the same line −
INTERVAL BINARY, COLLATE ! - (unary minus), ~ (unary bit inversion) ^ *, /, DIV, %, MOD -, + <<, >> & | =, <=>, >=, >, <=, <, <>, !=, IS, LIKE, REGEXP, IN BETWEEN, CASE, WHEN, THEN, ELSE NOT &&, AND XOR ||, OR :=
For operators that occur at the same precedence level within an expression, evaluation proceeds from left to right.
Following is an example which shows the effect of operator precedence on result set −
mysql> Select 5+3/2-2; +---------+ | 5+3/2-2 | +---------+ | 4.5000 | +---------+ 1 row in set (0.00 sec)
In the above evaluation, MySQL first evaluates /(div) because it is at higher precedence than +(Addition) or –(Subtraction).
- Can we change operator precedence in Python?
- PHP Operator Precedence
- According to Java Operator precedence, which operator has the highest precedence?
- How can we handle a result set inside MySQL stored procedure?
- How can we divide the result set returned by MySQL into groups?
- How can we get all the unique rows in MySQL result set?
- What is Operator Precedence Parsing?
- In MySQL, how can we randomize set of rows or values in the result set?
- In MySQL, how does the precedence of ! operator in comparison with NOT operator depends upon HIGH_NOT_PRECEDENCE SQL mode?
- Operator Precedence and Associativity in C
- How can we get only unique values of a column in MySQL result set?
- What is the operator precedence in C#?
- What is C Operator Precedence and Associativity?
- What are Precedence Relations in Operator Grammar?
- How can we get the summary output of a column in MySQL result set itself?