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
List out the different types of locks available in sql server?
What are the new scripting capabilities of ssms? : sql server management studio
how you can list all the tables in a database?
How to maintain a fill factor in existing indexes?
What happens if null values are involved in comparison operations?
What stored procedure can you use to display the current processes?
What are the new features introduced in SQL Server 2000? What changed between the previous version of SQL Server and the current version?
how we use window authentication connection with sql server.?
What is the maximum row of a size?
What does asynchronous call backs means?
How can we call UDF(User Define Function) using C# code in ASP.net ?
How do I start and stop sql server?
Why are you getting errors when creating a new odbc dsn?
Please differentiate between a local and a global temporary table?
What do you mean by recursive stored procedure?