cic N N cic Empregado Passageiro ISA ISA Res Piloto Técnico hab pilota End cic End Sal Tel DN Empregado Passageiro Escalado ISA ISA Res Classe Preço Es Piloto Técnico hab Id pilota DVoo B HV Data conduz M Fb NL C Cd utiliza É-Um Avião Aeronave É-Um Ns Hv DF Nv usa Voo Qt hp hc orig Des Peça Np Pr
Tabelas referentes às entidades CREATE TABLE PASSAGEIRO (CIC Integer, N: char(30), End: char(30), Tel:Integer, Primary Key (CIC)) CREATE TABLE PEÇA (Np Integer, Pr :Integer, Primary Key (Np)) CREATE TABLE VOO (Nv Integer, hp: Time, hc: Time, orig: char(20), Des: char(20), Primary Key (Nv)) CREATE TABLE AVIÃO (Cd Integer, M: char(30), NL: Integer, C: Integer, Fb: Char(30), Primary Key (Cd)) CREATE TABLE EMPREGADO (CIC Integer, N: char(30), DN: Date, End: char(30), Sal:Integer, Primary Key (CIC))
Tabelas referentes às entidades que são chaves de relacionamentos CREATE TABLE DVOO (Id: Integer, Data: Date, Nv: Integer, Ns: Integer, B: Integer, PRIMARY KEY (Id), FOREIGN KEY (Nv) REFERENCES VOO, FOREIGN KEY (B) REFERENCES PILOTO, FOREIGN KEY (Ns) REFERENCES AERONAVE) CREATE TABLE AERONAVE (Ns: Integer, Hv: Integer, DF: Date, Cd: Integer, PRIMARY KEY (Ns), FOREIGN KEY (Cd) REFERENCES AVIÃO)
Tabelas referentes às entidades especializadas que fazem parte de relacionamento ISA CREATE TABLE PILOTO (CIC: Integer, B :Integer, HV: Integer, PRIMARY KEY (CIC), UNIQUE (B), FOREIGN KEY (CIC) REFERENCES EMPREGADO) CREATE TABLE TECNICO (CIC: Integer, Es: char(20), PRIMARY KEY (CIC), FOREIGN KEY (CIC) REFERENCES EMPREGADO)
Tabelas referentes aos relacionamentos n para n CREATE TABLE Res (CIC: Integer, Id :Integer, Classe: char(10), Preço: Integer, PRIMARY KEY (CIC,Id), FOREIGN KEY (CIC) REFERENCES Passageiro, FOREIGN KEY (Id) REFERENCES DVOO) CREATE TABLE Escalado (CIC: Integer, Id :Integer, Classe: char(10), Preço: Integer, PRIMARY KEY (CIC,Id), FOREIGN KEY (CIC) REFERENCES Passageiro, FOREIGN KEY (Id) REFERENCES DVOO)
Tabelas referentes aos relacionamentos n para n CREATE TABLE USA (Np:Integer, Cd:Integer, Qt: Integer, PRIMARY KEY (Np,Cd), FOREIGN KEY (Np) REFERENCES PEÇA, FOREIGN KEY (Cd) REFERENCES AVIAO) CREATE TABLE PILOTA (CIC:Integer, Cd:Integer, PRIMARY KEY (CIC,Cd), FOREIGN KEY (CIC) REFERENCES PILOTO, FOREIGN KEY (Cd) REFERENCES AVIAO) CREATE TABLE HAB (CIC:Integer, Cd:Integer, PRIMARY KEY (CIC,Cd), FOREIGN KEY (CIC) REFERENCES TECNICO, FOREIGN KEY (Cd) REFERENCES AVIAO)