oracle查询题目2道

1.列出与“SCOTT”从事相同工作的所有员工。

①先查询SCOTT从事的是什么工作

select job from emp where name like='SCOTT';

②select ename from emp where job in(select job from emp where name like='SCOTT')   and name! like ='SCOTT';√(自己除外)

2.请用SQL语句将“销售部”的那些工资数额低于600的职工的工资上调10%。

 ①先查询出“销售部”的那些工资数额低于600的职工”

select ename from emp ,dept where  emp.deptno = dept.deptno and sal<600 , dname="销售部";

②update 表名 set 字段 where 条件

update emp set sal=sal*1.1  where  eno in(select eno from emp ,dept where  emp.deptno = dept.deptno and sal<600 and dname="销售部");

  

原文地址:https://www.cnblogs.com/langlove/p/3402315.html