MySQL BETWEEN AND关键字

mysql> select * from student;
+------+------+-----------+
| age  | name | address   |
+------+------+-----------+
|   12 | Jack | BeiJing   |
|   19 | Mike | TianJin   |
|   21 | Rose | ZhuHai    |
|   23 | Ann  | ShangHai  |
|   27 | Alis | ShenZhen  |
|   55 | Make | GuangZhou |
+------+------+-----------+
6 rows in set (0.00 sec)

mysql>

mysql> select * from student where age between 15 and 30;

+------+------+----------+

| age  | name | address  |

+------+------+----------+

|   19 | Mike | TianJin  |

|   21 | Rose | ZhuHai   |

|   23 | Ann  | ShangHai |

|   27 | Alis | ShenZhen |

+------+------+----------+

4 rows in set (0.07 sec)



mysql>

mysql> select * from student where age not between 15 and 30;
+------+------+-----------+
| age  | name | address   |
+------+------+-----------+
|   12 | Jack | BeiJing   |
|   55 | Make | GuangZhou |
+------+------+-----------+
2 rows in set (0.00 sec)

 
   

mysql>

 
  

 

你可能感兴趣的:(mysql)