Understanding COUNT() as `count`,
That is called a column alias. 

An alias is used to give columns a new name for the result set. This can be used to name a column based on an expressions (because otherwise the expression wouldn't "have" a name) or to rename columns, e.g. because the select list contains columns from different tables with the same name:

select t1.foo as t1_foo,
       t2.foo as t2_foo
from t1
   join t2 on ...


returns a result with the columns t1_foo and t2_foo

or 

select avg(salary) as avg_salary
from employees


Btw: using a reserved word as an object name (count) isn't such a good idea in the first place.