Advertisement
lll_lll

Lista 1 SQL

Oct 7th, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. /*
  2. Lista 1 SQL
  3. Questao 1*/
  4. select * from funcionario
  5. where nome like '%i%' and genero = 'm';
  6.  
  7. /* Questao 2*/
  8. select
  9. sum(valorUnd) as SomaProduto
  10. from
  11. produto;
  12.  
  13. /*Questao 3*/
  14. select cpf from funcionario
  15. where bairro like 's%' and year(datanasc) < 1980;
  16.  
  17. /*Questao 4*/
  18. select * from dependente
  19. where year(curdate())-year(datanasc) > 8 and genero is not null;
  20.  
  21. SELECT * from dependente
  22. where year(from_days(datediff(curdate(),datanasc)))>8 and genero is not null;
  23.  
  24. /*Questao 5*/
  25. select * from funcionario
  26. order by nome, bairro desc;
  27.  
  28. /*Questao 6*/
  29. SELECT * from funcionario
  30. where year(from_days(datediff(curdate(),datanasc)))>20 and salario>2000;
  31.  
  32. /*Questao 7*/
  33. select * from produto
  34. where nome like 't%a';
  35.  
  36. /*Questao 8*/
  37. select * from funcionario
  38. where year(datanasc)>=1960 and year(datanasc) <= 1990 and bairro <> 'Pituba' and tel is null;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement