CREATE Table gafanhoto_assiste_curso (
id int not null AUTO_INCREMENT,
data date,
idgafanhoto int,
idcurso int,
PRIMARY key (id),
Foreign Key (idgafanhoto) REFERENCES gafanhotos(id),
Foreign Key (idcurso) REFERENCES cursos(idcurso)
) DEFAULT CHARSET = utf8;
select * from gafanhotos g
join gafanhoto_assiste_curso a
on g.id = a.idgafanhoto
join cursos c
on a.idcurso = c.idcurso;