Trabalho de bd
);
create table CONTATO ( cpf integer, valor text, id_tipo integer
);
create table TIPO (id_tipo integer, descricao text
);
alter table PESSOA add constraint PK_PESSOA primary key (cpf);
alter table TIPO add constraint PK_TIPO primary key (id_tipo);
alter table CONTATO add constraint FK_id_tipo foreign key (id_tipo) references TIPO (id_tipo);
alter table CONTATO add constraint FK_cpf foreign key (cpf) references PESSOA (cpf);
insert into CONTATO values
('1111','EMAIL@DOMINIO','1');
insert into CONTATO values
('2222','9999999','2');
insert into CONTATO values
('3333','333300300','3');
insert into CONTATO values
('4444','EMAIL@DOMINIO','1');
insert into CONTATO values
('5555','EMAIL@DOMINIO','1');
insert into CONTATO values
('6666','9999@999','2');
insert into TIPO values
('1', 'email');
insert into TIPO values
('2', 'cel');
insert into TIPO values
('3', 'tel res');
insert into TIPO values
('4', 'tel com');
insert into TIPO values
('5', 'IM');
insert into PESSOA values
('Joao','1111','analista');
insert into PESSOA values
('Maria','2222','medico');
insert into PESSOA values
('Pedro','3333','engenheiro');
insert into PESSOA values
('Daniel','4444','professor');
insert into PESSOA values
('Juquinha','5555','professor');
insert into PESSOA values
('Jose','6666','politico');
select PESSOA.cpf,PESSOA.nome,CONTATO.id_tipo,TIPO.descricao from PESSOA, CONTATO, TIPO WHERE cpf=cpf and id_tipo=id_tipo
_________________________________________________________________________ create table PESSOA ( nome text, cpf integer, profissao text
);
create table CONTATO ( cpf integer, valor text, id_tipo integer
);
create table TIPO (id_tipo integer, descricao text
);
alter table PESSOA add constraint PK_PESSOA primary key (cpf);
alter table TIPO add constraint