Count values to show up with zeros instead of null I'm trying to make a query where I'll have the id and the number of employees that person is their superior, also people that aren't managers, should appear and have a count of zero.

This is what I did but those that aren't managers show up with a count of null:

create view scnt as (
    select E1.super, count(distinct E1.id) cnt
    from Employee E1 left outer join Employee E2
    on E1.super = E2.id
    group by E1.super
);

create view numSuper as (
    select E.id, S.cnt
    from Employee E left outer join scnt S
    on S.super = E.id or E.id = null
);

select * from numSuper


Here
That's the schema: 



but we can ignore all the noise and use just what we need: employee(id, super)

Here's a fiddle with the inserts: http://dbfiddle.uk/?rdbms=postgres_9.6&amp;fiddle=4c08869d0e8eba6c82fd4957092379a1

Any ideas on how to do this?
You need to join in the opposite way: managers LEFT JOIN employees

create view scnt as 
    select E2.id as super, 
           count(E1.id) as cnt
    from Employee E2                    -- managers
      left outer join Employee E1       -- employees
      on E1.super = E2.id
    group by E2.id
  ;

select * from scnt ;


dbfiddle