Está en la página 1de 2

create database PedidoOC create table clienteOC ( id_cliente int identity primary key not null, nombre char

(50)not null, direccion int not null, ) create table productoOC ( id_producto int identity primary key not null, precio int not null, ) create table cliente_necesita_productoOC ( id_cliente int not null, id_producto int not null, ) alter table cliente_necesita_productoOC add constraint fk_clienteproducto foreign key (id_cliente) references clienteOC(id_cliente) alter table cliente_necesita_productoOC add constraint fk_clienteproducto2 foreign key (id_producto) references productoOC(id_producto) create unique nonclustered index IX_id_clienteOC on cliente_necesita_productoOC ( id_producto asc ) create table ventaOC ( id_ventai nt identity primary key not null, cliente char (50) not null, ) create table producto_ventaOC ( id_producto int not null, id_venta int not null, ) create table categoriaOC ( id_categoria int identity primary key not null, create table producto_categoriaOC ( id_producto int not null, id_categoria int not null, ) alter table producto_ventaOC add constraint fk_productoventa foreign key (id_producto) references productoOC(id_venta) alter table producto_ventaOC add constraint fk_productoventa2 foreign key (id_venta) references ventaOC(id_venta) alter table producto_categoriaOC add constraint fk_productocategoria1

foreign key (id_producto) references productoOC(id_producto) alter table producto_categoriaOC add constraint fk_personavivienda3 foreign key (id_categoria) references categoriaOC(id_categoria) create unique nonclustered index IX_id_productoOC on producto_ventaOC ( id_producto asc ) create unique nonclustered index IX_id_productoOC on producto_categoriaOC ( id_categoria asc )

También podría gustarte