举例:
mysql> select 1!=1;
+------+
| 1!=1 |
+------+
| 0 |
+------+
1 row in set (0.00 sec)
mysql> select 3 between 8 and 10;
+--------------------+
| 3 between 8 and 10 |
+--------------------+
| 0 |
+--------------------+
1 row in set (0.00 sec)
mysql> select 3<20;
+------+
| 3<20 |
+------+
| 1 |
+------+
1 row in set (0.00 sec)
mysql> select 3 in (1,2,3);
+--------------+
| 3 in (1,2,3) |
+--------------+
| 1 |
+--------------+
1 row in set (0.00 sec)
mysql> select 3 is not null;
+---------------+
| 3 is not null |
+---------------+
| 1 |
+---------------+
1 row in set (0.00 sec)
mysql> select 'bak' like '%a%';
+------------------+
| 'bak' like '%a%' |
+------------------+
| 1 |
+------------------+
1 row in set (0.00 sec)
这里注意:
mysql> select '' is null;
+------------+
| '' is null |
+------------+
| 0 |
+------------+
1 row in set (0.00 sec)
mysql> select null is null;
+--------------+
| null is null |
+--------------+
| 1 |
+--------------+
1 row in set (0.00 sec)
#爱老婆,这个是必须的,这个是真爱哈哈
mysql> select 'huangbaokang love zhanglulu' regexp '.* love .*';
+---------------------------------------------------+
| 'huangbaokang love zhanglulu' regexp '.* love .*' |
+---------------------------------------------------+
| 1 |
+---------------------------------------------------+
1 row in set (0.00 sec)