Jump to content
Alberto Ferreira da Camara

Questao de banco de dados sql

Recommended Posts

Boa tarde.

Select sum (valor)

from

(Select valor from a 

union all

select 8 from b) as tabela 

group by valor 

having avg (valor) >4 

 

tabela a           tabela b

valor                 valor

0                         5

4                          5

8

 

poderia me explicar como chegar no resultado 24, preciso de explicação de cada linha.

Share this post


Link to post
Share on other sites

dicas , um literal será lido repetidas vezes

 

union all trás duplicados 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.