查询oracle数据库语句

1.根据一个字段返回符合条件的数据

select * from pub_dept  a where instr(a.deptname,'技')>0

2.同时两个字段符合则返回该条数据

select * from pub_dept a where (a.deptcode,a.deptname)=(select a.deptcode,a.deptname from pub_dept a where a.deptid='1491')

3.符合某一个条件则返回该条数据

select  * from pub_dept a where a.deptcode='1491' union(select * from pub_dept b where b.deptcode='1492')

4.符合某一个条件则返回该条数据

select * from pub_dept a where a.deptcode in('1491','1492')

5.判断是否符合某个条件返回该表数据

select * from pub_dept a where exists(select * from pub_dept b where b,deptcode='1491')

原文地址:https://www.cnblogs.com/HansZimmer/p/15627493.html