SQL语句

1、DISTINCT
SELECT DISTINCT 列名称 FROM 表名称
 
2、!= 和 not
select * from emp where job != 'clerk';
select * from emp where not job = 'clerk';
 
3、between ... and
oracle中日期格式;
1981年出生的雇员信息;
select * from emp where hierdate between '01-1月-1981' and '31-12月-1981'
 
4、is null 和 is not null 和 not 字段 is null
select * from emp where comm is null;
select * from emp where comm is not null;
select * from emp where not comm is null;
 
5、in 和 not in
在in中使用null对结果没有影响;
在not in中使用null 则查不到任何数据;
select * from emp where empno = 7369 or empno = 7499 or empno = 8899;
select * from emp where empno in (7369,7499,8899);
 
6、like子句的用法
_匹配任意一个任意字符;
%匹配0个、1个或多个任意字符;
select * from emp where ename like '_a%';
原文地址:https://www.cnblogs.com/Lemon-ZYJ/p/9324058.html