You are on page 1of 5

CREATE TABLE PAISES

(
CODPAIS CHAR(4) PRIMARY KEY,
NOMPAIS VARCHAR(30) NOT NULL);

CREATE TABLE AREAS


(
CODAREA CHAR(4) PRIMARY KEY,
NOMAREA VARCHAR(30) NOT NULL);

CREATE TABLE DISTRITOS


(
CODDIS CHAR(4) PRIMARY KEY,
NOMDIS VARCHAR(30) NOT NULL);

CREATE TABLE SOCIOS


(
CODSOC CHAR(4) PRIMARY KEY,
NOMSOC VARCHAR(40) NOT NULL,
DNI CHAR(8) NOT NULL,
FNAC DATE NOT NULL,
SEXO CHAR(1) NOT NULL,
DIREC VARCHAR(30) NOT NULL,
CODDIS CHAR(4) FOREIGN KEY
REFERENCES DISTRITOS(CODDIS),
TELEF VARCHAR(9) NOT NULL,
EMAIL VARCHAR(30) NOT NULL,
ESTADO CHAR(1) NOT NULL);

CREATE TABLE AUTORES


(
CODAUT CHAR(4) PRIMARY KEY,
NOMAUT VARCHAR(40) NOT NULL,
DIRECC VARCHAR(40) NOT NULL,
CODPAIS CHAR(4) FOREIGN KEY
REFERENCES PAISES(CODPAIS),
WEB VARCHAR(30) NOT NULL,
EMAIL VARCHAR(30) NOT NULL,
ESTADO CHAR(1) NOT NULL);

CREATE TABLE EDITORIALES


(
CODEDIT CHAR(4) PRIMARY KEY,
NOMEDIT VARCHAR(30) NOT NULL,
DIRECC VARCHAR(30) NOT NULL,
CODPAIS CHAR(4) FOREIGN KEY
REFERENCES PAISES(CODPAIS),
WEB VARCHAR(30) NOT NULL,
EMAIL VARCHAR(30) NOT NULL,
ESTADO CHAR(1) NOT NULL);

CREATE TABLE LIBROS


(
CODLIB CHAR(6) PRIMARY KEY,
NOMLIB VARCHAR(40) NOT NULL,
CODAREA CHAR(4) FOREIGN KEY
REFERENCES AREAS(CODAREA),
CODAUT CHAR(4) FOREIGN KEY
REFERENCES AUTORES(CODAUT),
CODEDIT CHAR(4) FOREIGN KEY
REFERENCES EDITORIALES(CODEDIT),
EDICION VARCHAR(20) NOT NULL,
PRECIO DECIMAL(5,2) NOT NULL,
STOCK INT NOT NULL,
ESTADO CHAR(1) NOT NULL);

INSERT INTO PAISES VALUES('P001','USA')


INSERT INTO PAISES VALUES('P002','JAPON')
INSERT INTO PAISES VALUES('P003','COLOMBIA')
INSERT INTO PAISES VALUES('P004','MEXICO')
INSERT INTO PAISES VALUES('P005','PERU')
INSERT INTO PAISES VALUES('P006','ARGENTINA')
INSERT INTO PAISES VALUES('P007','RUSIA')
INSERT INTO PAISES VALUES('P008','CHILE')
INSERT INTO PAISES VALUES('P009','BRASIL')
INSERT INTO PAISES VALUES('P010','ESPAA')

SELECT * FROM PAISES

INSERT INTO AREAS VALUES('A001','SISTEMAS')


INSERT INTO AREAS VALUES('A002','MEDICINA')
INSERT INTO AREAS VALUES('A003','PSICOLOGIA')
INSERT INTO AREAS VALUES('A004','QUIMICA')
INSERT INTO AREAS VALUES('A005','CALCULO')
INSERT INTO AREAS VALUES('A006','FISICA')
INSERT INTO AREAS VALUES('A007','BIOLOGIA')
INSERT INTO AREAS VALUES('A008','INGENIERIA')
INSERT INTO AREAS VALUES('A009','INDUSTRIAL')
INSERT INTO AREAS VALUES('A010','INVOPERACIONES')

SELECT * FROM AREAS

INSERT INTO DISTRITOS VALUES('D001','ANCON')


INSERT INTO DISTRITOS VALUES('D002','BREA')
INSERT INTO DISTRITOS VALUES('D003','CALLAO')
INSERT INTO DISTRITOS VALUES('D004','LIMA')
INSERT INTO DISTRITOS VALUES('D005','SURCO')
INSERT INTO DISTRITOS VALUES('D006','SURQUILLO')
INSERT INTO DISTRITOS VALUES('D007','RIMAC')
INSERT INTO DISTRITOS VALUES('D008','LINCE')
INSERT INTO DISTRITOS VALUES('D009','CERCADO')
INSERT INTO DISTRITOS VALUES('D010','SMP')

SELECT * FROM DISTRITOS

INSERT INTO SOCIOS VALUES('S001', 'JOSE


LOPEZ', '24763219', '23/11/81','M', 'JR. ICA 234',
'D004', '2756432', 'jlopez@gmail.com', 'S')
INSERT INTO SOCIOS VALUES('S002', 'ROSA
GARCIA', '76193254', '28/08/81','F', 'JR. ILO 982',
'D001', '4569864', 'rgarcia@gmail.com', 'C')
INSERT INTO SOCIOS VALUES('S003', 'RAUL
POZO', '32151839', '19/03/78','M', 'JR. CUZCO 872',
'D003', '997756432', 'rpozo@yahoo.com', 'S')
INSERT INTO SOCIOS VALUES('S004', 'CARLOS
SOTO', '42973219', '24/09/80','M', 'JR. HUARAZ
567', 'D002', '996321865', 'csoto@gmail.com', 'S')
INSERT INTO SOCIOS VALUES('S005', 'CARMEN
BAZAN', '29183429', '19/01/75','F', 'JR. SUPE 649',
'D005', '998654123', 'cbazan@yahoo.es', 'C')
INSERT INTO SOCIOS VALUES('S006', 'LUIS
PEREZ', '38163217', '23/11/85','M', 'JR. CARABAYLLO 123',
'D002', '3816432', 'lperez@gmail.com', 'C')
INSERT INTO SOCIOS VALUES('S007', 'ANA
GARCIA', '77793254', '21/01/88','F', 'JR. ILO 982',
'D001', '4569864', 'anagarcia@gmail.com', 'S')
INSERT INTO SOCIOS VALUES('S008', 'JESUS
CAMPOS', '38151839', '07/03/87','M', 'JR. SAN ANTONIO 872',
'D007', '997948432', 'jesuscampos@yahoo.com', 'S')
INSERT INTO SOCIOS VALUES('S009', 'CARLOS
RAMIREZ', '42347219', '02/02/83','M', 'JR. ANCASH
567', 'D010', '999921565', 'cramirez@gmail.com', 'S')
INSERT INTO SOCIOS VALUES('S010', 'CARMEN
POLO', '29456429', '02/03/79','F', 'JR. MARAON 123',
'D009', '998784123', 'cpolo@yahoo.es', 'C')

SELECT * FROM SOCIOS

INSERT INTO AUTORES VALUES('A001', 'JOSE


RAMOS', 'CALDAS 267', 'P003', 'www.jramos.cl',
'jramos@yahoo.com', 'S')
INSERT INTO AUTORES VALUES('A002', 'RAY
MORRIS', 'CORAL GABLE 465', 'P001',
'www.morris.com','rmorris@gmail.com', 'C')
INSERT INTO AUTORES VALUES('A003', 'KEN
KENOWI', 'ISHIDO 177', 'P002', 'www.kenowi.jp',
'kenowi@yahoo.com', 'C')
INSERT INTO AUTORES VALUES('A004', 'LUIS
TORRES', 'BALARES 651', 'P004', 'www.torres.mx',
'ltorres@yahoo.com', 'V')
INSERT INTO AUTORES VALUES('A005', 'JORGE
LOPEZ', 'ANGAMOS 1345', 'P005', 'www.lopez.pe',
'jlopez@yahoo.com', 'D')
INSERT INTO AUTORES VALUES('A006', 'JOSE
RAMIREZ', 'ICA 123', 'P006', 'www.jramirez.cl',
'jramirez@yahoo.com', 'D')
INSERT INTO AUTORES VALUES('A007', 'RAY
SEPULVEDA', 'ANCASH 465', 'P009',
'www.sepulveda.com','rsepulveda@gmail.com', 'C')
INSERT INTO AUTORES VALUES('A008', 'KEN
FORSYTH', 'LA VISCTORIA 004', 'P005', 'www.forsyth.jp',
'kforsyth@yahoo.com', 'S')
INSERT INTO AUTORES VALUES('A009', 'LUIS
YLLU', 'PRIMAVERA 124', 'P007', 'www.yllu.rs',
'lyllu@yahoo.com', 'S')
INSERT INTO AUTORES VALUES('A010', 'JORGE
CASTAEDA', 'CAYLLOMA 567', 'P010', 'www.castaeda.com',
'jcastaeda@yahoo.com', 'C')

SELECT * FROM AUTORES

INSERT INTO EDITORIALES VALUES('E001',


'PRENTICE HALL', '5TH. AVE. 2345', 'P001',
'www.prenticehall.com', 'phall@yahoo.com', 'A')
INSERT INTO EDITORIALES VALUES('E002',
'MANGA WA', 'OSAKA 287', 'P002',
'www.manga.com', 'manga@gmail.com', 'A')
INSERT INTO EDITORIALES VALUES('E003',
'ANAYA', 'BOGOTA 286', 'P003','www.anaya.com',
'anaya@yahoo.es', 'A')
INSERT INTO EDITORIALES VALUES('E004',
'PIRAMIDE', 'VERACRUZ 1234', 'P004',
'www.piramide.com', 'piramide@hotmail.com', 'A')
INSERT INTO EDITORIALES VALUES('E005',
'NAVARRETE', 'CUZCO 986', 'P005',
'www.navarrete.com', 'navarrete@yahoo.com', 'A')

SELECT * FROM EDITORIALES

INSERT INTO LIBROS VALUES('LB0001',


'TEORIA DE SISTEMAS', 'A001','A001','E003',
'4TA. EDICION', 120.00, 5, 'A')
INSERT INTO LIBROS VALUES('LB0002',
'ANATOMIA HUMANA', 'A002','A002','E002',
'3RA. EDICION', 350.00, 3, 'A')
INSERT INTO LIBROS VALUES('LB0003',
'LA FUERZA ESTA EN TI', 'A003','A003','E002',
'1RA. EDICION', 100.00, 2, 'A')
INSERT INTO LIBROS VALUES('LB0004',
'PROCESOS QUIMICOS', 'A004','A004','E004',
'2DA. EDICION', 170.00, 4, 'A')
INSERT INTO LIBROS VALUES('LB0005',
'EL ABC DEL ALGEBRA', 'A005','A005','E005',
'3RA. EDICION', 80.00, 5, 'A')
INSERT INTO LIBROS VALUES('LB0006',
'SEMANSKY', 'A006','A006','E001',
'9NA. EDICION', 100.00, 10, 'A')
INSERT INTO LIBROS VALUES('LB0007',
'CALCULO MULTIVARIABLE', 'A005','A008','E001',
'1RA. EDICION', 350.00, 5, 'A')
INSERT INTO LIBROS VALUES('LB0008',
'DISEO DEL TRABAJO', 'A009','A009','E002',
'3RA. EDICION', 100.00, 4, 'A')
INSERT INTO LIBROS VALUES('LB0009',
'TAHA', 'A010','A004','E004',
'5TA. EDICION', 190.00, 5, 'A')
INSERT INTO LIBROS VALUES('LB0010',
'TESIS', 'A008','A010','E005',
'9NA. EDICION',280.00, 5, 'A')
INSERT INTO LIBROS VALUES('LB0011',
'ALGORITMOS', 'A001','A003','E001',
'5TA. EDICION',180.00, 6, 'A')
INSERT INTO LIBROS VALUES('LB0012',
'BORLAND C++', 'A001','A001','E003',
'9NA. EDICION',280.00, 3, 'A')
INSERT INTO LIBROS VALUES('LB0013',
'CHANG', 'A004','A007','E002',
'9NA. EDICION',240.00, 5, 'A')
INSERT INTO LIBROS VALUES('LB0014',
'BROWN', 'A004','A004','E004',
'10MA. EDICION',150.00, 7, 'A')
INSERT INTO LIBROS VALUES('LB0015',
'DESCRIPTIVA', 'A008','A002','E005',
'7MA. EDICION',90.00, 15, 'A')
SELECT * FROM LIBROS