SóProvas


ID
2768206
Banca
FAURGS
Órgão
TJ-RS
Ano
2018
Provas
Disciplina
Banco de Dados
Assuntos

Considere as tabelas EMPREGADOS, PROJETOS, e PARTICIPACOES definidas abaixo usando SQL (padrão SQL2 ou superior), que representam a participação de empregados em projetos de uma empresa.

create table EMPREGADOS
(code integer not null,
nomee varchar(60) not null,
pais char(2) not null,
gerente integer,
primary key(code),
foreign key (gerente) references EMPREGADOS);

create table PROJETOS
(codp integer not null,
nomep varchar(60) not null,
pais char(2) not null,
orcamento numeric(15,2) not null,
gerente integer not null,
primary key(codp),
foreign key(gerente) references EMPREGADOS);

create table PARTICIPACOES
(codp integer not null,
code integer not null,
horas integer not null,
funcao varchar(30) not null,
primary key(codp, code),
foreign key (code) references EMPREGADOS,
foreign key(codp) references PROJETOS);

Observe a consulta em SQL abaixo, no mesmo padrão.

SELECT *
FROM projetos natural join participacoes natural
join empregados
WHERE orcamento > 10000;

Quantos atributos têm a tabela resultado?

Alternativas
Comentários
  • Não entendi.

  • atributos da tabela resultado: nome dos empregados, nome dos projetos, código dos empregados, código dos projetos, pais, gerente, orçamento, horas e função.

    TOTAL = 9

    GABARITO A

  • "The SQL NATURAL JOIN is (...) structured in such a way that, columns with the same name of associated tables will appear once only."

    .

    13 atributos menos 4 FKs = 9

    ,

    https://www.w3resource.com/sql/joins/natural-join.php