adspace
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
do you know how to configure db2 side of the application? : Sql server database administration
what is spatial nonclustered index
How do I start sql server 2017?
When should you use an instead of trigger?
How can I check that whether automatic statistic update is enabled or not?
What is temporary table in sql server? Why we use temp table?
Is there any performance difference between if exists (select null from table) and if exists (select 1 from table)?
Why use identity in sql server?
What is the difference between upgrade and migration in sql server?
What is the difference between for xml raw and for xml auto?
How to remove duplicate rows from table except one?
What are the pros and cons of putting a scalar function in a queries select list or in the where clause?
Is it possible to have clustered index on separate drive from original table location?
What are different types of constraints?
How do I create a trace in sql server?