sql oracle 中的计数函数不使用 group by

count function in sql oracle without using group by

如何在 sql oracle 中使用 count 函数而不使用 group by?

select count(*) as "Total orders",
       nvl(
         (select count (*)
          from   education
          where status='APPROVED'),
         0
       ) as "Number of approved requests"
from   education

使用条件聚合:

select COUNT(*) as "Total orders",
       COUNT(CASE status WHEN 'APPROVED' THEN 1 END)
         as "Number of approved requests"
from   education_expense