[Solved] Find difference b/w avg salary of departments


MINUS is the set minus operator in Oracle and is called EXCEPT in SQL Server and doesn’t seem to exist in MySQL (at least I couldn’t find it). But you don’t seem to want a set minus but an arithmetic minus. Try

SELECT (SELECT avg(sal)
               FROM employee
               WHERE dept="SC")
       -
       (SELECT avg(sal)
               FROM employee
               WHERE dept="DP");

which should work both in MySQL and SQL Server. (Unless you completely tagged at random and are not even using one of these.)

0

solved Find difference b/w avg salary of departments