Professional Documents
Culture Documents
create table cliente (numcli int not null, nomcli char(30) not null, dircli char
(30), tel int, mail char (30) default ('desconocido'), sald_0_30 decimal (10,2)
, sald_31_60 decimal (10,2), sald_61_90 decimal (10,2) primary key (numcli))
create table vendedor (codvend int not null primary key, nomvend char (20) not n
ull, apellvend char (20) not null, dirvend char (30), telvend int, mail char (30
) default ('desconocido'), cuota decimal (10,2), ventas decimal (10,2))
create table articulo (numart char (5) not null primary key, descripcion char (3
0), precio decimal (10,2) not null check (precio >=0.00), existencia int, catego
ria_art char (15))
create table pedido (numped int not null primary key, numcli int not null, codve
nd int not null, fecha_ped datetime, tot_desc decimal (10,2), foreign key (numcl
i) references cliente (numcli), foreign key (codvend) references vendedor (codve
nd))
create table detalle_ped (numped int not null, numart char (05) not null, cantid
ad int check (cantidad >=0), primary key (numped, numart), foreign key (numped)
references pedido (numped), foreign key (numart) references articulo (munart))
insert into cliente values (100,'Paquita Cabeza','Colima No.12','57895543','Paq
uita_58@yahoo.com.mx',100.20,500.30,52.15)
insert into cliente values (200,'Chayito Valdez','Azteca No.32','57892130','Cha
yito_12@yahoo.com.mx',501.20,150.30,362.15)
insert into cliente values (300,'Victor Perrin','Tlatelolco No.300','57784512',
'Perrin_45@google.com.mx',561.30,250.90,46.34)
insert into vendedor values (1100,'Oswi','Capitan Sparrow','Privada No.56',57143
808,'Sparrow_33@yahoo.com.mx',56.30,85.30)
insert into vendedor values (1200,'Eduardo','Zagato Der Vampire','Jardines No.93
',57963214,'Zagato_23@yahoo.com.mx',23.30,75.30)
insert into vendedor values (1300,'Christian','Sora','Jardines No.98',57120365,'
Sora_10@yahoo.com.mx',96.50,95.20)
insert into pedido values (5001,100,1200,02/09/11,5.20)
insert into pedido values (5002,200,1200,05/10/11,9.50)
insert into pedido values (5003,100,1300,21/06/11,5.20)
select * from pedido
select * from cliente
select * from vendedor
insert
insert
insert
insert
articulo
articulo
articulo
articulo
values
values
values
values
(020,'jamon',14.50,5,'carnes frias')
(030,'shampoo',29.80,10,'personal')
(040,'cubeta',15.00,15,'limpieza')
(010,'manzana',20.00,20,'frutas y verduras')
select
select
select
select
select
select
*
*
*
*
*
*
from
from
from
from
from
from
pedido
empleado
vendedor
cliente
pedido
detalle_ped