This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- CREATE | |
CREATE TABLE tb_regiao( | |
id SERIAL PRIMARY KEY, | |
nome VARCHAR(20) NOT NULL, | |
localidade_s FLOAT NOT NULL, | |
localidade_w FLOAT NOT NULL, | |
descricao VARCHAR(20) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Questão 1 | |
SELECT nome AS curso, numero AS turma, inicio | |
FROM tb_curso | |
INNER JOIN tb_turma ON tb_curso.id = tb_turma.curso_id | |
--Questão 2 | |
SELECT tb_curso.nome AS curso, numero AS turma, tb_aluno.nome AS aluno, cpf | |
FROM tb_curso | |
INNER JOIN tb_turma ON tb_curso.id = tb_turma.curso_id | |
INNER JOIN tb_matricula ON tb_turma.id = tb_matricula.turma_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Questão 1 | |
SELECT nome AS curso, numero AS turma, inicio | |
FROM tb_curso | |
INNER JOIN tb_turma ON tb_curso.id = tb_turma.curso_id | |
--Questão 2 | |
SELECT tb_curso.nome AS curso, numero AS turma, tb_aluno.nome AS aluno, cpf | |
FROM tb_curso | |
INNER JOIN tb_turma ON tb_curso.id = tb_turma.curso_id | |
INNER JOIN tb_matricula ON tb_turma.id = tb_matricula.turma_id |