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
Answer / guest
select deptname from department where salary>=5000
| Is This Answer Correct ? | 7 Yes | 1 No |
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 |
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 |
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 |
Answer / chandra10shekhar
SELECT * FROM department WHERE salary>=5000
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / arbind panigrahi
select * from deptname where salary<=5000
| Is This Answer Correct ? | 0 Yes | 3 No |
explain different levels of normalization? : Sql server database administration
Does transparent data encryption provide encryption when transmitting data across the network?
What is multilevel indexing?
How to count duplicated values in a column in ms sql server?
what is normalization? : Sql server database administration
Explain full-text indexing?
How do you set a trace flag in sql server?
How to replace the Query Result 'Null Value' with a text ?
Tell me what is sql profiler?
what purpose does the model database serve? : Sql server database administration
What are indexes? When do you need to create Indexes?
4 Answers CarrizalSoft Technologies, HP,
What are the advantages dts has over bcp?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)