Group By Clause In Oracle. We have 14 rows in the employees table, but the query produces a single row. This example would first sort your results by department in descending order, then depart_head in ascending order.

It streams various shows that are watched by customers across the globe. Select expired, count (*) from (select (case when exp_date > sysdate then 1 when exp_date <= sysdate then 2 else 3 end) as expired from mytable) group by expired; The group by clause is often used with aggregate functions.