Home  >  Article  >  Database  >  Does double equal sign exist in MySQL?

Does double equal sign exist in MySQL?

王林
王林forward
2023-09-14 09:09:071400browse

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)

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;

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

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

mysql> select 10=@Number;

This will produce the following output-

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

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete