So I know how to get the top 5 and bottom 5 to display by themselves. Problem is how do I combine both to display at the same time. This is what I have but it only shows the bottom 5.
SELECT SAL FROM
(
SELECT DISTINCT SAL FROM EMP WHERE SAL IS NOT NULL ORDER BY SAL DESC
)
WHERE ROWNUM <6 AND
SELECT SAL FROM
(
SELECT DISTINCT SAL FROM EMP WHERE SAL IS NOT NULL ORDER BY SAL ASC
)
WHERE ROWNUM <6;
Use
UNION
orUNION ALL
:You can also write this more succinctly as: