第一个我是这么写的:
Select * from EMP where salary >= (select * from EMP where ID=ManID) and ID<>ManID

解决方案 »

  1.   

    select id,salary,man from emp join  (select id as manid, salary as mansalary  from emp where id=man)as tmp on man where salary>=mansalary and id!=man
      

  2.   

    SQL你写错了,根本就不能执行
    believefym(feng)的是正确答案
    ---------
    第2个题我不会
      

  3.   

    不知道第2题考试的JAVA的那个知识点,期待明白人,呵呵
      

  4.   

    第二题就是一个简单工厂方法
    直接根据参数来new也可以,如果A、B、C都有构造方法的话可以用反射
    if(msg.equals("A")) new A();
    else if...
      

  5.   

    believefym(feng) 兄弟  你写的SQL 我怎么执行不了啊
      

  6.   

    第二题就是一个简单工厂方法
    直接根据参数来new也可以,如果A、B、C都有构造方法的话可以用反射
    if(msg.equals("A")) new A();
    else if...
    兄弟,你说的这个我还有有点不明白`~
    第一个我做出来了 不过没有按你写的,我是这么写的:
    select * from emp where salary not in (select salary from emp where id=manid);
      

  7.   

    第一题:
    select id,salary,manid,tmp.mansalary from emp join  (select salary as mansalary , manid as cid from emp where id=manid) as tmp on emp.manid=tmp.cid where salary>=mansalary and id<>manid
    第二题:已有答案
      

  8.   

    第一题:
    四种连接:等连接,不等连接,外连接和自连接。这题属于自连接。
    在Oracle数据库里应该可以这样解,
    select e1.id from EMP e1, EMP e2 where e1.ID <> e1.ManID and e1.ManID = e2.ID and e1.Salary >= e2.Salary;
    应该可以,没试过,如果不行的话,想办法用子查询实现吧。
    第二题:
    太简单了。。工厂模式。。believefym(feng)已经解答了。。
      

  9.   

    第二题简单吗?变态的公司告知A,B,C不是同源类啊,怎么工厂模式?
      

  10.   

    第一题的另外一个答案,请批评指正:select ID from EMP e where (e.id != e.ManID ) and (e.salary >= any(select salary from EMP e2 where e2.ID = e2.ManID))
      

  11.   

    第二个我这样写
    class f{
    public object insteans(string xx){
    xx cc=new xx();
    return cc;
    }
    }
      

  12.   

    ha ha!!! public Object getinstance(name){
        return Class.forName(name).newInstance();
    }不该用factory的,A,B,C 又没implements想同的interface.
      

  13.   

    第一题的答案还可以是:
    select t.*, t.rowid from employee t where t.id<>t.manid and t.salary >=( select m.salary from employee m where m.id=m.manid and t.manid =m.id)第二题可以考虑使用
    if(msg.equals("A")) new A();
    else if...这种方法虽然不太符合工厂模式的一般大众原则,但是,这个是有前提的,题目已经说了,各个类可以用new来实现,这样就不用严格要求他们是继承同一个父类了。
      

  14.   

    第一题,数据库mysql5.0
    mysql> select * from employee emp where emp.id<>emp.deptid and emp.salary>(select temp.salary from employee temp where temp.id=temp.deptid and temp.id=emp.deptid);
      

  15.   

    把getinstance方法的返回值设置成object,那么用不用工厂方法得到的结果都是一致的了,不见得用Class.forName(name).newInstance()就更好一点.还是要看题目考的是哪个知识点
      

  16.   

    select t1.id as emp_id,
           t1.salary as emp_salary,
           t1.manid as Manager_id,
           t2.salary as Manager_salary
      from Emp t1,
           Emp t2
     where t1.manid = t2.id(+)
       and t1.manid <> t1.id
       and t1.salary >= t2.salary;
      

  17.   

    ------------ 1 --------------
    create table EMP
    (
    [id] int primary key,
    salary int,
    manid int
    )insert into EMP values(100,6500,100);
    insert into EMP values(200,500,200);
    insert into EMP values(101,6600,100);
    insert into EMP values(102,6200,100);
    insert into EMP values(103,5100,100);
    insert into EMP values(104,6700,100);
    insert into EMP values(201,5800,200);
    insert into EMP values(202,4200,200);
    insert into EMP values(203,3500,200);
    insert into EMP values(204,2100,200);select * from EMP;select * from EMP as E1 where salary>=(select salary from EMP as E2 where E1.manid=E2.[id]) and E1.[id]!=E1.manid;------------------2-------------------
    class A 
    {}class B 
    {}class C 
    {}public class F
    {
    public static Object getInstance(String className)
    {
    if(className.equals("A"))
    return new A();
    if(className.equals("B"))
    return new B();
    if(className.equals("C"))
    return new C();
    }
    }
      

  18.   

    select t.id from emp t where exits (select 1 from emp tt where t.manid=tt.id and t.Salary>=tt.Salary) and t.id!=t.manid;