(id_venta INTEGER not null, no_factura VARCHAR(6) not null, id_cliente INTEGER not null, id_libro INTEGER not null, precio INTEGER, fecha_venta VARCHAR(10) not null, CONSTRAINT ventas_pk primary key(id_venta), CONSTRAINT venta_cliente_fk FOREIGN KEY (id_cliente) REFERENCES cliente (id_cliente), CONSTRAINT venta_libro_fk FOREIGN KEY (id_libro) REFERENCES libro (id_libro));
6.Creando Tabla: compras.
create table compras
(id_compra INTEGER not null, no_factura VARCHAR(6) not null, id_editorial INTEGER not null, detalle VARCHAR(50) not null, precio INTEGER, fecha_compra VARCHAR(10) not null, CONSTRAINT compras_pk primary key(id_compra), CONSTRAINT compra_editorial_fk FOREIGN KEY (id_editorial) REFERENCES editorial (id_editorial)); CARGANDO VALORES EN LAS TABLAS
insert INTO ASUNTO VALUES(1, 'Narrativa');
insert INTO ASUNTO VALUES(2, 'Fantasía Epopeya'); insert INTO ASUNTO VALUES(3, 'Libro Autoayuda'); insert INTO ASUNTO VALUES(4, 'Drama'); insert INTO ASUNTO VALUES(5, 'Novela Policiaca'); insert INTO AUTOR VALUES(1, 'Gabriel Garcia Maquez'); insert INTO AUTOR VALUES(2, 'Dante Alighieri'); insert INTO AUTOR VALUES(3, 'Miguel Ruiz'); insert INTO AUTOR VALUES(4, 'Jose Asunción Silva'); insert INTO AUTOR VALUES(5, 'Paulo Cohelo'); insert INTO CIUDAD VALUES(1, 'Bogota'); insert INTO CIUDAD VALUES(2, 'Medellin'); insert INTO CIUDAD VALUES(3, 'Cali'); insert INTO CIUDAD VALUES(4, 'Pamplona'); insert INTO TIPO_CLIENTE VALUES(1, 'Persona Natural'); insert INTO TIPO_CLIENTE VALUES(2, 'Persona Jurídica');
insert INTO TIPO_DOC VALUES(1, 'NIT');
insert INTO TIPO_DOC VALUES(2, 'Cedula'); insert INTO EDITORIAL VALUES(1, 'Planeta', 'E001', 'Cra 33 12 43', 1, 'planeta@planeta.com', 'Pablo Riveros'); insert INTO EDITORIAL VALUES(2, 'Indigo', 'E002', 'Cl 12 76 45', 1, 'indigo@indigo.org', 'Jose Ruiz'); insert INTO EDITORIAL VALUES(3, 'Libro Verde', 'E003', 'Av 23 32 56', 2, 'liverde@lverde.com', 'Diana Perez'); insert INTO EDITORIAL VALUES(4, 'Edimat', 'E004', 'Cr 21 23 21', 2, 'edimat@edimat.com', 'Paola Duarte'); insert INTO EDITORIAL VALUES(5, 'Urano', 'E005', 'Cl 67 54 32', 3, 'urano@urano.com', 'Ricardo Santos'); insert INTO LIBRO VALUES(1, 'Cien Años de Soledad', 1, 1, 1964, 1, 20, 134000); insert INTO LIBRO VALUES(2, 'La Divina Comedia', 2, 3, 1985, 1, 15, 20000); insert INTO LIBRO VALUES(3, 'Los Cuatro Acuerdos', 3, 5, 1983, 1, 23, 15000); insert INTO CLIENTE VALUES(1, 1, 'CDC2435565', 1, 2435565, 'Jose Santos', 'Cr 89 54 34', 1, 3145646556, 'jsantos@gmail.com'); insert INTO CLIENTE VALUES(2, 1, 'CDC2345675', 1, 2345675, 'Diana Quiroz', 'Cr 20 23 56', 1, 3145646556, 'dquiroz@gmail.com'); insert INTO CLIENTE VALUES(3, 2, 'CDC2345675', 2, 892003457, 'CAMARA DE COMERCIO', 'Cr 25 18A 49', 3, 3115459644, 'cca@cca.com');
insert INTO VENTAS VALUES(1, 'F23541', 1, 1, 134000, '15/05/2019');