当前位置: 首页 > news >正文

网站地图建设有什么用百度推广营销中心

网站地图建设有什么用,百度推广营销中心,廊坊关键词seo排名网站,阿泰勒北京网站建设1、查询员工的姓名、年龄、职位、部门信息(隐式内连接)。 #emp、dept #连接条件:emp.dept_iddept.id select e.name,e.age,e.job,d.name from emp e,dept d where e.dept_idd.id; 2、查询年龄小于30岁的员工姓名、年龄、职位、部…

1、查询员工的姓名、年龄、职位、部门信息(隐式内连接)。

#emp、dept
#连接条件:emp.dept_id=dept.id
select e.name,e.age,e.job,d.name from emp e,dept d where e.dept_id=d.id;

2、查询年龄小于30岁的员工姓名、年龄、职位、部门信息(显示内连接)。

#emp、dept
#emp.dept_id=dept.id
select e.name,e.age,e.job,d.name from emp e inner join dept d on e.dept_id=d.id where e.age < 30;

3、查询拥有员工的部门id、部门名称(内连接)。

#emp、dept
#连接条件:emp.dept_id=dept.id
select distinct d.id,d.name from emp e,dept d where e.dept_id=d.id;

4、查询所有年龄大于40岁的员工,及其归属的部门名称;如果员工没有分配部门,也需要展示出来。

#emp、dept
#连接条件:emp.dept_id=dept.id
#左外连接
select e.*,d.name from emp e left join dept d on e.dept_id=d.id where e.age > 40;

5、查询所有员工的工资等级。

写法1

#emp、salgrade
#连接条件:emp.salary >= salgrade.losal and emp.salary <= salgrade.hisal
select e.*,s.grade,s.losal,s.hisal from emp e,salgrade s where e.salary >= s.losal and e.salary <= s.hisal;

写法2(between)

#emp、salgrade
#连接条件:emp.salary >= salgrade.losal and emp.salary <= salgrade.hisal
select e.*,s.grade,s.losal,s.hisal from emp e,salgrade s where e.salary between s.losal and s.hisal;

6、查询研发部所有员工的信息及工资等级。

#表emp,salgrade,dept
#连接条件:emp.salary between salgrade.losal and salgrade.hisal,emp.dept_id=dept.id;
#查询条件:dept.name = '研发部';
select e.*,s.grade from emp e,dept d,salgrade s where e.dept_id= d.id and (e.salary between s.losal and s.hisal) and d.name='研发部';#美化后的sql
SELECT #之后是查询返回的字段e.*,s.grade 
FROM #之后是所查询的表emp e,dept d,salgrade s 
WHERE #之后是查询条件e.dept_id = d.id AND ( e.salary BETWEEN s.losal AND s.hisal ) AND d.NAME = '研发部';

7、查询研发部员工的平均工资。

#表:emp、dept
#连接条件:emp.dept_id=dept.id
select avg(e.salary) from emp e,dept d where e.dept_id = d.id and d.name = '研发部';

8、查询工资比灭绝高的员工信息。

#查询灭绝的薪资
select salary from emp where name = '灭绝';
#查询比灭绝工资高的员工信息
select * from emp where salary > 8500;#优化后的子查询(只返回一个值,标量子查询)
select * from emp where salary > (select salary from emp where name = '灭绝');

9、查询比平均薪资高的员工信息。

#查询员工的平均薪资
select avg(salary) from emp; #查询比员工的平均薪资高的员工信息
select * from emp where salary > (select avg(salary) from emp);

10、查询低于本部门平均工资的员工信息。

#查询指定部门平均薪资
select avg(salary) from emp e1 where e1.dept_id = 1;
select avg(salary) from emp e1 where e1.dept_id = 2;
#查询低于本部门平均工资的员工信息。
select *,(select avg(salary) from emp e1 where e1.dept_id = e2.dept_id) '平均薪资' from emp e2 where e2.salary < (select avg(salary) from emp e1 where e1.dept_id = e2.dept_id);

11、查询所有的部门信息,并统计部门的员工人数。

#查询部门的员工信息。
select d.id,d.name,(select count(*) from emp e where e.dept_id=d.id) '人数' from dept d;
#查询人数。
select count(*) from emp e where dept_id=1;

12、查询所有学生的选课情况,展示出学生名称,学号,课程名称。 

#表:student,course,student_course
#连接条件:student.id=student_course.studentid,course.id=student_course.courseid;
select s.name,s.no,c.name from student s,student_course sc,course c where s.id=sc.studentid and sc.courseid=c.id;
http://www.hengruixuexiao.com/news/12797.html

相关文章:

  • 做网站黑吃黑是什么罪口碑营销的产品有哪些
  • php动态网站开发的基本流程新闻头条最新消息10条
  • 自己做彩票网站吗网站提交入口百度
  • 旅游网站建设的市场分析谷歌浏览器官网下载手机版
  • 手机自己制作表白网站app网络营销推广方案范文
  • 对做网站有什么建议长沙营销网站建设
  • 泰州模板建站代理爱站网查询
  • 网站上的平台专做店铺推广靠谱吗西安seo王
  • 网站只收录无权重德阳seo优化
  • 管廊建设网站优化大师使用心得
  • 深圳联雅做网站怎么样123网址之家
  • 养老做增减的网站重庆seo软件
  • 网站rss怎么做销售网站排名
  • 航佳网站建设网站建设解决方案
  • 哪个网站可以做ppt青岛 google seo
  • 惠来做网站网站注册免费
  • 建设网站建议天津百度推广排名
  • 宜宾市建设工程质量监督站网站怎么优化自己网站的关键词
  • 行业网站解决方案怎么做推广网络
  • 青岛网站建设开发网站推广的技术有哪些
  • 给素材网站做素材方法自己的网站怎么建立
  • 换了家公司做网站如何接入备案网站开发的流程
  • wordpress搭建相册长沙官网seo
  • 铜川免费做网站私人做网站
  • 福州最好的网站建设下载百度安装到桌面
  • 网站建设后台管理有做网站的吗
  • 高清视频服务器内存广东seo
  • 苏州建设网站制作100个免费推广网站
  • 黄骅做网站品牌宣传策略
  • 时时彩网站建设企业查询系统官网