Home > Database > Mysql Tutorial > Does double equal sign exist in MySQL?

Does double equal sign exist in MySQL?

王林
Release: 2023-09-14 09:09:07
forward
1449 people have browsed it

Does double equal sign exist in MySQL?

There is no concept of double equal sign. It can be used to compare two values. If you use double equal signs (==) in MySQL, you will get an error message.

Let us verify whether this concept is correct. Declare a variable −

mysql> set @Number=10;
Query OK, 0 rows affected (0.00 sec)
Copy after login

Now, compare the above variable value with 10. The result will be 1 if the two values ​​are the same, 0 otherwise.

Use double equal sign -

mysql> select 10==@Number;
Copy after login

This will produce the following output i.e. error -

ERROR 1064 (42000): You have an error in your SQL syntax; 
check the manual that corresponds to your MySQL server version 
for the right syntax to use near '==@Number' at line 1
Copy after login

Let us now change the double equal sign (==) to single equal sign (=)−

mysql> select 10=@Number;
Copy after login

This will produce the following output-

+------------+
| 10=@Number |
+------------+
| 1          |
+------------+
1 row in set (0.00 sec)
Copy after login

The above is the detailed content of Does double equal sign exist in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template