Fase03/Modulo02/Desafio04/src/app/models/Teacher.js
/*        
        SELECT teachers.*, count(students) AS total_students -> Seleciona tudo de teachers e conta quantos estudantes cada professor ensina e armazerna esse valor em total_students
        FROM teachers
        LEFT JOIN students ON (teachers.id = students.teacher_id)  -> Junta as colunas id de teachers e teacher_id de students
        GROUP BY teachers.id   -> Junta os total_studnts de acordo com o id dos professores
        ORDER BY total_students DESC -> Ordena de forma decrescente de quem ensina mais alunos para quem ensina menos
    */
SELECT teachers.*, count(students) AS total_students -> Seleciona tudo de teachers e conta quantos estudantes cada professor ensina e armazerna esse valor em total_students
FROM teachers
LEFT JOIN students ON (teachers.id = students.teacher_id)  -> Junta as colunas id de teachers e teacher_id de students
GROUP BY teachers.id   -> Junta os total_studnts de acordo com o id dos professores
ORDER BY total_students DESC -> Ordena de forma decrescente de quem ensina mais alunos para quem ensina menos
SELECT teachers . * count ( students ) AS total_students - > Seleciona tudo de teachers e conta quantos estudantes cada professor ensina e armazerna esse valor em total_students FROM teachers LEFT JOIN students ON ( teachers . id = students . teacher_id ) - > Junta as colunas id de teachers e teacher_id de students GROUP BY teachers . id - > Junta os total_studnts de acordo com o id dos professores ORDER BY total_students DESC - > Ordena de forma decrescente de quem ensina mais alunos para quem ensina menos
all(callback){
        db.query(`
        SELECT teachers.*, count(students) AS total_students 
        FROM teachers
        LEFT JOIN students ON (teachers.id = students.teacher_id)
        GROUP BY teachers.id 
        ORDER BY total_students DESC`, function(err, results){
            if(err) throw (`Database Error: ${err}`)
            callback(results.rows)
        })
    }
all ( callback ) { db . query ( ` ` , function ( err , results ) { if ( err ) throw ( ` ${ err } ` ) callback ( results . rows ) } ) }
SELECT teachers.
SELECT teachers .