You are on page 1of 1

mysql> create database zapateria; Query OK, 1 row affected (0.

00 sec) mysql> use zapateria Database changed mysql> create table proveedores(idprov int not null primary key auto_increment, nombre varchar(20) not null, tel varchar(12) null) type= innodb; Query OK, 0 rows affected, 1 warning (0.16 sec) mysql> create table zapatos(codzap int not null primary key auto_increment, stoc k int not null, precio float not null, idprov int not null, foreign key(idprov) references proveedores(idprov)) type= innodb; Query OK, 0 rows affected, 1 warning (0.06 sec) mysql>

mysql> create table clientes(idclie int not null primary key auto_increment, no mbre varchar(20) not null, dir varchar(40) null) type= innodb; Query OK, 0 rows affected, 1 warning (0.16 sec) mysql> create table venta(codvta int not null primary key auto_increment, fecha date not null, total float not null, idclie int not null, foreign key(idclie) references clientes(idclie)) type= innodb; Query OK, 0 rows affected, 1 warning (0.06 sec) mysql>

mysql> create table detallesventa(codvta int not null , codzap int not null, ca ntidad int not null, foreign key(codvta) references venta(codvta), foreign key (codzap) references zapatos(codzap) ) type= innodb; Query OK, 0 rows affected, 1 warning (0.06 sec) mysql>

You might also like