-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathActividad_Virtual-02.sql
402 lines (373 loc) · 22 KB
/
Actividad_Virtual-02.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
SET DATEFORMAT YMD
if db_id('VENTASCIB') is not null
begin
use master
drop database VENTASCIB
end
CREATE DATABASE VENTASCIB
GO
USE VENTASCIB
go
CREATE TABLE TB_DISTRITO(
COD_DIS CHAR(5)NOT NULL PRIMARY KEY,
NOM_DIS VARCHAR(50)
)
CREATE TABLE TB_VENDEDOR(
COD_VEN CHAR(3)NOT NULL PRIMARY KEY ,
NOM_VEN VARCHAR(20)NOT NULL,
APE_VEN VARCHAR(20)NOT NULL,
SUELDO_VEN MONEY NOT NULL,
FEC_ING DATE NOT NULL,
TIP_VEN VARCHAR(10)NOT NULL,
COD_DIS CHAR(5)NOT NULL REFERENCES TB_DISTRITO
)
CREATE TABLE TB_CLIENTE(
COD_CLI CHAR (5)NOT NULL PRIMARY KEY,
RAZ_SOC_CLI CHAR(30)NOT NULL,
DIR_CLI VARCHAR(100)NOT NULL,
TLF_CLI CHAR(9)NOT NULL,
RUC_CLI CHAR(11) NULL,
COD_DIS CHAR(5)NOT NULL REFERENCES TB_DISTRITO,
FEC_REG DATE NOT NULL,
TIP_CLI VARCHAR(10) NOT NULL,
CONTACTO VARCHAR(30) NOT NULL
)
CREATE TABLE TB_PROVEEDOR(
COD_PRV CHAR(5)NOT NULL PRIMARY KEY,
RAZ_SOC_PRV VARCHAR(80)NOT NULL,
DIR_PRV VARCHAR(100)NOT NULL,
TEL_PRV CHAR(15) NULL,
COD_DIS CHAR(5)NOT NULL REFERENCES TB_DISTRITO,
REP_VEN VARCHAR(80) NOT NULL
)
CREATE TABLE TB_FACTURA(
NUM_FAC VARCHAR(12)NOT NULL PRIMARY KEY,
FEC_FAC DATE NOT NULL,
COD_CLI CHAR(5)NOT NULL REFERENCES TB_CLIENTE,
FEC_CAN DATE NOT NULL,
EST_FAC VARCHAR(10)NOT NULL,
COD_VEN CHAR(3)NOT NULL REFERENCES TB_VENDEDOR,
PORC_IGV DECIMAL NOT NULL
)
CREATE TABLE TB_ORDEN_COMPRA(
NUM_OCO CHAR(5)NOT NULL PRIMARY KEY,
FEC_OCO DATE NOT NULL,
COD_PRV CHAR(5)NOT NULL REFERENCES TB_PROVEEDOR,
FEC_ATE DATE NOT NULL,
EST_OCO CHAR(1)NOT NULL
)
CREATE TABLE TB_PRODUCTO(
COD_PRO CHAR(5)NOT NULL PRIMARY KEY,
DES_PRO VARCHAR(50)NOT NULL,
PRE_PRO MONEY NOT NULL,
STK_ACT INT NOT NULL,
STK_MIN INT NOT NULL,
UNI_MED VARCHAR(30)NOT NULL,
LIN_PRO VARCHAR(30)NOT NULL,
IMPORTADO VARCHAR(10)NOT NULL
)
CREATE TABLE TB_DETALLE_FACTURA(
NUM_FAC VARCHAR(12)NOT NULL REFERENCES TB_FACTURA,
COD_PRO CHAR(5)NOT NULL REFERENCES TB_PRODUCTO,
CAN_VEN INT NOT NULL,
PRE_VEN MONEY NOT NULL
PRIMARY KEY (NUM_FAC,COD_PRO)
)
CREATE TABLE TB_DETALLE_COMPRA(
NUM_OCO CHAR(5)NOT NULL REFERENCES TB_ORDEN_COMPRA,
COD_PRO CHAR(5)NOT NULL REFERENCES TB_PRODUCTO,
CAN_PED INT NOT NULL
PRIMARY KEY (NUM_OCO,COD_PRO)
)
CREATE TABLE TB_ABASTECIMIENTO(
COD_PRV CHAR(5)NOT NULL REFERENCES TB_PROVEEDOR,
COD_PRO CHAR(5)NOT NULL REFERENCES TB_PRODUCTO,
PRE_ABA MONEY NOT NULL
PRIMARY KEY (COD_PRV,COD_PRO)
)
GO
INSERT INTO TB_DISTRITO VALUES('D01','Surco')
INSERT INTO TB_DISTRITO VALUES('D02','Jesús María')
INSERT INTO TB_DISTRITO VALUES('D03','San Isidro')
INSERT INTO TB_DISTRITO VALUES('D04','La Molina')
INSERT INTO TB_DISTRITO VALUES('D05','San Miguel')
INSERT INTO TB_DISTRITO VALUES('D06','Miraflores')
INSERT INTO TB_DISTRITO VALUES('D07','Barranco')
INSERT INTO TB_DISTRITO VALUES('D08','Chorrillos')
INSERT INTO TB_DISTRITO VALUES('D09','San Borja')
INSERT INTO TB_DISTRITO VALUES('D10','Lince')
INSERT INTO TB_DISTRITO VALUES('D11','Breña')
INSERT INTO TB_DISTRITO VALUES('D12','Magdalena')
INSERT INTO TB_DISTRITO VALUES('D13','Rimac')
INSERT INTO TB_DISTRITO VALUES('D14','Surquillo')
INSERT INTO TB_DISTRITO VALUES('D15','Pueblo Libre')
INSERT INTO TB_DISTRITO VALUES('D16','Bellavista')
INSERT INTO TB_DISTRITO VALUES('D17','Callao')
INSERT INTO TB_DISTRITO VALUES('D18','San Martin de Porres')
INSERT INTO TB_DISTRITO VALUES('D19','Santa Anita')
INSERT INTO TB_DISTRITO VALUES('D20','Los Olivos')
INSERT INTO TB_DISTRITO VALUES('D21','Independencia')
INSERT INTO TB_DISTRITO VALUES('D22','Lima - Cercado')
INSERT INTO TB_DISTRITO VALUES('D24','San Luis')
INSERT INTO TB_DISTRITO VALUES('D25','El Agustino')
INSERT INTO TB_DISTRITO VALUES('D26','San Juan de Lurigancho')
INSERT INTO TB_DISTRITO VALUES('D27','Ate - Vitarte')
INSERT INTO TB_DISTRITO VALUES('D28','San Juan de Miraflores')
INSERT INTO TB_DISTRITO VALUES('D29','Carmen de la Legua')
INSERT INTO TB_DISTRITO VALUES('D30','Comas')
INSERT INTO TB_DISTRITO VALUES('D31','Villa María del Triunfo')
INSERT INTO TB_DISTRITO VALUES('D32','Villa el Salvador')
INSERT INTO TB_DISTRITO VALUES('D33','La Perla')
INSERT INTO TB_DISTRITO VALUES('D34','Ventanilla')
INSERT INTO TB_DISTRITO VALUES('D35','Puente Piedra')
INSERT INTO TB_DISTRITO VALUES('D36','Carabayllo')
INSERT INTO TB_DISTRITO VALUES('D37','Santa Maria')
INSERT INTO TB_DISTRITO VALUES('D38','San Guchito')
INSERT INTO TB_DISTRITO VALUES('D45','La Punta')
SELECT* FROM TB_DISTRITO
go
INSERT INTO TB_VENDEDOR VALUES('V01','JUANA','ALVA',1000,'07/12/2003','1','D08')
INSERT INTO TB_VENDEDOR VALUES('V02','JUAN','SOTO',1200,'10/03/2002','2','D03')
INSERT INTO TB_VENDEDOR VALUES('V03','CARLOS','AREVALO',1500,'02/10/1992','2','D09')
INSERT INTO TB_VENDEDOR VALUES('V04','CESAR','OJEDA',850,'08/11/1999','1','D01')
INSERT INTO TB_VENDEDOR VALUES('V05','JULIO','VEGA',1500,'11/05/1997','1','D01')
INSERT INTO TB_VENDEDOR VALUES('V06','ANA','ORTEGA',1200,'11/05/1994','1','D05')
INSERT INTO TB_VENDEDOR VALUES('V07','JOSE','PALACIOS',2500,'12/02/1997','1','D02')
INSERT INTO TB_VENDEDOR VALUES('V08','RUBEN','GOMEZ',1450,'12/08/1996','2','D04')
INSERT INTO TB_VENDEDOR VALUES('V09','PATRICIA','ARCE',1800,'12/05/1997','2','D04')
INSERT INTO TB_VENDEDOR VALUES('V10','RENATO','PEREZ',1550,'11/08/1998','2','D01')
SELECT * FROM TB_VENDEDOR
GO
INSERT INTO TB_CLIENTE VALUES('C001','Finseth','Av. Los Viñedos 150','4342318','48632081','D05','12/10/2008','1','Alicia Barreto')
INSERT INTO TB_CLIENTE VALUES('C002','Orbi','Av. Emilio Cavenecia 225','4406335','57031642','D04','02/01/2013','2','Alfonso Beltran')
INSERT INTO TB_CLIENTE VALUES('C003','Serviemsa','Jr. Collagate 522','75012403',NULL,'D05','06/03/2011','2','Christian Laguna')
INSERT INTO TB_CLIENTE VALUES('C004','Issa','Calle Los Aviadores 263','3725910','46720159','D01','9/12/2012','1','Luis Apumayta')
INSERT INTO TB_CLIENTE VALUES('C005','Mass','Av. Tomas Marsano 880','4446177','83175942','D14','10/01/2013','1','Katia Armejo')
INSERT INTO TB_CLIENTE VALUES('C006','Berker','Av. Los Proceres 521','3810322','54890124','D05','7/05/2013','1','Judith Aste')
INSERT INTO TB_CLIENTE VALUES('C007','Fidenza','Jr. El Niquel 282','5289034','16204790','D20','10/02/2012','2','Hector Vivanco')
INSERT INTO TB_CLIENTE VALUES('C008','Intech','Av. San Luis 2619 5to P','2249493','34021824','D09','01/07/2011','2','Carlos Villanueva')
INSERT INTO TB_CLIENTE VALUES('C009','Prominent','Jr. Iquique 132','43233519',NULL,'D11','06/11/2010','1','Jorge Valdivia')
INSERT INTO TB_CLIENTE VALUES('C010','Landu','Av.Nicolas de Ayllon 1453','3267840','30405261','D05','11/06/2013','2','Raquel Espinoza')
INSERT INTO TB_CLIENTE VALUES('C011','Filasur','Av. El Santuario 1189','4598175','70345201','D26','08/04/2012','1','Angelica Vivas')
INSERT INTO TB_CLIENTE VALUES('C012','Sucerte','Jr. Grito de Huaura 114','4206434','62014503','D05','11/08/2011','1','Karina Vega')
INSERT INTO TB_CLIENTE VALUES('C013','Hayashi','Jr. Ayacucho 359','42847990',NULL,'D22','03/09/2013','2','Ernesto Uehara')
INSERT INTO TB_CLIENTE VALUES('C014','Kadia','Av.Santa Cruz 1332 Of.201','4412418','22202915','D06','10/05/2011','1','Miguel Arce')
INSERT INTO TB_CLIENTE VALUES('C015','Meba','Av. Elmer Faucett 1638',' 4641234','50319542','D16','06/11/2011','2','Ricardo Gomez')
INSERT INTO TB_CLIENTE VALUES('C016','Cardeli','Jr. Bartolome Herrera 451','2658853','26403158','D10','5/04/2013','2','Giancarlo Bonifaz')
INSERT INTO TB_CLIENTE VALUES('C017','Payet','Calle Juan Fanning 327',' 4779834','70594032','D07','5/12/2013','1','Paola Uribe')
INSERT INTO TB_CLIENTE VALUES('C018','Dasin','Av. Saenz Peña 338 - B',' 4657574','35016752','D17','12/03/2011','1','Angela Barreto')
INSERT INTO TB_CLIENTE VALUES('C019','Corefo','Av. Canada 3894 - 3898','4377499','57201691','D24','01/03/2010','2','Rosalyn Cortez')
INSERT INTO TB_CLIENTE VALUES('C020','Cramer','Jr. Mariscal Miller 1131','4719061','46031783','D02','8/11/2010','1','Christopher Ramos')
SELECT* FROM TB_CLIENTE
GO
INSERT INTO TB_PROVEEDOR VALUES('PR01','Faber Castell','Av. Isabel La Catolica 1875','4330895','D13','Carlos Aguirre')
INSERT INTO TB_PROVEEDOR VALUES('PR02','Atlas ','Av. Lima 471','5380926','D13','Cesar Torres')
INSERT INTO TB_PROVEEDOR VALUES('PR03','3M ','Av. Venezuela 3018' ,'2908165','D16','Omar Injoque')
INSERT INTO TB_PROVEEDOR VALUES('PR04','Dito ','Av. Metropolitana 376' ,NULL ,'D19','Ramón Flores')
INSERT INTO TB_PROVEEDOR VALUES('PR05','Acker ','Calle Las Dunas 245 ' ,'4780143','D27','Julio Acuña')
INSERT INTO TB_PROVEEDOR VALUES('PR06','Deditec ','Calle Pichincha 644 ' ,'5662848','D11','Javier Gonzales')
INSERT INTO TB_PROVEEDOR VALUES('PR07','Officetec','Calle Las Perdices 225 Of. 204' ,'4216184','D03','Carlos Robles')
INSERT INTO TB_PROVEEDOR VALUES('PR08','Invicta ','Av. Los Frutales 564 ' ,'4364247','D27','Alberto Rodriguez')
INSERT INTO TB_PROVEEDOR VALUES('PR09','Dipropor','Av. Del Aire 901' ,'4742046','D24','Roberto Ronceros')
INSERT INTO TB_PROVEEDOR VALUES('PR10','Miura ','Av. La Paz 257' ,'4459710','D06','Jorge Vasquez')
INSERT INTO TB_PROVEEDOR VALUES('PR11','Praxis ','Av. José Gálvez 1820 - 1844 ' ,'4703944','D10','Ericka Zegarra')
INSERT INTO TB_PROVEEDOR VALUES('PR12','Sumigraf','Av. Manco Cápac 754','3320343','D13','Karinna Paredes')
INSERT INTO TB_PROVEEDOR VALUES('PR13','Limmsa ','Prolg. Huaylas 670' ,'2546995','D08','Laura Ortega')
INSERT INTO TB_PROVEEDOR VALUES('PR14','Veninsa ','Av. Tejada 338' ,'2473832','D07','Melisa Ramos')
INSERT INTO TB_PROVEEDOR VALUES('PR15','Crosland','Av. Argentina 3206 - 3250' ,'4515272','D17','Juan Ramirez')
INSERT INTO TB_PROVEEDOR VALUES('PR16','Petramas','Calle Joaquín Madrid 141 2do P' ,NULL ,'D09','Rocío Guerrero')
INSERT INTO TB_PROVEEDOR VALUES('PR17','Reawse ','Av. Santa Rosa 480 ' ,NULL ,'D19','María Perez')
INSERT INTO TB_PROVEEDOR VALUES('PR18','Edusa ','Av. Morales Duarez 1260' ,'4525536','D29','Pablo Martel')
INSERT INTO TB_PROVEEDOR VALUES('PR19','Ottmer ','Urb.Pro Industrial Mz B6 Lt 16' ,'5369893','D18','Angela Rendilla')
INSERT INTO TB_PROVEEDOR VALUES('PR20','Bari ','Av. Arnaldo Marquez 1219' ,NULL ,'D02','Vanesa Quintana')
SELECT* FROM TB_PROVEEDOR
GO
INSERT INTO TB_FACTURA VALUES('FA001','06-07-2013','C001' ,'05-08-2013', '2','V01','0.19')
INSERT INTO TB_FACTURA VALUES('FA002','6-07-2013','C019' ,'05-08-2013','3','V02','0.19')
INSERT INTO TB_FACTURA VALUES('FA003','1-09-2013','C003' ,'3-10-2013', '2','V04','0.19')
INSERT INTO TB_FACTURA VALUES('FA004','6-09-2013','C016' ,'5-10-2013', '2','V07','0.19')
INSERT INTO TB_FACTURA VALUES('FA005','01-10-2013','C015' ,'12-10-2013', '2','V08','0.19')
INSERT INTO TB_FACTURA VALUES('FA006','1-08-2013','C009', '05-08-2013','3','V05','0.19')
INSERT INTO TB_FACTURA VALUES('FA007','5-10-2013','C019','10-10-2013','1','V09','0.19')
INSERT INTO TB_FACTURA VALUES('FA008','4-10-2013','C012' ,'06-10-2013', '2','V10','0.19')
INSERT INTO TB_FACTURA VALUES('FA009','3-10-2013','C008' ,'10-10-2013', '2','V09','0.19')
INSERT INTO TB_FACTURA VALUES('FA010','1-10-2013','C017' ,'6-10-2013', '2','V02','0.19')
INSERT INTO TB_FACTURA VALUES('FA011','10-09-2013','C019' ,'10-09-2013', '2','V05','0.19')
INSERT INTO TB_FACTURA VALUES('FA012','1-12-2013','C014' ,'1-12-2013', '1','V04','0.19')
INSERT INTO TB_FACTURA VALUES('FA013','1-12-2013','C011' ,'1-12-2013', '3','V08','0.19')
INSERT INTO TB_FACTURA VALUES('FA014','1-12-2012','C020' ,'1-12-2013', '2','V09','0.19')
INSERT INTO TB_FACTURA VALUES('FA015','8-12-2012','C015' ,'06-01-2013', '2','V07','0.19')
INSERT INTO TB_FACTURA VALUES('FA016','6-01-2013','C016' ,'9-01-2013', '2','V05','0.19')
INSERT INTO TB_FACTURA VALUES('FA017','6-01-2013','C015' ,'6-01-2013', '1','V06','0.19')
INSERT INTO TB_FACTURA VALUES('FA018','03-02-2013','C016' ,'4-02-2013', '2','V10','0.19')
INSERT INTO TB_FACTURA VALUES('FA019','7-02-2013','C008' ,'01-03-2013', '2','V03','0.19')
INSERT INTO TB_FACTURA VALUES('FA020','6-02-2013','C013' ,'10-03-2013', '2','V02','0.19')
SELECT* FROM TB_FACTURA
GO
INSERT INTO TB_ORDEN_COMPRA VALUES('OC001','5-03-2013','PR08',' 12-03-2013','1')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC002','8-04-2013','PR16',' 10-04-2013','1')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC003','02-08-2013','PR10' ,'02-08-2013', '3')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC004','5-04-2013','PR01','5-04-2013', '3')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC005','06-03-2013','PR07',' 10-03-2013','1')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC006','02-01-2013','PR19',' 2-01-2013','1')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC007','6-02-2013','PR20' ,'5-04-2013', '3')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC008','2-06-2013','PR04',' 01-07-2013','1')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC009','3-08-2013','PR11',' 10-09-2013','1')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC010','05-09-2013','PR01',' 5-09-2013','1')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC011','2-10-2013','PR03',' 3-10-2013','1')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC012','4-10-2013','PR14' ,'5-10-2013','3')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC013','02-11-2013','PR05','6-11-2013','1')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC014','3-11-2013','PR19',' 5-12-2013','1')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC015','3-11-2013','PR18',' 10-12-2013','1')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC016','06-12-2013','PR06' ,'06-12-2013', '3')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC017','08-01-2013','PR09',' 8-01-2013','1')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC018','1-02-2013','PR20',' 8-02-2013','1')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC019','03-03-2013','PR11',' 6-03-2013','1')
INSERT INTO TB_ORDEN_COMPRA VALUES('OC020','2-04-2013','PR05' ,'2-04-2013','2')
SELECT* FROM TB_ORDEN_COMPRA
GO
INSERT INTO TB_PRODUCTO VALUES('P001','Papel Bond A-4',35.0, 200,1500,'Mll','2','V')
INSERT INTO TB_PRODUCTO VALUES('P002','Papel Bond Oficio ',35, 50,1500,'Mll','2','F')
INSERT INTO TB_PRODUCTO VALUES('P003','Papel Bulky ',10 ,498,1000,'Mll','2','V')
INSERT INTO TB_PRODUCTO VALUES('P004','Papel Periódico',9,4285,1000,'Mll','2','F')
INSERT INTO TB_PRODUCTO VALUES('P005','Cartucho Tinta Negra', 40 ,50,30,'Uni','1','F')
INSERT INTO TB_PRODUCTO VALUES('P006','Cartucho Tinta Color ',45 ,58,35, 'Uni','1','F')
INSERT INTO TB_PRODUCTO VALUES('P007','Porta Diskettes',3.5,300,100,'Uni','1','V')
INSERT INTO TB_PRODUCTO VALUES('P008','Caja de Diskettes * 10 ',30,125,180,'Uni','1','F')
INSERT INTO TB_PRODUCTO VALUES('P009','Borrador de Tinta ',10 ,100,500,'Doc','3','F')
INSERT INTO TB_PRODUCTO VALUES('P010','Borrador Blanco ',8 ,2000,400,'Doc','3','F')
INSERT INTO TB_PRODUCTO VALUES('P011','Tajador Metal ',20 ,1120,300,'Doc','3','F')
INSERT INTO TB_PRODUCTO VALUES('P012','Tajador Plastico',12 ,608,300,'Doc','3','F')
INSERT INTO TB_PRODUCTO VALUES('P013','Folder Manila Oficio',20,200,150,'Cie','3','F')
INSERT INTO TB_PRODUCTO VALUES('P014','Folder Manila A-4',20 ,150,150,'Cie','3','V')
INSERT INTO TB_PRODUCTO VALUES('P015','Sobre Manila Oficio',15,300,130,'Cie','3','F')
INSERT INTO TB_PRODUCTO VALUES('P016','Sobre Manila A-4',18,200,100,'Cie','3','F')
INSERT INTO TB_PRODUCTO VALUES('P017','Lapicero Negro',10,3000,1000,'Doc','3','F')
INSERT INTO TB_PRODUCTO VALUES('P018','Lapicero Azul ',10 ,2013,1500,'Doc','3','F')
INSERT INTO TB_PRODUCTO VALUES('P019','Lapicero Rojo',8,1900,1000,'Doc','3','V')
INSERT INTO TB_PRODUCTO VALUES('P020','Folder Plastico A-4',50 ,3080,1100,'Cie','3','F')
INSERT INTO TB_PRODUCTO VALUES('P021','Protector de Pantalla',50,20,5,'Uni','1','F')
SELECT* FROM TB_PRODUCTO
GO
INSERT INTO TB_DETALLE_FACTURA VALUES('FA001','P007','6' ,'5')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA001','P011','25' ,'25')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA001','P013','11' ,'20')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA002','P004','8' ,'10')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA003','P002','10' ,'40')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA003','P011','6' ,'20')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA003','P017','21' ,'12')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA003','P019','12' ,'10')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA004','P004','3' ,'10')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA004','P009','50' ,'5')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA005','P003','20' ,'10')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA005','P006','50' ,'50')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA005','P020','5' ,'60')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA006','P002','20' ,'35')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA006','P003','15' ,'10')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA006','P009','12' ,'5')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA007','P003','20' ,'12')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA007','P012','4' ,'12')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA008','P004','15' ,'9')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA008','P008','15' ,'30')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA008','P020','50' ,'50')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA009','P001','5' ,'30')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA009','P002','15' ,'35')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA009','P006','2' ,'50')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA009','P019','1' ,'8')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA010','P002','3' ,'35')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA011','P002','20' ,'35')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA012','P002','3' ,'35')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA012','P006','1' ,'50')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA013','P002','130' ,'35')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA013','P003','5' ,'12')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA013','P015','4' ,'12')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA014','P009','10' ,'8')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA015','P008','5' ,'30')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA015','P016','3' ,'18')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA016','P006','15' ,'50')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA016','P008','2' ,'30')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA017','P002','120' ,'40')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA017','P005','120' ,'40')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA018','P003','4' ,'12')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA018','P005','6' ,'40')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA019','P002','150' ,'40')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA019','P003','6' ,'10')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA019','P006','2' ,'45')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA019','P008','10' ,'30')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA020','P009','120' ,'10')
INSERT INTO TB_DETALLE_FACTURA VALUES('FA020','P015','5' ,'15')
SELECT * FROM TB_DETALLE_FACTURA
GO
INSERT INTO TB_DETALLE_COMPRA VALUES('OC001','P006','100')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC001','P016','20')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC002','P003','200')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC002','P005','500')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC003','P005','50')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC004','P009','10')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC004','P013','50')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC005','P007','150')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC005','P008','100')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC008','P002','10')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC008','P012','100')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC009','P009','50')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC009','P011','50')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC010','P001','100')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC011','P008','5')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC011','P016','10')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC012','P007','50')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC012','P011','100')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC013','P013','50')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC014','P004','50')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC014','P008','50')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC014','P020','50')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC016','P015','100')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC017','P012','100')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC017','P014','100')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC019','P006','100')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC020','P005','500')
INSERT INTO TB_DETALLE_COMPRA VALUES('OC020','P011','100')
SELECT* FROM TB_DETALLE_COMPRA
GO
INSERT INTO TB_ABASTECIMIENTO VALUES('PR01','P003','8')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR01','P005','35')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR01','P007','3')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR01','P009','8')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR01','P011','18')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR02','P002','30')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR02','P007','3')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR03','P002','32')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR03','P004','7')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR04','P001','28')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR04','P006','40')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR05','P018','9')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR06','P009','7')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR06','P017','8')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR07','P016','15')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR07','P019','7')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR08','P006','42')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR08','P010','6')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR09','P002','30')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR09','P014','17')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR11','P001','27')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR11','P006','44')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR12','P002','33')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR12','P010','7')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR13','P005','35')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR14','P016','15')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR15','P020','45')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR16','P008','25')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR16','P012','9')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR16','P013','15')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR19','P008','28')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR19','P016','16')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR20','P012','10')
INSERT INTO TB_ABASTECIMIENTO VALUES('PR20','P020','43')
SELECT* FROM TB_ABASTECIMIENTO
GO
select * from TB_PROVEEDOR
select * from TB_ABASTECIMIENTO
select * from TB_PRODUCTO
select p.COD_PRV,p.REP_VEN,a.COD_PRO,pr.DES_PRO,a.PRE_ABA
from TB_PROVEEDOR P join TB_ABASTECIMIENTO A
on P.COD_PRV=A.COD_PRV join TB_PRODUCTO PR
on PR.COD_PRO=A.COD_PRO