第一个我是这么写的:
Select * from EMP where salary >= (select * from EMP where ID=ManID) and ID<>ManID
Select * from EMP where salary >= (select * from EMP where ID=ManID) and ID<>ManID
解决方案 »
- 请教关于后台弹出页面无法遮蔽全屏的问题(artdialog)
- Ejb3 TimerService自动启动
- 求教:如何在TOMCAT搭建SSH模板?(Linux debian系统)
- jsp有api开发文档吗?
- 在一个工程中有多个struts-config.xml文件,会有冲突吗?
- 关于STRUTS 表单的问题
- 200大分!关于把EJB事务传播到非EJB类的问题!
- Help!和EJB第一次亲密--我的麻烦
- 大家有没有看到这篇文章:http://www.yesky.com/20021105/1638333.shtml,开玩笑!
- 如何设计一个频繁DML操作的表,mysql
- 开发中遇到的字符编码的问题,请老手指点
- [b][b]求大家帮我出个主意,我是用假文凭混进公司的,现在试用期已满,公司要和我签合同,跟我要档案办保险用,请问我该怎么办??请各位大哥帮
believefym(feng)的是正确答案
---------
第2个题我不会
直接根据参数来new也可以,如果A、B、C都有构造方法的话可以用反射
if(msg.equals("A")) new A();
else if...
直接根据参数来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);
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
第二题:已有答案
四种连接:等连接,不等连接,外连接和自连接。这题属于自连接。
在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)已经解答了。。
class f{
public object insteans(string xx){
xx cc=new xx();
return cc;
}
}
return Class.forName(name).newInstance();
}不该用factory的,A,B,C 又没implements想同的interface.
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来实现,这样就不用严格要求他们是继承同一个父类了。
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);
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;
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();
}
}