0% found this document useful (0 votes)
30 views

A A A A

This document creates tables and constraints for an employee training database. It creates tables for professionals, departments, trainings, training locations, schedules, and enrollments. It then adds primary key constraints to each table and foreign key constraints to link the tables together based on their relationships.

Uploaded by

Caio S Christino
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

A A A A

This document creates tables and constraints for an employee training database. It creates tables for professionals, departments, trainings, training locations, schedules, and enrollments. It then adds primary key constraints to each table and foreign key constraints to link the tables together based on their relationships.

Uploaded by

Caio S Christino
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

CRIAO DAS TABELAS: =================== create table PROFISSIONAL ( pro_codigo number(1), pro_nome varchar2(20) not null, pro_cpf varchar2(15)

not null, PRO_SET_CODIGO number(1) ); -- ENTIDADE FORTE create table SETOR ( set_codigo number(1), set_nome varchar2(20) not null, set_sigla varchar2(7) not null ); create table TREINAMENTO ( tre_codigo number(1), tre_nome varchar2(20) not null, tre_custo_aluno number (5)not null, tre_carga_horaria number (3)not null, TRE_SET_CODIGO number(1) ); -- ENTIDADE FORTE create table LOCAL_TREINAMENTO ( lot_codigo number(1), lot_latitude varchar2(13) not null, lot_longitude varchar2(13) not null, lot_altitude varchar2(6) not null ); create table AGENDA ( age_codigo number(1), age_inicio date not null, age_fim date not null, age_qtde_vagas number(4)not null, AGE_TRE_CODIGO number(1), AGE_LOT_CODIGO number(1) ); create table INSCRICAO ( INS_PRO_CODIGO number(1), INS_AGE_CODIGO number(1), ins_qualificado varchar2(5) not null, ins_realizado varchar2(5) not null ); CRIAO DAS CONSTRAINTS P.K.: =========================== alter table PROFISSIONAL add constraint pk_pro primary key(pro_codigo); alter table SETOR add constraint pk_set primary key(set_codigo); alter table TREINAMENTO add constraint pk_tre primary key(tre_codigo);

alter table LOCAL_TREINAMENTO add constraint pk_lot primary key(lot_codigo); alter table AGENDA add constraint pk_age primary key(age_codigo); CRIAO DAS CONSTRAINTS F.K.: ============================ alter table PROFISSIONAL add constraint fk_pro_set foreign key(pro_set_codigo) references SETOR(set_codigo) ; alter table INSCRICAO add constraint fk_ins_pro foreign key(ins_pro_codigo) references PROFISSIONAL(pro_codigo) ; alter table INSCRICAO add constraint fk_ins_age foreign key(ins_age_codigo) references AGENDA(age_codigo) ; alter table AGENDA add constraint fk_age_lot foreign key(age_lot_codigo) references LOCAL_TREINAMENTO(lot_codigo) ; alter table AGENDA add constraint fk_age_tre foreign key(age_tre_codigo) references TREINAMENTO(tre_codigo) ; alter table TREINAMENTO add constraint fk_tre_set foreign key(tre_set_codigo) references SETOR(set_codigo) ;

You might also like