Advertisement
Guest User

Untitled

a guest
Dec 11th, 2017
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. create view votatoTrumpUltimeElezioni as (
  2.     select v.persona
  3.     from Voto v
  4.     where annoElezione = 2016 and nomeCanditato = "Trump"
  5. );
  6.  
  7. create view votatoRepubblicano as (
  8.     select v.persona
  9.     from Voto v, Candidato c
  10.     where v.nomeCanditato = c.nomeCanditato and c.partitoCandidato = "Repubblicano" and v.annoElezione < 2016
  11. );
  12.  
  13. select avg(Today() - p.dataNascita), avg(p.reddito)
  14. from Persona p
  15. where p.cod in (select * from votatoTrumpUltimeElezioni)
  16.     and not in (select * from votatoRepubblicano)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement