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

Answer Posted / mahesh

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of lock supported by ?

780


Sql studio em braces a variety of capabilities, but will I need them all? Is there a simpler product ? : sql server management studio

681


When multiple after triggers are attached to sql table, how to control the order of execution?

733


How can you append an identity column to a temporary table?

621


What is implicit cursors?

746






What are trace files?

701


Do you know the different ddl commands in sql?

761


What are the mathematical functions supported by sql server 2005?

753


Can I delete event logs?

700


What is 1nf normalization form?

740


What is the maximum size of sql server database?

689


How do clustered indexes store data?

798


Explain about service Broker functions?

770


Explain powershell included in sql server 2008?

763


Why and when do stored procedure recompile?

705