--GRUPO 1

--0 select codven from vendedores where nombres='ANACLETO RIVERA' --1 select * from productos where univen='B10' --2 select * from vendedores where codven like '6314%' --3 select * from vendedores where codven like '%40' --4 select * from vendedores where carnet like '38%' --5a select codalm, count(*) from maemov where tipdoc = 'S' group by codalm order by codalm --5b select desalm, count(*) from maemov, almacenes where maemov.codalm = almacenes.codalm and maemov.tipdoc = 'S' group by desalm order by desalm --5c select almacenes.codalm, desalm, count(*) from maemov, almacenes where maemov.codalm = almacenes.codalm and maemov.tipdoc = 'S' group by almacenes.codalm, desalm order by almacenes.codalm, desalm --6 select almacenes.codalm, desalm, maemov.tipdoc, count(*) from maemov, almacenes where maemov.codalm = almacenes.codalm and maemov.tipdoc in ('S','V') group by almacenes.codalm, desalm, maemov.tipdoc order by almacenes.codalm, desalm, maemov.tipdoc --7 select codalm, sum(cantidad) from maemov, detmov where maemov.nrodoc = detmov.nrodoc and maemov.tipdoc = 'S' group by codalm with rollup --8 --9a select tipdoc, count(*) from maemov group by tipdoc --9b select a.tipdoc,b.descripcion, count(*) from maemov a, tiposdoc b where a.tipdoc = b.tipdoc group by a.tipdoc, b.descripcion

--GRUPO 2

--0a select * from maemov where tipdoc='S' order by codcli --0b select b.nombres,a.* from maemov a, clientes b where a.codcli = b.codcli and a.tipdoc = 'S' order by b.nombres --1 select a.*, b.descripcion from productos a, unidades b where a.univen = b.univen --2 select distinct p.descripcion from maemov m, detmov d, productos p where m.nrodoc = d.nrodoc and d.codprod = p.codprod and m.codven = '65180' --3 select v.nombres, m.fecha, t.descripcion from maemov m, vendedores v, tiposdoc t where m.codven = v.codven and m.tipdoc = t.tipdoc and m.nrodoc = 2102 --4 select distinct v.nombres from vendedores v, maemov m where v.codven = m.codven and m.tipdoc = 'S' and m.fecha between '2010/04/27' and '2010/04/30' --5 select distinct v.nombres from vendedores v, maemov m where v.codven = m.codven and m.tipdoc = 'S' and m.fecha between '2010/06/01' and '2010/06/06' --6 select p.descripcion, d.cantidad, d.pu from detmov d, maemov m, productos p where d.nrodoc = m.nrodoc and d.codprod = p.codprod and m.tipdoc ='S' and d.nrodoc=380 --7 select a.desalm from maemov m, almacenes a where m.codalm = a.codalm and m.nrodoc = 1345 --8 select p.descripcion from productos p, unidades u where p.univen = u.univen and u.descripcion = 'PAQUETE DE 6 UNIDADES' --9 select distinct v.nombres from vendedores v, maemov m where v.codven = m.codven and m.tipdoc = 'S' and m.fecha = '2010/05/12'

--GRUPO 3

--0 select p.descripcion from detmov d, maemov m, clientes c, productos p where d.nrodoc = m.nrodoc and m.codcli = c.codcli and d.codprod = p.codprod and m.tipdoc = 'V' and c.nombres like '%BETHESDA%' --1 select distinct v.nombres, a.desalm from vendedores v, almacenes a, maemov m where m.codven = v.codven and m.codalm = a.codalm and m.fecha = '2010/05/27' --2 select distinct v.nombres, p.descripcion from vendedores v, productos p, maemov m, detmov d where m.codven = v.codven and m.nrodoc = d.nrodoc and d.codprod = p.codprod and m.fecha between '2010/05/27' and '2010/05/31' --3 select distinct p.descripcion from productos p, detmov d, maemov m, vendedores v where m.nrodoc = d.nrodoc and m.codven = v.codven and d.codprod = p.codprod and m.tipdoc = 'S' and v.nombres like '%CAMACHO%' --4 select p.descripcion, r.fechavig, r.pu from productos p, precios r where p.codprod = r.codprod order by p.descripcion, fechavig desc --Examen select * from precios where codprod='2390' and fechavig = ( select max(fechavig) from precios where codprod='2390' ) --5 select distinct t.descripcion, m.nrodoc from tiposdoc t, maemov m, detmov d where t.tipdoc = m.tipdoc and m.nrodoc = d.nrodoc and d.codprod = '2224' --6 select p.descripcion from productos p, detmov d, maemov m, clientes c where p.codprod = d.codprod and d.nrodoc = m.nrodoc and m.codcli = c.codcli and m.tipdoc = 'V' and c.nombres like '%BURGER KING%' --7a select m.* from maemov m, clientes c where m.codcli = c.codcli and m.tipdoc = 'S' and c.nombres like '%EMACRUZ%' --7b select m.* from maemov m, clientes c where m.codcli = c.codcli and m.tipdoc = 'S' and c.nombres in ( select nombres from clientes where nombres like '%EMACRUZ%' ) --8 select m.codalm, p.univen, sum(d.cantidad) from maemov m, productos p, detmov d where m.nrodoc = d.nrodoc and d.codprod = p.codprod group by m.codalm, p.univen order by m.codalm, p.univen --9 select c.nombres, sum(d.cantidad) as "cantidad", sum(d.cantidad*d.pu) as "Total Venta" from detmov d, maemov m, clientes c where d.nrodoc = m.nrodoc and m.codcli = c.codcli and c.nombres like '%HOTEL%' and m.tipdoc = 'S' group by c.nombres

--GRUPO 4

--0 select c.nombres from clientes c where c.codcli not in ( select codcli from maemov where month(fecha)=5 ) order by c.nombres --1 select month(d.fecha), sum(d.cantidad*d.pu) from detmov d, maemov m where d.nrodoc = m.nrodoc and m.tipdoc = 'S' group by month(d.fecha) order by month(d.fecha) --2 select m.codven, month(d.fecha), sum(d.cantidad*d.pu) from detmov d, maemov m where d.nrodoc = m.nrodoc and m.tipdoc = 'S' group by m.codven, month(d.fecha) order by m.codven, month(d.fecha) --3 select month(d.fecha),p.descripcion, sum(d.cantidad) as "Total Cantidad", sum(d.cantidad*d.pu) as "Total Vendido" from productos p, maemov m, detmov d where p.codprod = d.codprod and m.nrodoc = d.nrodoc and m.tipdoc = 'S' group by month(d.fecha),p.descripcion --4 select m.codalm, sum(d.cantidad), sum(d.cantidad*d.pu) from maemov m, detmov d where m.nrodoc = d.nrodoc and m.tipdoc = 'S' group by m.codalm order by m.codalm --5 select month(m.fecha), sum(d.cantidad), sum(d.cantidad*d.pu) from maemov m, detmov d where m.nrodoc = d.nrodoc and m.tipdoc = 'S' group by month(m.fecha) order by month(m.fecha) --6 select m.codalm, m.codven, m.tipdoc, count(*) from maemov m where m.tipdoc in ('S','V') group by m.codalm, m.codven, m.tipdoc order by m.codalm, m.codven, m.tipdoc --7 select p.descripcion from productos p where p.codprod not in ( select codprod from detmov where month(fecha)=5 ) --8 select v.nombres from vendedores v where v.codven not in ( select codven from maemov where month(fecha)=4 ) --9 select c.nombres from clientes c where c.codcli not in ( select codcli from maemov where month(fecha) in ( 4, 5, 6) )

--GRUPO 5

--0 select p.descripcion from productos p where p.codprod not in ( select codprod from precios ) --1 select * from maemov where tipdoc not in ( select tipdoc from tiposdoc ) --2 select distinct codcli from maemov where codcli not in ( select codcli from clientes ) --3 select distinct codprod from detmov where codprod not in ( select codprod from productos ) --4 select v.nombres from vendedores v where v.codven not in ( select codven from maemov where fecha between '2010/05/01' and '2010/05/05' ) --5 select p.descripcion from productos p where p.codprod not in ( select codprod from detmov where fecha between '2010/05/27' and '2010/05/31' ) --6a select m.codcli, sum(d.cantidad*d.pu) from maemov m, detmov d where m.nrodoc = d.nrodoc and m.tipdoc = 'S' group by m.codcli having sum(d.cantidad*d.pu) > 12000 order by sum(d.cantidad*d.pu) desc --6b select c.nombres, sum(d.cantidad*d.pu) from maemov m, detmov d, clientes c where m.nrodoc = d.nrodoc and m.codcli = c.codcli and m.tipdoc = 'S' group by c.nombres having sum(d.cantidad*d.pu) > 12000 order by sum(d.cantidad*d.pu) desc --7 select m.codcli, sum(d.cantidad*d.pu) from maemov m, detmov d where m.nrodoc = d.nrodoc and m.tipdoc = 'S' group by m.codcli having sum(d.cantidad*d.pu) < 100 order by sum(d.cantidad*d.pu) desc --8 select v.nombres, sum(d.cantidad*d.pu) from maemov m, detmov d, vendedores v where m.nrodoc = d.nrodoc and m.codven = v.codven and m.tipdoc = 'S' and m.fecha between '2010/05/03' and '2010/05/09' group by v.nombres having sum(d.cantidad*d.pu) > 25000 order by sum(d.cantidad*d.pu) desc --9 select m.codcli, sum(d.cantidad*d.pu) as "Total Despacho" from maemov m, detmov d where m.nrodoc = d.nrodoc and m.tipdoc = 'S' group by m.codcli order by sum(d.cantidad*d.pu) desc