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
How do I edit a procedure in sql server?
How to provide default values to function parameters?
What types of replication are supported in sql server?
What are the limitations/drawbacks or ssrs 2008 r2?
How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?
what is the Ticketing tool used in Wipro technologies at Bangalore...???
Are semicolons required at the end of sql statements in sql server 2005?
How to create an inline table-valued function?
How you can get a list of all the table constraints in a database? : Sql server administration
What are binary string data types in ms sql server?
What is data source in connection string?
How adventureworkslt tables are related?
What are sub reports?
Scalability, Availability, Integration with internet, etc.)?
What is sqlcmd?