设有关系表EMP(ENO,ENAME,SALARY,DNO),其中各属性的含义依次为职工号、姓名、工资和所在部门号,以及关系表DEPT(DNO,DNAME,MANAGER),其中各属性含义依次为部门号、部门名称、部门经理的职工号请用一句SQL语句将"销售部"的那些工资数额低于600的职工的工资上调10% update emp
  set salary=(
  select salary*1.1  from emp,dept 
   where  emp.dno=dept.dno
     and dname='销售部' and salary<600
     )
    where salary<600;提示错误,错在哪里?

解决方案 »

  1.   

    update emp set salary=salary*1.1
    where salary <600
    and DNO in (select DNO from DEPT where dname='销售部')
      

  2.   

     update emp
       set salary=salary*1.1 
    where emp.dno=dept.dno and dname='销售部' and salary <600
      

  3.   

    2楼的语句是错误的.楼主也可用下面的SQL语句:merge into emp
    using dept
    on(emp.dno=dept.dno and dept.dname='销售部')
    when matched then 
    update set salary=salary * 1.1;
      

  4.   

    更改一下上面的SQL语句: 
    将:
    on(emp.dno=dept.dno and dept.dname='销售部')
    改为:
    on(emp.dno=dept.dno and dept.dname='销售部' and emp.salary<=600)即可
      

  5.   

    update emp set salary=salary*1.1 where salary  <600 and DNO in (select DNO from DEPT where dname='销售部') 这是正确的,我试过。
      

  6.   

     update emp
      set salary=(
      select salary*1.1  from  dept 
       where  emp.dno=dept.dno
         and dname='销售部' and salary <600
         )
        where salary <600; 
    这样可以吗