1 基本运算符

比较预算符

  1. select * from student where age<18;

其中比较运算符有< > <= >= !=

逻辑运算符

select * from student where age<18 and age>12;
  • and
  • or

    mysql> select * from student where age<18 and age>12 and not age=15;
    
  • not加在判断语句之前

  • not后面一定是一个范围

    2 模糊查询

    like ```sql select age from student where age like “%1%”;

select age from student where age like “_“; 下划线用来询位数

mysql> select age from student where age like “__%”; 查询年龄在二位数以上的

一般不常用,效率较低<br />relike
```sql
里面写正则表达式

3范围查询

in
not in

不在某个范围内
mysql> select age from student where age not in (1,999,123);
mysql> select age from student where age in (1,999,123);

between and

mysql> select age from student where age between 1 and 18;
mysql> select age from student where age not between 1 and 18;

空判断
is null
is not null 不为空