SHOW:
|
|
- or go back to the newest paste.
1 | SELECT | |
2 | - | l.LAB_NAME, |
2 | + | d.DEP_NAME, sq.LAB_CNT |
3 | - | l.SALARY, |
3 | + | FROM DEPARTAMENT d, |
4 | - | d.DEP_NAME |
4 | + | |
5 | - | FROM |
5 | + | (SELECT |
6 | - | LABORING l, |
6 | + | d.DEP_ID, COUNT(*) AS LAB_CNT |
7 | - | DEPARTAMENT d, |
7 | + | FROM |
8 | - | (SELECT |
8 | + | |
9 | - | MAX(l.SALARY) AS SALARY_MAX |
9 | + | DEPARTAMENT d |
10 | - | FROM |
10 | + | WHERE l.DEP_ID = d.DEP_ID |
11 | GROUP BY d.DEP_ID | |
12 | - | DEPARTAMENT d |
12 | + | HAVING COUNT(*) <= 3) sq |
13 | - | WHERE l.DEP_ID = d.DEP_ID |
13 | + | |
14 | - | GROUP BY l.DEP_ID) sq |
14 | + | WHERE d.DEP_ID = sq.DEP_ID |