The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
145 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 (99.8k points) | 145 views

2 Answers

+1 vote
SELECT Dept-no, count(Employee-no) as total_employees
FROM EMP
WHERE Salary > 100000
GROUP BY Dept-no
answered by (39 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

37,975 questions
45,471 answers
131,382 comments
48,419 users