Está en la página 1de 1

use master

Go

if DB_ID ('DB_Bodega') is not null


Drop Database DB_Bodega
Go

Create Database DB_Bodega


Go

use DB_Bodega
Go

if OBJECT_ID ('dbo.Producto') is not null


Drop Table dbo.Producto
Go

Create Table dbo.Producto (


CodProducto char (6) not null constraint pk_CodProducto primary key,
NomProducto varchar (25) not null,
Existencia int,
Precio float
);
Go

if OBJECT_ID ('dbo.Pedido') is not null


Drop Table dbo.Pedido
Go

Create Table dbo.Pedido (


CodPedido int not null constraint pk_CodPedido primary key,
Cantidad int not null,
FechaParido Datetime not null,
CodProducto char (6) not null

constraint FK_CodigoProducto FOREIGN KEY (CodProducto) References dbo.Producto


(CodProducto)
On update Cascade
On Delete Cascade
);
Go

También podría gustarte