-
[not] between...and...
[不] 在范围之内。 -
[not] in()
[不] 在列出值范围内。 -
is [not] null
[不] 为空。
1.[not] between...and...
[不] 在范围之内。
mysql> select 1 between 15 and 20;
+---------------------+
| 1 between 15 and 20 |
+---------------------+
| 0 |
+---------------------+
mysql> select 15 between 15 and 20;
+----------------------+
| 15 between 15 and 20 |
+----------------------+
| 1 |
+----------------------+
mysql> select 16 not between 15 and 20;
+--------------------------+
| 16 not between 15 and 20 |
+--------------------------+
| 0 |
+--------------------------+
2.[not] in()
[不] 在列出值范围内。
mysql> select 15 in (5,10,15,20);
+--------------------+
| 15 in (5,10,15,20) |
+--------------------+
| 1 |
+--------------------+
mysql> select 16 in (5,10,15,20);
+--------------------+
| 16 in (5,10,15,20) |
+--------------------+
| 0 |
+--------------------+
mysql> select 15 not in (5,10,15,20);
+------------------------+
| 15 not in (5,10,15,20) |
+------------------------+
| 0 |
+------------------------+
3.is [not] null
[不] 为空。
mysql> select null is null;
+--------------+
| null is null |
+--------------+
| 1 |
+--------------+
mysql> select '' is null;
+------------+
| '' is null |
+------------+
| 0 |
+------------+
mysql> select 0 is null;
+-----------+
| 0 is null |
+-----------+
| 0 |
+-----------+
mysql> select null is not null;
+------------------+
| null is not null |
+------------------+
| 0 |
+------------------+
网友评论