10.25随笔

发布时间 2023-12-18 20:15:48作者: y龙

特殊条件

1.空值判断: is null

Select * from emp where comm is null;

查询 emp 表中 comm 列中的空值。

2.between and (在 之间的值)

Select * from emp where sal between 1500 and 3000;

查询 emp 表中 SAL 列中大于 1500 的小于 3000 的值。

注意:大于等于 1500 且小于等于 3000, 1500 为下限,3000 为上限,下限在前,上限在后,查询的范围包涵有上下限的值。

3.In

Select * from emp where sal in (5000,3000,1500);

查询 EMP 表 SAL 列中等于 5000,3000,1500 的值。

4.like

Like模糊查询

Select * from emp where ename like 'M%';

查询 EMP 表中 Ename 列中有 M 的值,M 为要查询内容中的模糊信息。

  •  % 表示多个字值,_ 下划线表示一个字符;
  •  M% : 为能配符,正则表达式,表示的意思为模糊查询信息为 M 开头的。
  •  %M% : 表示查询包含M的所有内容。
  •  %M_ : 表示查询以M在倒数第二位的所有内容。