SQL question and query result
am 21.09.2007 07:14:07 von stevenleongusaI am new to this SQL. Can someone answer this question for me?
1. Given the following schema of an employees table:
*employees (*
* empid integer primary key, -- employee id number*
* dept string, -- the employee's department number*
* salary float, -- salary of the employee*
* mgrid integer -- employee id number of employee's
manager*
*)*
Write the query (or queries if necessary) needed to count the number
of employees in each employee's department who are paid more than
their manager.
All employees (including managers) appear in this table.
Each employee has a manager (except the CEO), and the mgrid in the
employee's row is the empid of the employee's manager.