The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
172 views

Consider the set of relations

  • EMP (Employee-no. Dept-no, Employee-name, Salary)
  • DEPT (Dept-no. Dept-name, Location)

Write an SQL query to:

Calculate, for each department number, the number of employees with a salary greater than Rs. 1,00,000

asked in Databases by Veteran (102k points) | 172 views

2 Answers

+2 votes
SELECT Dept-no, count(Employee-no) as total_employees
FROM EMP
WHERE Salary > 100000
GROUP BY Dept-no
answered by (49 points)
0 votes
select Dept-no, count(Employee-no)

from EMP where Salary>100000 group by Dept-no
answered by Active (2.3k points)


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

40,731 questions
47,461 answers
145,500 comments
62,219 users