I created an employee table having attributes : deptno and salary in Oracle DBMS. I executed this query :
SELECT deptno, SUM(salary)
FROM emp
GROUP BY deptno
HAVING 1 > 2 ;
I thought that 1 and 2 are referring to the columns "deptno" and "SUM(salary)" in the SELECT statement. So I put a record where "deptno" > "SUM(salary)" in the table as follows:
deptno salary
1001 5000
1002 1000
The output is "No rows found" I was expecting the second row as output. Kindly explain the reason.