What is the difference between = and = in mysql
This article mainly introduces the mysql: = and = what are the differences, have a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
The difference between = and =
=
It is only in set and update that it is the same as: =, the function of assignment is equal to that of others. In view of this, when implementing a line number with a variable, you must use: =
: =
The role of constant assignment is not only in set and update, but also in select.
If you understand the difference between = and: =, then you will understand the following phenomenon.
@ num:=@num+1,:= is the function of assignment, so first execute @ num+1, and then assign to @ num, so the function of line number can be realized correctly.
@ num=@num+1, at this time = is equal to the effect, @ num is not equal to @ num+1, so 0 is always returned. If changed to @ num=@num, 1 is always returned. In the mysql database, 1 is used for true and 0 for false.
Thank you for reading this article carefully. I hope the article "what is the difference between = and = in mysql" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!