0806自检

1.SQL语句查询!!!!!!!!!!!
列出各个部门中工资高于本部门的平均工资的员工,
创建表:
mysql> create table employee921(id int primary key auto_increment,name varchar(5
0),salary bigint,deptid int);

插入实验数据:
mysql> insert into employee921 values(null,‘zs’,1000,1),(null,‘ls’,1100,1),(null
,‘ww’,1100,1),(null,‘zl’,900,1) ,(null,‘zl’,1000,2), (null,‘zl’,900,2) ,(null,‘z
l’,1000,2) , (null,‘zl’,1100,2);

答案如下
SELECT e.name,e.deptid from employee e,
(SELECT deptid,avg(salary) as asa1 from employee GROUP BY deptid) e1
where e.deptid=e1.deptid and e.salary > e1.asa1

如果要查询人数 只需要在显示中 添加 count(1)
SELECT count(1),e.name,e.deptid from employee e,
(SELECT deptid,avg(salary) as asa1 from employee GROUP BY deptid) e1
where e.deptid=e1.deptid and e.salary > e1.asa1

在这里插入图片描述
转发和重定向的区别:

转发服务器只进行一次请求,在服务器内部进行转发,不会丢失数据
request。getrequestDispatcher()。forward(requset,response);
重定向服务器进行两次请求,会丢失数据
response。sendRedirect();

常用内置对象
out 用来向页面中输出内容
request 客户端向服务器发送的所有请求信息
response 服务器端向客户端响应的所有信息
session 客户端和服务器的一个会话 只要浏览器不关闭 或者超过固定时间不操作就不会注销

不常用 config page pagecontext application  exception

getP 和get A p是request自带的P A是我们设置是有对应的set方法

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值