数据库第二次作业

这篇博客主要涵盖了MySQL数据库的查询操作,包括选择特定字段、按条件过滤记录、范围查询、聚合函数应用、排序和连接查询等。通过一系列实例,如查询特定部门员工、工资范围、部门信息及员工统计,深入探讨了SQL查询的多种技巧和方法。
摘要由CSDN通过智能技术生成

查询语句

select e_no,e_name,e_salary from employee;
select *from employee where dept_no = 10 or  dept_no = 20;
select * ,(select d_name from dept d where d.d_no = e.dept_no ) 部门 from employee e where e_salary>800 and e_salary<2500;
select * ,(select d_name from dept d where d.d_no = e.dept_no ) 部门 from employee e where dept_no=20;
select * ,(select d_name from dept d where d.d_no = e.dept_no ) 部门 from employee e where e_salary=any(select max(e_salary) from employee e  group by e.dept_no);
select d_name ,d_location ,(SELECT e_name from employee where e_name= 'BLAKE') 姓名 from dept d where d.d_no=(select dept_no from employee where e_name = 'BLAKE');
select e.e_name,d.d_name,d.d_location from employee e,dept d where e.dept_no = d.d_no;
select count(1) ,d.d_name from employee e ,dept d  where e.dept_no = d.d_no group by  e.dept_no;
select sum(e_salary),d.d_name from employee e ,dept d 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值