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
Explain steps of normalization?
What do you mean by sql server agent?
What are the purposes and advantages stored procedure?
Explain the various types of concurrency problem. I.e. Lost or buried updates, uncommitted dependency, inconsistent analysis, phantom read?
Are all views updatable ?
what are defaults? Is there a column to which a default can't be bound? : Sql server database administration
How to modify existing triggers using "alter trigger"?
Can I save my report as html, excel or word? : sql server management studio
how do you determine the Load performance of any query in sql server {example how do u determine performance of a select stmnt which returns Dynamically many no of records ... some times 100,1000,10000 etc., }
What are the main differences between #temp tables and @table variables and which one is preferred?
List the types of recovery model available in sql server?
How to list all dsn entries on your local machine using odbc_data_source()?
How to use transact-sql statements to access the database engine?
What is enhanced database mirroring in sql server 2008?
What is merge statement?