码迷,mamicode.com
首页 > 其他好文 > 详细

补上15的

时间:2014-09-16 01:31:39      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:des   ar   art   代码   on   c   工作   时间   ad   

今晚断网了 所以只能现在这里先记着了,为期13天的第一阶段(杨洪波老师) 基础加强 ,和ADO.net结束了,在这里谢谢小杨老师,虽然不能说小杨老师课讲的透彻,但是,这也是我目前为止觉得还行的老师,其实,每个人都是老师领进门,修行靠个人了 现在我才发现平时少敲代码是最大的短板 还有基础很不扎实 这都需要自己下狠功夫去补,虽然有点后悔以前的的浪费时间,但是也庆幸自己现在发现了。虽然苦点,累点,但是我觉得自己造成后果,只能用自己几倍的努力去弥补!
--1.列出EMPLOYEES表中各部门的:部门编号,最高工资,最低工资
select department_id 部门编号,max(salary) 最高工资,min(salary) 最低工资 from employees group by department_id select * from departments
--2.列出EMPLOYEES表中各部门的:部门编号、部门名称、最高工资、最低工资
select Employees.Department_Id 部门编号,Department_Name 部门名称,MAX(Salary) 最高工资,MIN(Salary) 最低工资 from Departments inner join Employees on Departments.Department_ID=Employees.Department_Id group by Department_Name,Employees.Department_Id
select * from dbo.Departments
--3.列出EMPLOYEES表中各部门中‘职员‘(Employee_job为‘职员‘)的:最低工资,最高工资和部门Id select department_id 部门ID, max(salary) 最高工资,min(salary) 最低工资 from employees where employee_job=‘职员‘ group by department_id
select * from dbo.Employees
4.对于EMPLOYEES中最低工资小于1000的部门,列出EMPLOYEE_JOB为‘职员‘的:部门编号,最低工资,最高工资 select department_id 部门ID,max(salary) 最高工资,min(salary) 最低工资,employee_job from employees where Employee_Job=‘职员‘ group by department_id,Employee_Job having min(salary)<1000 5.根据部门编号由高到低,工资由低到高,列出每个员工的姓名,部门号,工资 select employee_name 员工名,department_id 部门编号,salary 工资 from dbo.Employees order by Department_Id desc,salary asc --6.列出‘吴用‘所在部门中每个员工的姓名与部门号 select * from dbo.Employees select employee_name,department_id from Employees where department_id in(select department_id from employees where employee_name=‘吴用‘) select * from dbo.Departments --7.列出每个员工的姓名,头衔,部门号,部门名 select Employees.employee_name,Employees.employee_job,Employees.Department_Id,Departments.department_name from employees inner join departments on Employees.department_id=Departments.Department_Id --8.列出EMPLOYEES中头衔为‘职员‘的员工的姓名,工作,部门号,部门名 select * from dbo.Employees select * from dbo.Departments select employees.employee_name,employees.employee_job,employees.Department_Id,departments.department_name from employees inner join departments on employees.Department_Id=departments.Department_Id where employees.employee_job=‘职员‘ --9.对于DEPARTMENTS表中,列出所有:部门名称,部门编号,以及该部门的:员工姓名与头衔 select Departments.department_id,Departments.department_name, Employees.employee_job,Employees.employee_name from Departments left join Employees on Employees.department_id=Departments.Department_Id
唉。。。。。。无言以对-------今天有点伤感 所以就到这里 努力再努力!

补上15的

标签:des   ar   art   代码   on   c   工作   时间   ad   

原文地址:http://www.cnblogs.com/GodLin/p/3974037.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!