Академический Документы
Профессиональный Документы
Культура Документы
EJERCICIO
Crear una tabla de ventas, que guarde informacin de los productos, fechas en que se venci
y la cantidad, de la siguiente manera:
VENTAS (cod_venta, fecha_venta, cod_vendedor, ci_cliente, cod_producto, valor, cantidad)
Luego hacer insercin de datos a la tabla y verificar por medio de select a cada tablespace si
de verdad se almacen la informacin correctamente.
Crear la tabla ventas, con las caractersticas solicitadas, usando el campo fecha_venta
para las particiones.
Con el siguiente cdigo:
create table VENTAS (
cod_ventas VARCHAR2(20) not null,
fecha_venta DATE not null,
cod_vendedor VARCHAR2(20) not null,
ci_cliente VARCHAR2(20) not null,
cod_producto VARCHAR2(20) not null,
valor NUMBER(5,2) not null,
cantidad NUMBER not null,
constraint PK_VENTAS primary key (cod_ventas)
)
PARTITION BY RANGE (fecha_venta)
INSERT INTO VENTAS VALUES ('1', TO_DATE('2017-01-01', 'YYYY-MM-DD'), '1', '1', '1',
'22', '3');
INSERT INTO VENTAS VALUES ('2', TO_DATE('2017-01-15', 'YYYY-MM-DD'), '2', '5', '6',
'45', '2');
INSERT INTO VENTAS VALUES ('3', TO_DATE('2017-02-08', 'YYYY-MM-DD'), '4', '10', '3',
'17', '6');
INSERT INTO VENTAS VALUES ('4', TO_DATE('2017-03-25', 'YYYY-MM-DD'), '6', '2', '8',
'31', '5');
Datos de la tabla: