CONSULTAS
----MOSTRAR el nombre comercial de TODOS LOS PRODUCTOS VENDIDOS POR EL
VENDEDOR DOLORES VOLCÁN POLAS
select NombreComercial
from Producto
join LineaVenta using(codProducto)
join Venta using(codVenta)
join Empleado using(dniEmpl)
where nombre='Dolores', prapellido='Volcán', sgapellido='Polas'
---MOSTRAR LOS CLIENTES DE SEVILLA QUE HAN SIDO ATENDIDOS POR
EMPLEADOS DE MADRID O BARCELONA
Select *
from Cliente
join Venta using(dniCli)
join Empleado using(dniEmpl)
where [Link]='Sevilla' and [Link] in ('Madrid', 'Barcelona');
-----MOSTRAR todos los contactos del proveedor cuyo gerente es Marco Hernandez
select *
from Contacto
join Proveedor using(codProv)
where gerente='Marcos Hernández';
--- MOSTRAR EL NOMBRE COMERCIAL DE LOS PRODUCTOS COMPRADOS AL
PROVEEDOR CUYO GERENTE ES ANTONIO
Select nombreComercial
from Producto
join lineacompra using(codProd)
join compra using(codCompra
join Proveedor using(codProv)
where gerente= 'Antonio Marea'
---MOSTRAR EL NOMBRE COMERCIAL DE LOS PRODUCTOS TIPO C O D,
COMPRADOS EL AÑO PASADO A PROVEEDORES CUYO GERENTE ES DAVID
BLANCO O MARCOS HERNANDEZ
select nombreComercial
from Producto
join lineacompra using(codProd)
join compra using(codCompra
join Proveedor using(codProv)
where gerente in ('Antonio Marea' or 'Marcos Hernandez') and Tipo in ('C' or 'D')
and fechahora to_char( fechaHora, 'YY')=To_char(sysdate,'YY')-1
---MOSTRAR LOS TELEFONOS DE LOS CONTACTOS QUE SON JEFE DE VENTA,
MOSTRANDO NOMBRE DEL PROVEEDOR, NOMBRE DEL CONTACTO Y EL
TELFONO
Select telefono, nombreProv, nombreCompleto,
from telefonocto
join Contacto using(codContacto)
join Provedor using(codProv)
where cargo='Jefe Ventas';
---MOSTRAR CUANTOS PRODUCTOS DE TIPO C SE HAN VENDIDO DURANTE EL
AÑO PASADO
select count(codProducto)
from Producto
where Tipo='C' and To_char( fechaHora, 'YY')=To_char(sysdate,'YY')-1
---Mostrar el codigo y la fecha de las ventas donde el empleado y el cliente viven en
diferentes ciudades
select codventa,fechahora
from Venta
join empleado using(codEmpl)
join Cliente using(codCl)
where [Link]<>[Link];
--- MOSTRAR EL CODIGO Y LA FECHA DE LAS VENTAS DE LOS PRODUCTOS
TIPO D O S DONDE EL EMPLEADO Y EL CLIENTE VIVEN EN la misma ciudad
Select codProducto, fechaHora
from Venta
join LineaVenta using(codVenta)
join empleado using(dniEmpl)
join cliente using(dniCl)
join Producto using(codProducto)
where tipo in ('D','S') and [Link]=[Link];