You are on page 1of 2

SCL creaLe daLabase Crogram lllesllreblrdllreblrd_2_3bd_caolayafdb

CCn user sysdba password masLerkey



SCL connecL Crogram lllesllreblrdllreblrd_2_3bd_caolayafdb
CCn user sysdba password masLerkey

commlL

selecL * from cllenLes where cll_codlgo1 and cll_codlgo2 order by cll_nome


selecL cll_nome || cll_sexo from cllenLes
selecL cll_nome || || cll_sexo as nome e sexo from cllenLes


drop lndex lnd_nome_cllenLe on cllenLes

selecL cll_sexo as Sexo
counL(cll_sexo) as quanLos
from cllenLes group by cll_sexo

selecL uo sexo || cll_sexo || Lem counL(cll_sexo)
as LsLaLlsLlcas sexuals
from cllenLes group by cll_sexo

selecL cll_sexo as Sexo
sum(cll_salarlo) as soma
AvC(cll_salarlo) as medla
counL(cll_sexo) as quanLldade de pessoas"
from cllenLes
group by cll_sexo


C8LA1L Lable cldades
(
cld_codlgo lnLeger noL null
cld_nome varchar(30)
consLralnL cld_cod_pk prlmary key (cld_codlgo)
)


alLer Lable cllenLes add forelgn key (cll_codcld) references cldades (cld_codlgo)

updaLe cllenLes seL cll_codcld 2 where cll_codlgo 1


creaLe generaLor ge_cldades_ld

SL1 1L8M
C8LA1L 18lCCL8 18_CluAuLS lC8 CluAuLS
AC1lvL 8LlC8L lnSL81 CSl1lCn 0
AS
8LCln
newClu_CCulCC gen_ld(ge_cldades_ld 1)
Lnu


C8LA1L uCMAln uM_CPAvL AS ln1LCL8
nC1 nuLL

C8LA1L uCMAln uM_CPAvL AS ln1LCL8
CPLCk(vALuL 0) nC1 nuLL

You might also like