Professional Documents
Culture Documents
sp_helpdb
use bdmercadovega
create table cliente
(codcliente
char(6)
not null primary key,
nom
varchar(60) not null,
direc
varchar(60) not null,
dni
char(8)
not null,
fecha_registro datetime not null,
sueldo
numeric(8,2)not null,
estado_civil varchar(10) not null)
create table vendedor
(codvendedor char(6)
not null primary key,
nom
varchar(60) not null,
sueldo
numeric(8,2) not null,
turno
varchar(10) not null)
create table categoria
(codcategoria char(6)
not null primary key,
nomcateg
varchar(60) not null)
create table factura
(nrofactura char(12)
not null primary key,
femision datetime
not null,
forma_pago varchar(12) not null,
subtotal numeric(8,2) not null,
IGV
numeric(8,2) not null,
total
numeric(8,2) not null,
codcliente char(6)
not null foreign key(codcliente) references
cliente(codcliente),
codvendedor char(6)
not null foreign key(codvendedor) references
vendedor(codvendedor))
create table productos
(codproducto char(8)
not null primary key,
descripcion varchar(60) not null,
precio
numeric(8,2)not null,
marca
varchar(50) not null,
fvenci
datetime not null,
codcategoria char(6)
not null foreign key(codcategoria) references
categoria(codcategoria))
create table detalle
(nrofactura char(12)
not null foreign key(nrofactura) references
factura(nrofactura),
codproducto char(8)
not null foreign key(codproducto) references
productos(codproducto),
cantidad
varchar(10) not null,
importe
numeric(8,2) not null)
select*
select*
select*
select*
select*
select*
from
from
from
from
from
from
cliente
vendedor
factura
productos
categoria
detalle
sp_help
set dateformat DMY
insert into
cliente(codcliente,nom,direc,dni,fecha_registro,sueldo,estado_civil)
values('C00001','Juan','Jr. bustamante y rivero mz 10s lote
8','42806734','02/10/16','2000','soltero')
insert into
cliente(codcliente,nom,direc,dni,fecha_registro,sueldo,estado_civil)
values('C00002','Mario','Jr. Jose Santos Chocano mz 4b lote
16','44289123','02/10/16','3500','casado')
select* from cliente
insert into vendedor(codvendedor,nom,sueldo,turno)
values('A00001','John','1250','Maana')
insert into vendedor(codvendedor,nom,sueldo,turno)
values('A00002','Mirtha','1500','Noche')
select* from vendedor
insert into
factura(nrofactura,femision,forma_pago,subtotal,IGV,total,codcliente,cod
vendedor) values('00100000001','07/10/16','Tarjeta','700','133','833','C00001','A00001')
insert into
factura(nrofactura,femision,forma_pago,subtotal,IGV,total,codcliente,cod
vendedor) values('00100000002','08/10/16','Efectivo','750','143','893','C00002','A00002')
insert into
factura(nrofactura,femision,forma_pago,subtotal,IGV,total,codcliente,cod
vendedor) values('00100000003','09/10/16','Efectivo','820','156','976','C00001','A00002')
values('001values('001values('001values('001values('001-