Consider the set of relations
Write an SQL query to:
Calculate, for each department number, the number of employees with a salary greater than Rs. 1,00,000
SELECT Dept-no, count(Employee-no) as total_employees FROM EMP WHERE Salary > 100000 GROUP BY Dept-no
i am getting something like this!
SELECT COUNT(EMPLOYEE-NO),DEPT-NO FROM EMP e,DEPT d WHERE e.dept-no=d.dept-no HAVING SALARY > 100000 GROUP BY (DEPT-NO);
pls check it once!
@Pranavpurkar
Having Clause can not come before Group By clause.
64.3k questions
77.9k answers
244k comments
80.0k users