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 / 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 |
Post New Answer View All Answers
What are commit and rollback in sql?
Does the unique constraint create an index?
Explain transaction isolation levels in sql server?
Do you know clustered and non-clustered index?
Does union all remove duplicates?
What are the security related catalog views? : sql server security
How does clustered and non clustered index work?
What new changes are being made in SQL Server?
How do you test your database? : sql server database administration
How to get a list of columns using the "sp_help" stored procedure in ms sql server?
How do I trace a query in sql server?
What is the difference between a "where" clause and a "having" clause?
Can you use order by when defining a view?
What is reference section?
Do you know what are the steps to process a single select statement?