i need to know how i display department which has salary >
=5000 for the below table
Department
-----------
salary deptname
1000 a
3000 a
2000 b
3000 b
4000 c
5000 c
kindly send the query to thilakvinoth13@gmail.com
Answers were Sorted based on User's Feedback
Answer / guest
select deptname from department where salary>=5000
Is This Answer Correct ? | 7 Yes | 1 No |
Answer / vinothmca21
use this,
select dept from employee group by dept having sum(salary)>=
5000
regards,
Vinoth
Is This Answer Correct ? | 4 Yes | 3 No |
Hi dear,
1) If you have need name of total salary of each department to spend on employee(Understand like this) then use query:
select deptname, SUM(salary)
from Department
GROUP BY deptname
HAVING SUM(salary) >= 5000;
2) Otherwise
SELECT deptname
FROM Department
WHERE salary >= 5000;
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / sahil
The query will be to get the total of salary >= 5000 in a
department is :
select deptname, sum (salary) as totalsalary from Department
group by deptname
then it will shown like
deptname total salary
a 4000
b 5000
c 9000
now we will get the highest total salary from department
remember group by is always used to group-set.
select deptname, sum (salary) from Department
group by deptname
having sum (salary) >= 5000
Then you will get the answer!!
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / chandra10shekhar
SELECT * FROM department WHERE salary>=5000
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / arbind panigrahi
select * from deptname where salary<=5000
Is This Answer Correct ? | 0 Yes | 3 No |
How to create new databases with "create database" statements?
is there more the two primary key in a single table?
26 Answers Eforce, Systematix,
Define left outer join?
what are the problems in logshipping?
What is a constant or literal in ms sql server?
What is difference between view and materialized view?
What is optimistic concurrency?
What are different types of statement?
Give a example to search fr a string in all stored procedure in sql server.
what is denormalization and when would you go for it? : Sql server database administration
Differnce between sel server 2000 and 2005
What is user-defined function? Explain its types i.e. Scalar and inline table value user-defined function?