I am new to MySQL and databases, and I have seen in many places that it is not considered good programming practice to use subqueries in the FROM SELECT field in MySQL, for example:
select userid, avg(num_pages) from (select userid , pageid , regid , count(regid) as num_pages from reg_pag where ativa = 1 group by userid, pageid) as from_query group by userid;
which calculates the average number of registers on a page that users have.
The reg_page table looks like this: 
Questions:
source share