I have the STUDENTS table and the TEACHERS table, there are more teachers than students, I wanted to conduct a query that brings students in one column and teachers in another and not all in one.
All in one column looks like this:
SELECT PK_PROFESSORES AS CÓDIGO_ALUNO_PROFESSOR, NOME, IF(PK_PROFESSORES != NULL, 'ALUNO', 'PROFESSOR') AS VÍNCULO
FROM PROFESSORES
UNION
SELECT PK_ALUNO, NOME, IF(PK_ALUNO != NULL, 'PROFESSOR', 'ALUNO') AS VÍNCULO
FROM ALUNOS
Is it possible to bring each one into a column?