You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FROM
turmas_turma AS turma
INNER JOIN turmas_turma_matriculas AS matricula on turma.id = matricula.turma_id
INNER JOIN base_user on matricula.user_id = base_user.id
Query usada para filtrar alunos de uma turma:
FROM
turmas_turma AS turma
INNER JOIN turmas_turma_matriculas AS matricula on turma.id = matricula.turma_id
INNER JOIN base_user on matricula.user_id = base_user.id
WHERE turma.id= 2
Query usada para filtrar turmas de um aluno:
FROM
turmas_turma AS turma
INNER JOIN turmas_turma_matriculas AS matricula on turma.id = matricula.turma_id
INNER JOIN base_user on matricula.user_id = base_user.id
WHERE base_user.id = 1
The text was updated successfully, but these errors were encountered:
Nessa aula vamos conhecer a maneira mais simples de se criar um relacionamento de muitas para muitos no Django: com auxílio do campo ManyToManyField.
Campo ManyToManyField
Documentação do Django sobre relacionamento de Muitos para Muitos
Query usada para listar tordas matrículas:
SELECT
turma.id,
turma.nome,
matricula.*,
base_user.id,
base_user.email
FROM
turmas_turma AS turma
INNER JOIN turmas_turma_matriculas AS matricula on turma.id = matricula.turma_id
INNER JOIN base_user on matricula.user_id = base_user.id
Query usada para filtrar alunos de uma turma:
SELECT
turma.id,
turma.nome,
matricula.*,
base_user.id,
base_user.email
FROM
turmas_turma AS turma
INNER JOIN turmas_turma_matriculas AS matricula on turma.id = matricula.turma_id
INNER JOIN base_user on matricula.user_id = base_user.id
WHERE turma.id= 2
Query usada para filtrar turmas de um aluno:
SELECT
turma.id,
turma.nome,
matricula.*,
base_user.id,
base_user.email
FROM
turmas_turma AS turma
INNER JOIN turmas_turma_matriculas AS matricula on turma.id = matricula.turma_id
INNER JOIN base_user on matricula.user_id = base_user.id
WHERE base_user.id = 1
The text was updated successfully, but these errors were encountered: