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

2 Answers

0 votes
select Dept-no, count(Employee-no)

from EMP where Salary>100000 group by Dept-no
answered by Junior (631 points)
0 votes
SELECT Dept-no, count(Employee-no) as total_employees
FROM EMP
WHERE Salary > 100000
GROUP BY Dept-no

 

answered by (17 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

33,687 questions
40,230 answers
114,266 comments
38,783 users