Map decision functions
Map decision functions/operators perform a judgment on the input map data and return a Boolean value. seekdb currently supports the = and != operators.
=/!=
The = and != operators determine whether two map data are equal. The syntax is as follows:
map1 = map2;
map1 != map2;
The input parameters are described as follows:
map1must be a map type.map2must be a map type.
The returned results are described as follows:
- For
=,1indicates equality, and0indicates inequality. - For
!=,0indicates equality, and1indicates inequality. - Two maps are considered equal only when their keys and values are all equal.
Here are some examples:
SELECT map(1,"a",2,"b") = map(1,"a",2,"b");
+-------------------------------------+
| map(1,"a",2,"b") = map(1,"a",2,"b") |
+-------------------------------------+
| 1 |
+-------------------------------------+
1 row in set (0.001 sec)
-- When comparing, the system automatically converts arrays to comparable types
SELECT map(1,"a",2,"b") = map("1","a","2","b");
+-----------------------------------------+
| map(1,"a",2,"b") = map("1","a","2","b") |
+-----------------------------------------+
| 1 |
+-----------------------------------------+
1 row in set (0.001 sec)
-- When the keys are equal but the values are not, 0 is returned
SELECT map(1,"a",2,"b") = map(1,"a",2,"c");
+-------------------------------------+
| map(1,"a",2,"b") = map(1,"a",2,"c") |
+-------------------------------------+
| 0 |
+-------------------------------------+
1 row in set (0.001 sec)