Skip to content

Instantly share code, notes, and snippets.

@joepreludian
Last active August 29, 2015 14:02
Show Gist options
  • Save joepreludian/ea37dc241747a971e37f to your computer and use it in GitHub Desktop.
Save joepreludian/ea37dc241747a971e37f to your computer and use it in GitHub Desktop.
Sql do aplicativo LUPANAR, desenvolvido em sala de aula para demonstracao da disciplina de banco de dados.
SELECT
t1.codprog,
t1.entradaprog,
t2.nomesuite,
coalesce((select
sum(t3.precoputa)
from
puta t3
where
t3.codputa in (
select
t4.puta_codputa
from
putaprograma t4
where
t4.programa_codprograma = t1.codprog)
), 0) as total_putas
from
programa t1, suite t2
where
t1.quarto_codquarto = t2.codsuite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment