sql语言

时间:2017-08-31 20:05:56   收藏:0   阅读:149

select * from emp where sal between 2500 and 5000;--使用between取区间

select * from emp where sal in(2500,5000);--可以指定取想要的数;

select * from emp where sal between 1000 and 4000 and deptno in(10,20);--查询表里工资1000-4000的人,部门要在10和20的人;

select * from emp where deptno in(10,30)and ename not like‘A%‘--查询10 和30部门里没有A开头的

select * from emp where deptno in(10,30)and ename not like‘_%A%‘查询A开头除外所有没有A字母的

select * from emp e, dept d where e.deptno=d.deptno and (d.loc not like‘NEW YORK,CHICAGO‘
or job=‘MANAGER‘and e.ename not like ‘_%B%_%C%‘)--

 查询所有纽约和芝加哥工作的人中的经理和名字首字母之外不含B或C的人 

原文:http://www.cnblogs.com/wbj195/p/7460222.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!