Álgebra Relacional - Exercícios
Autor: Grupo SI 2009 (São luis) | Publicado: 2011-12-01T13:58:00-08:00

<!--[if gte mso 9]>        <![endif]--><!--[if gte mso 9]>     Normal   0         21         false   false   false      PT-BR   X-NONE   X-NONE                                                                                             <![endif]--><!--[if gte mso 9]>  <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
  LatentStyleCount="267">   <w:LsdException Locked="false" Priority="0" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Normal"/>   <w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>                                                         <w:LsdException Locked="false" Priority="10" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Title"/>      <w:LsdException Locked="false" Priority="11" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>   <w:LsdException Locked="false" Priority="22" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Strong"/>   <w:LsdException Locked="false" Priority="20" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>   <w:LsdException Locked="false" Priority="59" SemiHidden="false"
   UnhideWhenUsed="false" Name="Table Grid"/>      <w:LsdException Locked="false" Priority="1" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 1"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 1"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 1"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>      <w:LsdException Locked="false" Priority="34" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>   <w:LsdException Locked="false" Priority="29" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Quote"/>   <w:LsdException Locked="false" Priority="30" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 1"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 1"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 2"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 2"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 2"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 2"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 2"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 3"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 3"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 3"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 3"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 3"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 4"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 4"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 4"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 4"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 4"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 5"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 5"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 5"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 5"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 5"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>   <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 6"/>   <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 6"/>   <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 6"/>   <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>   <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>   <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>   <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>   <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>   <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>   <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>   <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 6"/>   <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>   <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 6"/>   <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>   <w:LsdException Locked="false" Priority="19" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>   <w:LsdException Locked="false" Priority="21" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>   <w:LsdException Locked="false" Priority="31" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>   <w:LsdException Locked="false" Priority="32" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>   <w:LsdException Locked="false" Priority="33" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>         <![endif]--><!--[if gte mso 10]> 
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:"Tabela normal";
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-priority:99;
 mso-style-parent:"";
 mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
 mso-para-margin-top:0cm;
 mso-para-margin-right:0cm;
 mso-para-margin-bottom:10.0pt;
 mso-para-margin-left:0cm;
 line-height:115%;
 mso-pagination:widow-orphan;
 font-size:11.0pt;
 font-family:"Calibri","sans-serif";
 mso-ascii-font-family:Calibri;
 mso-ascii-theme-font:minor-latin;
 mso-hansi-font-family:Calibri;
 mso-hansi-theme-font:minor-latin;
 mso-bidi-font-family:"Times New Roman";
 mso-bidi-theme-font:minor-bidi;
 mso-fareast-language:EN-US;}
 <![endif]-->    ð&nbsp; Seleção
1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o conteúdo da relação departamento.α (Departamento)
2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre os empregados que trabalham no departamento 4.α (NDEP=4)(EMPREGADO)
3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre a(s) localização(ões) do departamento de pesquisa (5).α (Dnumero=5)(Locais_depto)
      Dnumero      DLocalização  
      5      BELLAIRE  
      5      SUGARLAND  
      5      HOUSTON  

4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o(s) projetos(s) do departamento 4.α (NDEP=4)(PROJETO)
5)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre as informações de relação trabalha_em cujo número do projeto igual a 3.α (PNRO=3)(TRABALA_EM)
      NSEMP      PNRO      HORAS  
      666884444      3      40.0  
      333445555      3      10.0  



  ð&nbsp; Projeção
1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o número e o nome dos dependentes.π NSSEMP, NOMEDEPENDENTE(DEPENDENTE)
      NSSEMP      NOMEDEPENDENTE  
      333445555      Alice  
      333445555      Theodore  
      333445555      Joy  
      987654321      Abner  
      123456789      Michael  
      123456789      Alice  
      123456789      Elizabeth  

2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o nome e a localização dos projetos.π PNOME, PLOCALIZACAO(PROJETO)
      PNOME      PLOCALIZACAO  
      ProdutoX      Bellaire  
      ProdutoY      Sugarland  
      ProdutoZ      Houston  
      Automação      Stafford  
      Reorganização      Houston  
      Beneficiamento      Stafford  

3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o nome do departamento e o código do gerente dos departamentos.π DNOME, SNNGER(DEPARTAMENTO)
      DNOME      SNNGER  
      PESQUISA      333445555  
      ADMINISTRATIVO      987654321  
      GERENCIAL      888665555  
&nbsp; 4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o nome e a data de nascimento dos empregados.π PNOME, DATANASC(EMPREGADO)
      PNOME      DATANASC  
      JOHN      09-JAN-55  
      FRANKLIN      08-DEZ-45  
      ALICIA      19-JUL-58  
      JENNIFER      20-JUN-31  
      RAMESH      15-SET-52  
      JOYCE      31-JUL-62  
      AHMAD      29-MAR-59  
      JAMES      10-NOV-27  

5)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o nome e o salário dos empregados.π PNOME, SALARIO(EMPREGADO)
      PNOME      SALARIO  
      JOHN      3000  
      FRANKLIN      4000  
      ALICIA      2500  
      JENNIFER      4300  
      RAMESH      3800  
      JOYCE      2500  
      AHMAD      2500  
      JAMES      5500  



  ð&nbsp; Seleção+Projeção
1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o código, nome e o salário dos empregados que ganham mais de 2500.π NSS, PNOME, SALARIO (α (SALARIO &gt; 2500)(EMPREGADO))
      PNOME      SALARIO  
      JOHN      3000  
      FRANKLIN      4000  
      JENNIFER      4300  
      RAMESH      3800  
      JAMES      5500  

2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o nome e a localização dos projetos do departamento 5.π PNOME, PLOCALIZACAO(α (DNUM=5)(PROJETO))
      PNOME      PLOCALIZACAO  
      ProdutoX      Bellaire  
      ProdutoY      Sugarland  
      ProdutoZ      Houston  

3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o número do empregado e o número do projeto cujas horas são maiores que 10.Π NSSEmp, PNRO (α (Dnum = 5)(Projeto))
4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o nome e o sexo do dependente cujo número do empregado é igual a 123456789.π NOMEDEPENDENTE,SEXO(α (DSSEMP=123456789)(DEPENDENTE))
      PNOME      SEXO  
      MICHAEL      M  
      ALICE      F  
      ELIZABETH      F  

5)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o nome, relação e a data do aniversário dos dependentes cujo número do empregado é igual a 333445555. 
      NSSEMP      NOMEDEPENDENTE      SEXO      DATANIV      RELAÇÃO  
      333445555      Alice      F      05-ABR-76      FILHA  
      333445555      Theodore      M      25-OUT-73      FILHO
  
      333445555      Joy      F      03-MAI-48
      ESPOSA  
&nbsp;&nbsp;

  ð&nbsp; Junção
1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o nome e o salário do empregado e o nome e a relação dos seus dependentes.Π Pnome, Salario, Nomedependente, relação(Expregado X NSS = NSSEmp Dependente)Select Pnome, salário, nomdependente, relação, from empregado, dependente where nss=nssemp
2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o nome do departamento e o nome e o salário do empregado que é o seu gerente.&nbsp;Π DNOME where&nbsp; SNNGER = ‘33344555’,’987654321’,’88866555’
3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o nome do departamento e a sua localização.π D.DNOME, L.PLOCALIZACAO(DEPARTAMENTO D)X(D.DNUMERO=LDNUMERO LOCAIS_DEPTO L)Select dnume, dlocalizacao, from departamento d, locais_depto L where D.Dnumero = L.Dnumero

      DNOME      PLOCALIZACAO  
      PESQUISA      BELLAIRE  
      PESQUISA      SUGARLAND  
      PESQUISA      HOUSTON  
      ADMINISTRTIVO      STAFFORD  
      GERENCIAL      HOUSTON  

4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o nome do projeto, sua localização e o departamento ao qual pertence.π PNOME, P.LOCALIZACAO, DNOME(PROJETO X (DNUM=DNUMERO) DEPARTAMENTO)
      PNOME      PLOCALIZACAO      DNOM  
      PRODUTOX      BELLAIRE      PESQUISA  
      PRODUTOY      SUGARLAND      PESQUISA  
      PRODUTOZ      HOUSTON      PESQUISA  
      AUTOMACAO      STAFFORD      ADMINISTRATIVO  
      REORGANIZACAO      HOUSTON      GERENCIAL  
      BENEFICIAMENTO      STAFFORD      ADMINISTRATIVO  

5)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o nome do empregado e o nome do projeto nos quais eles trabalharam.Π E.Pnome, P.nome(Empregado E X E.nss=nssemp Trabalha_em)X Pnro = P.pnumero Projeto P)Select E.pnome, P.Pnome from empregado E, trabalha_em, Projeto P where E.Nss = trabalha_em.nssemp and trabalha_em.pnro = p.pnumero


  ð&nbsp; Agregação
1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre a quantidade de empregados do sexo masculino e a quantidade de empregados do sexo feminino.SEXO F COUNT,SEXO(NSS)(EMPREGO)
      SEXO      COUNT  
      M      5  
      F      3  

2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre a quantidade de dependentes do sexo masculino e a quantidade de dependentes do sexo feminino do empregado cujo número é 123456789.Sexo F count(nss) (EMPREGADO)Select sexo, count(nss) from EMPREGADO Group by Sexo
3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre o nome e o salário do empregado e a quantidade de dependentes que possui.PNOME, SALARIO F COUNT (NOMEDEPENDENTE)(EMPREGADO X (NSS=NSSEMP) DEPENDENTE)Select pnome, salário, count(NomeDependente) From empregado, dependente where nss=nssemp group by pnome, salario&nbsp; 
      PNOME      SALARIO      COUNT  
      JOHN      3000      3  
      FRANKLIN      4000      3  
      JENNIFER      4300      1  

4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre a despesa total de cada departamento com os salários dos empregados.DNOME F SUM (SALARIO )(DEPARTAMENTO X( DNUMERO = NDEP)EMPREGADO)NDEP F SUM (SALARIO) (EMPREGADO)
5)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mostre a soma total das horas empregadas em cada projeto.&nbsp;PNOME F SUM (HORAS)(PROJETOX(PNUMERO = PNRO)TRABALHA_EM)