Un Join mas complejo
select c.nombre, c.apellido, a.numpropiedad, a.finicio, e.numempleado
from cliente c, arriendo a, propiedad p, empleado e
where c.numcliente=a.numcliente
and a.numpropiedad=p.numpropiedad
and p.numempleado=e.numpropiedad...
Teoria
DDL = Lenguaje de definicion de datos
DML= Lenguaje de manipulacion de datos
IN
select * from empleado where numoficina IN( Select numoficina from oficina where ciudad='Valdivia')
MAX
select max(salario) from empleado where sexo='M'
SEQUENCE
create sequence seqt1
start with 10 increment by 10;
select seqt1.nextval from dual;
insert into t1 values (seqt1.nextval, '6');
select * from t1
Promedio y round (avg, round)
select nombre, apellido, salario, round((select avg(salario) from empleado),1) as promedio, salario-round((select avg(salario) from empleado),1) as diferencia
from empleado
select numoficina, count (*), avg(salario), max(salario), min(salario)
from empleado
group by numoficina
select o.ciudad, o.numoficina, count (*), avg(salario), max(salario), min(salario)
from empleado e, oficina o
where e.numoficina=o.numoficina
group by o.ciudad, o.numoficina
order by o.ciudad
viernes, 16 de diciembre de 2011
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario