Oracle数据库(三)
2024-08-31 16:20:26
专题一:oracle查询
1.where查询
- 查询部门编号是1的部门信息
select *from emp where deptno=;
- 查询姓名是kw的员工,字符串使用‘’,内容大小写敏感
select *from emp where name='kw'
查询2018年1月4日入职的员工,注意oracle默认日期格式(DD-MON-RR表示2位的年份)
select * from emp where hiredate = '4-1月-18';
- 查询age大于20的员工
select * from emp where age > 20;
- 查询age不等于20
select *from emp where age<>;
- 查询年龄在20到25岁之间的员工信息
select *from emp where (age>) and (age <);
或者
select *from emp where age between 20 and 25;
- 查询age不在20到25之间的员工信息
select *from emp where age NOT between and ;
总结:between……and……,小数据必须在前,大数据在后。
不等于符号<>或者!=
- or的使用,in的使用
- 查询名字为kw或者为wq的信息
select *from emp where name='kw' or name='wq';
或者
select *from emp where name in ('kw','wq');
- 模糊查询
select *from emp where name like 'k%' --匹配0个,1个或者多个
- 查询以w结尾的员工信息
select *from emp name like '%w''
- 查询第一个为k,最后一个是q的员工信息
select *from emp where name like 'k%q'
- 查询第一个为k,第三个是q的员工信息
select *from emp where name like ‘k_q’;
- 查询叫k_的员工
select *from emp where name like 'k_' escape '\';
- 对于数据的查询如果函数‘’‘的是数据,需要使用‘进行转义
- 查询null的数据,使用is null;
select *from emp where comm is null;
- 查询数据的奖金为null,佣金大于1000的
select *from emp where (comm is null) and (sal>);
- 查询薪水是100,200,300.400的元工信息
select *from emp where sal in(,,,);
最新文章
- tomcat详情
- Redis教程(十三):管线详解
- Oracle死锁查询及处理
- Repeater控件使用(含删除,分页功能)
- Displaying SharePoint Lists or Libraries in other sites 显示其他站点的List
- 分拆素数和[HDU2098]
- jQuery deferred when用法
- [Everyday Mathematics]20150106
- 收录一个简单的css类库
- [Javascript] Grouping and Nesting Console Log Output
- shape 填充 圆角矩形 圆形 环形
- MYSQL id 自动加1
- 【转】TI蓝牙BLE 协议栈代码学习
- Git文件状态描述
- XCTF(77777-2)
- [Mac] mac linux 多线程下载利器 axel
- BigInteger类及方法应用
- windows下安装mysql遇到的问题
- 转:Parameter Server 详解
- Nginx的进程