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

Answers were Sorted based on User's Feedback



i need to know how i display department which has salary > =5000 for the below table Departmen..

Answer / guest

select deptname from department where salary>=5000

Is This Answer Correct ?    7 Yes 1 No

i need to know how i display department which has salary > =5000 for the below table Departmen..

Answer / vinothmca21

use this,


select dept from employee group by dept having sum(salary)>=
5000

regards,
Vinoth

Is This Answer Correct ?    4 Yes 3 No

i need to know how i display department which has salary > =5000 for the below table Departmen..

Answer / mahesh

Hi dear,
1) If you have need name of total salary of each department to spend on employee(Understand like this) then use query:
select deptname, SUM(salary)
from Department
GROUP BY deptname
HAVING SUM(salary) >= 5000;

2) Otherwise

SELECT deptname
FROM Department
WHERE salary >= 5000;

Is This Answer Correct ?    1 Yes 1 No

i need to know how i display department which has salary > =5000 for the below table Departmen..

Answer / 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

i need to know how i display department which has salary > =5000 for the below table Departmen..

Answer / chandra10shekhar

SELECT * FROM department WHERE salary>=5000

Is This Answer Correct ?    0 Yes 1 No

i need to know how i display department which has salary > =5000 for the below table Departmen..

Answer / arbind panigrahi

select * from deptname where salary<=5000

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More SQL Server Interview Questions

what is the difference between Delete and Truncate command in SQL

0 Answers   BirlaSoft,


How do I port a number to sql server?

0 Answers  


What is @@Identity in sql?

1 Answers   Cap Gemini,


What are the different types of columns types constraints in the sql server?

0 Answers  


How to create a stored procedure with a statement block in ms sql server?

0 Answers  






What are different types of subquery?

0 Answers  


How can you fetch alternate records from a table?

0 Answers  


Benefits of Stored Procedures?

0 Answers   Wipro,


What is log shipping? Can we do logshipping with SQL Server 7.0 - Logshipping is a new feature of SQL Server 2000. We should have two SQL Server - Enterprise Editions. From Enterprise Manager we can configure the logshipping. In logshipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db and we can use this as the DR (disaster recovery) plan.

0 Answers  


what is database replicaion? What are the different types of replication you can set up in sql server? : Sql server database administration

0 Answers  


How column data types are determined in a view?

0 Answers  


What are logical database components? : SQL Server Architecture

0 Answers  


Categories