How can I use MySQL IN() function to compare row constructors?

MySQLMySQLi Database

We can also use IN() function to compare row constructors. Consider the following example to make it clearer −

mysql> Select (10,2) IN ((5,10),(10,2),(2,10),(100,100));
+--------------------------------------------+
| (10,2) IN ((5,10),(10,2),(2,10),(100,100)) |
+--------------------------------------------+
| 1                                          |
+--------------------------------------------+
1 row in set (0.00 sec)

mysql> Select (10,2) IN ((5,10),(2,10),(100,100));
+-------------------------------------+
| (10,2) IN ((5,10),(2,10),(100,100)) |
+-------------------------------------+
| 0                                   |
+-------------------------------------+
1 row in set (0.00 sec)
raja
Updated on 22-Jun-2020 06:38:09

Advertisements