Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
omairbang
Starting Member
3 Posts |
Posted - 2013-11-05 : 02:18:16
|
Need to create following commands using these 2 tables:Employee(empno,ename,job,mgr,hiredate,sal,comm.,deptno)Dept(deptno,dname,loc)h) Give an employee 8% salary increases if he or she is hired before 1981 and has salary less than 1500.i) Find the minimum salary of each department from EMP.j) Find the number of employees of all the departments located in DALLASk) Find the employees supervised by King and Blakel) Find those employees who make more than BLAKE doesm) Find the maximum salary among the people who work in Dallasn) Give everybody 10% salary increase in the departments whose maximum salaries are less than 2000o) Find the employees who are making more than everybody in SALES department |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-05 : 02:32:05
|
this is an assignment question. unless we see an attempt from your end we wont offer any help for assignment questions------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
omairbang
Starting Member
3 Posts |
Posted - 2013-11-05 : 02:44:30
|
h) Give an employee 8% salary increases if he or she is hired before 1981 and has salary less than 1500.UPDATE employee SET SAL * 1.08 WHERE e.HIREDATE<19830101’ AND e.SAL<1500;i) Find the minimum salary of each department from EMP.SELECT d.name, MIN(sal) as “Lowest Salary” FROM e.name GROUP BY d.name;j) Find the number of employees of all the departments located in DALLASSELECT COUNT(e.EMPNO) FROM employee e, department d WHERE e.DEPTNO = d.DEPTNO AND d.LOCATION = 'Dallas';k) Find the employees supervised by King and BlakeSELECT e.name WHERE mgr = empno;l) Find those employees who make more than BLAKE doesm) Find the maximum salary among the people who work in Dallasn) Give everybody 10% salary increase in the departments whose maximum salaries are less than 2000 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-05 : 03:02:58
|
quote: Originally posted by omairbang h) Give an employee 8% salary increases if he or she is hired before 1981 and has salary less than 1500.UPDATE employee SET SAL = SAL * 1.08 WHERE e.HIREDATE< '19830101' AND e.SAL<1500; i) Find the minimum salary of each department from EMP.SELECT d.name, MIN(sal) as “Lowest Salary” FROM DepartmentTable GROUP BY d.name; j) Find the number of employees of all the departments located in DALLAS[]SELECT COUNT(e.EMPNO) FROM employee e, department d WHERE e.DEPTNO = d.DEPTNO AND d.LOCATION = 'Dallas'; k) Find the employees supervised by King and BlakeSELECT e1.name FROM Employee e1JOIN Employee e2ON e2.empno = e1.mgrWHERE e2.empname IN ('King','Blake') l) Find those employees who make more than BLAKE doesSELECT *FROM EmployeeWHERE Salary > (SELECT SalaryFROM EmployeeWHERE empname = 'Blake') m) Find the maximum salary among the people who work in Dallassame as j but use max over salaryn) Give everybody 10% salary increase in the departments whose maximum salaries are less than 2000UPDATE eSET Sal = Sal * 1.1FROM Employee eINNER JOIN (SELECT DeptNo FROM Employee e1 GROUP BY DeptNo HAVING MAX(Salary) < 2000 )dON d.DeptNo = e.DeptNo
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|
|
|