

-- gb_5.sql  - predict # rows in gb_4.sql
-- derived from 7-9

set autotrace off echo off

with counts as (
  select /*+ gather_plan_statistics */ 
    count(distinct deptno) deptno_count
    , count(distinct ename) ename_count
    , count(distinct(ename||deptno)) full_count
  from scott.emp
)
select
  deptno_count
  , ename_count
  , full_count
  , ename_count + deptno_count + full_count + 1 total_count
from counts

l

/

