create table if not exists tabelaestudantes(
id_aluno INT PRIMARY KEY,
nome_aluno VARCHAR(250),
nascimento DATE,
Gênero_aluno VARCHAR(50),
endereço_aluno VARCHAR(250),
telefone_aluno Varchar(11),
email_aluno Varchar(300)
);
create table if not exists tabelaprofessor(
id_professor INT PRIMARY KEY,
nome_professor VARCHAR(250),
nascimento_prof DATE,
Gênero_professor VARCHAR(50),
telefone_professor Varchar(11),
email_professor Varchar(300)
);
create table if not exists tabelaDisciplinas(
id_disciplinas INT PRIMARY KEY,
nome_disciplina VARCHAR(250),
descricao TEXT,
carga_horaria VARCHAR(20),
id_professor INT,
FOREIGN key (id_professor) REFERENCES tabelaprofessor (id_professor)
);
create table if not exists tabelaturmas(
id_turmas INT PRIMARY KEY,
nome_turma VARCHAR(250),
ano_letivo DATE,
id_professor INT,
FOREIGN key (id_professor) REFERENCES tabelaprofessor (id_professor)
);
create table if not exists tabelaturmas_disciplinas(
ID_turmas Int,
id_disciplinas INT,
Primary key (id_turmas, id_disciplinas),
FOREIGN key (Id_turmas) REFERENCES tabelaturmas(id_turmas),
FOREIGN key (id_disciplinas) REFERENCES tabelaDisciplinas(id_disciplinas)
);
CREATE TABLE IF NOT EXISTS tabelanotas (
id_notas INT PRIMARY KEY,
Valor_nota VARCHAR(50),
id_aluno INT,
id_disciplinas INT,
FOREIGN key(id_aluno) REFERENCES tabelaestudantes(id_aluno),
FOREIGN key (id_disciplinas) REFERENCES tabelaDisciplinas (id_disciplinas)
);
select * from tabelaestudantes order by 'a';
SELECT * from tabelaDisciplinas where carga_horaria > 40;
SELECT * from tabelanotas where valor_nota > 6 and valor_nota < 8;