For the sake of curiosity I got a story from my second half of ADS and this is a SQL script based on 3 tables: ALUNO
, CLASSE
, MATRICULA
.
I made the script according to the statement, but my script does not execute, the following error appears
ORA-00907: missing right parenthesis
Follow my script below:
Create Table Aluno(
Nr_Rgm number(8),
Nm_Nome varchar(40),
Nm_Mae varchar(40),
Dt_Nascimento date,
Id_sexo char(1),
CONSTRAINT Rgm_pk PRIMARY KEY (Nr_Rgm)
);
Create Table Classe(
Cd_Classe number(8),
Nr_AnoLetivo number(4),
Nr_Serie number(2),
Sg_Turma varchar(2),
Cd_Escola number(6),
Cd_Grau number(2),
Cd_Periodo number (2),
CONSTRAINT Classe_pk PRIMARY KEY (Cd_Classe)
);
Create Table Matricula(
Nr_Rgm number(8) ,
Dt_Matricula date,
Cd_Classe number(8),
CONSTRAINT fk_Rgm
FOREIGN KEY (Nr_Rgm)
REFERENCES Aluno(Nr_Rgm)
CONSTRAINT fk_Classe
FOREIGN KEY (Cd_Classe)
REFERENCES Aluno(Cd_Classe)
);
I'm using the link to test the script.