Documentos de Académico
Documentos de Profesional
Documentos de Cultura
datos.
Modelo Relacional
begin
insert into orden values ('OV450875','12-STK','CLP');
insert into orden values ('OV450876','24-STK','CLP');
insert into orden values ('OV450877','12-STK','CLP');
insert into orden values ('OV450878','24-STK','CLP');
insert into orden values ('OV450879','21-STK','CLP');
insert into orden values ('OV450880','12-STK','CLP');
insert into orden values ('OV450881','21-STK','CLP');
insert into orden values ('OV450882','11-STK','CLP');
insert into orden values ('OV450883','21-STK','CLP');
insert into orden values ('OV450884','23-STK','CLP');
insert into orden values ('OV450885','12-STK','CLP');
insert into orden values ('OV450886','24-STK','CLP');
insert into orden values ('OV450887','21-STK','CLP');
insert into orden values ('OV450888','21-STK','CLP');
insert into orden values ('OV450889','21-STK','CLP');
insert into orden values ('OV450890','12-STK','CLP');
insert into orden values ('OV450891','12-STK','CLP');
insert into orden values ('OV450892','12-STK','USD');
insert into orden values ('OV450893','12-STK','CLP');
insert into orden values ('OV450894','21-STK','CLP');
insert into orden values ('OV450895','21-STK','CLP');
insert into orden values ('OV450896','12-STK','USD');
insert into orden values ('OV450897','21-STK','CLP');
insert into orden values ('OV450898','12-STK','CLP');
insert into orden values ('OV450899','31-STK','CLP');
insert into orden values ('OV450900','31-STK','CLP');
insert into orden values ('OV450901','31-STK','CLP');
insert into orden values ('OV450902','31-STK','CLP');
insert into orden values ('OV450903','32-STK','CLP');
insert into orden values ('OV450904','31-STK','CLP');
insert into orden values ('OV450905','31-STK','CLP');
insert into orden values ('OV450906','31-STK','CLP');
insert into orden values ('OV450907','24-STK','CLP');
insert into orden values ('OV450908','24-STK','CLP');
insert into orden values ('OV450909','31-STK','CLP');
insert into orden values ('OV450910','31-STK','CLP');
insert into orden values ('OV450911','24-STK','CLP');
insert into orden values ('OV450912','31-STK','CLP');
insert into orden values ('OV450913','21-STK','CLP');
end;
select * from orden
Datos tabla producto
begin
insert into producto values (112983,'TECLE CADENA 0.5 TON X 3.0MTS CM 1
RAM',1,70000);
insert into producto values (118252,'CALEFACTOR 100W',2,24400);
insert into producto values (116529,'BARRA ROSCADA M10-1.5X100MM AISI
304',1,399);
insert into producto values (116531,'GOLILLA PLANA M8 INOXIDABLE AISI
304',2,19);
insert into producto values (116530,'BARRA ROSCADA M8-1.25X320MM AISI
304',1,717);
insert into producto values (116612,'TUERCA HEXAGONAL 5/16 AC INOXIDABLE
UNC AISI 316',2,55);
insert into producto values (107376,'PERNO HEXAGONAL M8X25 INOX. A2',4,78);
insert into producto values (117535,'PERNO HEXAGONAL 5/8X1-3/4 GALVANIZADO
A-325',4,355);
insert into producto values (115886,'PERNO HEXAGONAL 1/2X1 3/4 GALVANIZADO
A-325',1,178);
insert into producto values (123627,'PERNO HEXAGONAL 1/2X1 1/2 GALVANIZADO
A-325',2,238);
insert into producto values (115882,'TUERCA HEXAGONAL 1/2 GALVANIZADA A-563
GR. DH',3,120);
insert into producto values (123265,'GOLILLA PLANA 5/8 GALVANIZADA F-
436',4,70);
insert into producto values (123266,'TUERCA HEXAGONAL 5/8 GALVANIZADA A-563
GR. DH',1,210);
insert into producto values (109960,'FILTRO METALICO LAVABLE
24X24X1',2,25179);
insert into producto values (118132,'FILTRO METALICO LAVABLE
24X16X1',3,16786);
insert into producto values (117855,'GOLILLA PRESION M16 GALVANIZADA
P/PERNO',4,46);
insert into producto values (116284,'LUMINARIA INDUSTRIAL 23W LED ESTANCO
BS100 LED',2,48120);
insert into producto values (106720,'GOLILLA PRESION M6 ZINC. DIN127',4,6);
insert into producto values (122300,'INTERRUPTOR AUTOMATICO 2P 100A 250VDC
MAX 10KA',4,83646);
insert into producto values (122301,'INTERRUPTOR AUTOMATICO 2P 20A 250VDC
MAX 10KA',1,83646);
insert into producto values (118899,'PERNO PLASTICO M8X30',3,1200);
insert into producto values (113258,'PERNO HEXAGONAL 1/2X2-1/2
GALVANIZADO',4,385);
insert into producto values (119502,'GOLILLA PLANA REDONDA ELECTRO GALV
1/2',2,35);
insert into producto values (119995,'GRATA GRANEL 61-Z-60 CIRC. AL TRENZADO
HELA',4,11181);
insert into producto values (123815,'PLANCHA ALUMINIO
2.5X1100X3000MM',1,135000);
insert into producto values (106697,'TUERCA HEXAGONAL M8 ZINC. C8
DIN934',2,23);
insert into producto values (118184,'CHAPA TRIANGULO AJUSTABLE CROMADA
TABLERO',4,5007);
insert into producto values (108522,'TERMINAL DE COMPRESION PUNTA 6MM
VERDE',3,8);
insert into producto values (111094,'CLAVO 2-1/2',1,1765);
insert into producto values (111095,'CLAVO 3',2,1471);
insert into producto values (126224,'PERNO HEXAGONAL 7/8x 5 GALVANIZADO A-
325',3,1950);
insert into producto values (121285,'FUSIBLE RAPIDO NH00 CURVA GL/GG 80A
690V',1,2049);
insert into producto values (122911,'SENSOR DE CAMPO MAGNETICO PUERTA
40FY36-020',2,110880);
insert into producto values (122912,'ACCIONAMIENTO MAGNETICO SENSOR DE
PUERTA 41FY1',1,39060);
insert into producto values (115862,'DETECTOR DE HUMO Y TEMPERATURA CON
BASE FSP-951T',2,73285);
insert into producto values (121152,'SHUNT60MV 100A',3,29738);
insert into producto values (119308,'FUSIBLE CILINDRICO 20A 1000VDC 20KA
10X38MM',4,1475);
insert into producto values (123925,'SISTEMA DE BLOQUEO POR CANDADO
PLK3',1,4554);
insert into producto values (115021,'SISTEMA DE BLOQUEO POR
CANDADO',2,14824);
end;
select * from producto
Datos tabla atiende
begin
insert into atiende values (1253,'86542100-1','OV450875','01-07-2022');
insert into atiende values (1664,'96963440-6','OV450876','01-07-2022');
insert into atiende values (1834,'79587210-8','OV450877','01-07-2022');
insert into atiende values (1967,'76833300-9','OV450878','01-07-2022');
insert into atiende values (1254,'77032259-6','OV450879','01-07-2022');
insert into atiende values (1736,'92307000-1','OV450880','01-07-2022');
insert into atiende values (1253,'76485762-3','OV450881','01-07-2022');
insert into atiende values (1664,'78396050-8','OV450882','01-07-2022');
insert into atiende values (1834,'76727040-2','OV450883','01-07-2022');
insert into atiende values (1967,'96510970-6','OV450884','01-07-2022');
insert into atiende values (1254,'76781356-2','OV450885','01-07-2022');
insert into atiende values (1736,'76062037-8','OV450886','01-07-2022');
insert into atiende values (1834,'76018148-K','OV450887','04-07-2022');
insert into atiende values (1967,'76646865-9','OV450888','04-07-2022');
insert into atiende values (1253,'86542100-1','OV450889','04-07-2022');
insert into atiende values (1664,'96963440-6','OV450890','04-07-2022');
insert into atiende values (1834,'79587210-8','OV450891','04-07-2022');
insert into atiende values (1967,'76833300-9','OV450892','04-07-2022');
insert into atiende values (1254,'77032259-6','OV450893','04-07-2022');
insert into atiende values (1736,'92307000-1','OV450894','04-07-2022');
insert into atiende values (1253,'76485762-3','OV450895','04-07-2022');
insert into atiende values (1664,'78396050-8','OV450896','04-07-2022');
insert into atiende values (1834,'76727040-2','OV450897','04-07-2022');
insert into atiende values (1967,'96510970-6','OV450898','04-07-2022');
insert into atiende values (1736,'76062037-8','OV450900','04-07-2022');
insert into atiende values (1834,'76018148-K','OV450901','04-07-2022');
insert into atiende values (1967,'76646865-9','OV450902','05-07-2022');
insert into atiende values (1253,'86542100-1','OV450903','05-07-2022');
insert into atiende values (1664,'96963440-6','OV450904','05-07-2022');
insert into atiende values (1834,'79587210-8','OV450905','05-07-2022');
insert into atiende values (1967,'76833300-9','OV450906','05-07-2022');
insert into atiende values (1254,'77032259-6','OV450907','05-07-2022');
insert into atiende values (1736,'92307000-1','OV450908','05-07-2022');
insert into atiende values (1253,'76485762-3','OV450909','05-07-2022');
insert into atiende values (1664,'78396050-8','OV450910','05-07-2022');
insert into atiende values (1834,'76727040-2','OV450911','05-07-2022');
insert into atiende values (1967,'96510970-6','OV450912','05-07-2022');
insert into atiende values (1254,'76781356-2','OV450913','05-07-2022');
end;
begin
insert into incluye values ('OV450875',112983);
insert into incluye values ('OV450876',118252);
insert into incluye values ('OV450877',116529);
insert into incluye values ('OV450878',116531);
insert into incluye values ('OV450879',116530);
insert into incluye values ('OV450880',116612);
insert into incluye values ('OV450881',107376);
insert into incluye values ('OV450882',117535);
insert into incluye values ('OV450883',115886);
insert into incluye values ('OV450884',123627);
insert into incluye values ('OV450885',115882);
insert into incluye values ('OV450886',123265);
insert into incluye values ('OV450887',123266);
insert into incluye values ('OV450888',109960);
insert into incluye values ('OV450889',118132);
insert into incluye values ('OV450890',117855);
insert into incluye values ('OV450891',116284);
insert into incluye values ('OV450892',106720);
insert into incluye values ('OV450893',122300);
insert into incluye values ('OV450894',122301);
insert into incluye values ('OV450895',118899);
insert into incluye values ('OV450896',113258);
insert into incluye values ('OV450897',119502);
insert into incluye values ('OV450898',119995);
insert into incluye values ('OV450899',123815);
insert into incluye values ('OV450900',106697);
insert into incluye values ('OV450901',118184);
insert into incluye values ('OV450902',108522);
insert into incluye values ('OV450903',111094);
insert into incluye values ('OV450904',111095);
insert into incluye values ('OV450905',126224);
insert into incluye values ('OV450906',121285);
insert into incluye values ('OV450907',122911);
insert into incluye values ('OV450908',122912);
insert into incluye values ('OV450909',115862);
insert into incluye values ('OV450910',121152);
insert into incluye values ('OV450911',119308);
insert into incluye values ('OV450912',123925);
insert into incluye values ('OV450913',115021);
insert into incluye values ('OV450875',112983);
insert into incluye values ('OV450876',118252);
insert into incluye values ('OV450877',116529);
insert into incluye values ('OV450878',116531);
insert into incluye values ('OV450879',116530);
insert into incluye values ('OV450880',116612);
insert into incluye values ('OV450881',107376);
insert into incluye values ('OV450882',117535);
insert into incluye values ('OV450883',115886);
insert into incluye values ('OV450884',123627);
insert into incluye values ('OV450885',115882);
insert into incluye values ('OV450886',123265);
insert into incluye values ('OV450887',123266);
insert into incluye values ('OV450888',109960);
insert into incluye values ('OV450889',118132);
insert into incluye values ('OV450890',117855);
insert into incluye values ('OV450891',116284);
insert into incluye values ('OV450892',106720);
insert into incluye values ('OV450893',122300);
insert into incluye values ('OV450894',122301);
insert into incluye values ('OV450895',118899);
insert into incluye values ('OV450896',113258);
insert into incluye values ('OV450897',119502);
insert into incluye values ('OV450898',119995);
insert into incluye values ('OV450899',123815);
insert into incluye values ('OV450900',106697);
insert into incluye values ('OV450901',118184);
insert into incluye values ('OV450902',108522);
insert into incluye values ('OV450903',111094);
insert into incluye values ('OV450904',111095);
insert into incluye values ('OV450905',126224);
insert into incluye values ('OV450906',121285);
insert into incluye values ('OV450907',122911);
insert into incluye values ('OV450908',122912);
insert into incluye values ('OV450909',115862);
insert into incluye values ('OV450910',121152);
insert into incluye values ('OV450911',119308);
insert into incluye values ('OV450912',123925);
insert into incluye values ('OV450913',115021);
end;
select * from incluye
Preguntas SQL
SELECT C.NOMBRE
FROM CLIENTE C
WHERE C.NOMBRE LIKE '%S.A.%'
GROUP BY C.NOMBRE
SELECT NOMBRE
FROM VENDEDOR
ORDER BY NOMBRE
8.- Obtener venta total de Alejandra Toledo
SELECT *
FROM PRODUCTO P
WHERE P.CODIGO BETWEEN 115862 AND 123265
15.- Obtener listado de códigos desde 115862 al 123265 con su total de ventas
SELECT C.NOMBRE
FROM CLIENTE C
WHERE C.DIRECCION LIKE '%conchali%'
GROUP BY C.NOMBRE
SELECT P.DESCRIPCION
FROM VENDEDOR V, ATIENDE A, CLIENTE C, ORDEN O, INCLUYE I, PRODUCTO P
WHERE A.USUARIO = V.USUARIO
AND A.RUT = C.RUT
AND A.NUMERO = O.NUMERO
AND I.NUM_ORD = O.NUMERO
AND I.COD_PRO = P.CODIGO
AND C.NOMBRE = 'COMPANIA MINERA ZALDIVAR SPA'
AND V.USUARIO = 1253
GROUP BY P.DESCRIPCION
SELECT C.NOMBRE
FROM ORDEN O, CLIENTE C, ATIENDE A
WHERE C.RUT = A.RUT
AND O.NUMERO = A.NUMERO
AND O.MONEDA = 'USD'
GROUP BY C.NOMBRE
22.- Listar código de productos vendidos por Danilo Marquez entre el 05-07-
2022
26.- Mostrar nómina de códigos que cuentan precio unitario mayor a 83646
pesos.
SELECT V.NOMBRE
FROM VENDEDOR V, ATIENDE A, ORDEN O, INCLUYE I, PRODUCTO P
WHERE A.USUARIO = V.USUARIO
AND A.NUMERO = O.NUMERO
AND I.NUM_ORD = O.NUMERO
AND I.COD_PRO = P.CODIGO
AND P.DESCRIPCION = 'INTERRUPTOR AUTOMATICO 2P 100A 250VDC MAX
10KA'
GROUP BY V.NOMBRE
28.- Mostrar las ordenes de venta realizadas en almacén 31-STK que terminen
en 0
SELECT O.NUMERO
FROM ORDEN O
WHERE O.ALMACEN = '31-STK'
AND O.NUMERO LIKE '%0'