Bdd Ultima Clase

Embed Size (px)

DESCRIPTION

vvyyuvfy

Citation preview

create database practicause practicacreate table cliente(codcliente int primary key,nombrecliente varchar(40)not null,apellidocliente varchar(40)not null,dni char (8) not null,telefono varchar(13),correo varchar(40)not null)create table tipocomprobante(codcomprobante int primary key,nombrecomprobante varchar(40)not null,)create table tipopago(codtipopago int primary key,nombretipopago varchar(40)not null)create table categoriaproducto(codcategoria int primary key,nombrecategoria varchar(40)not null)create table tipoproducto(codproductotipo int primary key,nombretipo varchar(40)not null)create table area(codarea int primary key,nombrearea varchar(40)not null)create table categoriatrabajador(codcattrabajador int primary key,descripcion varchar(40)not null,)create table nivelprofesional(nnivel int primary key,profesion varchar(40)not null,)create table producto(codproducto int primary key,nombreproducto varchar(40)not null,stock int not null,precio money not null,codcategoria int not null foreign key references categoriaproducto,codproductotipo int null foreign key references tipoproducto)create table trabajador(codtrabajador int primary key,nombretrab varchar(40)not null,apellidotrab varchar(40)not null,dni char(8)not null,direccion varchar(40)not null,telefono varchar(13),correo varchar(40)not null,codarea int not null foreign key references area,codcattrabajador int not null foreign key references categoriatrabajador,fechaingreso datetime not null,nnivel int not null foreign key references nivelprofesional)create table pagos(npago int primary key,codcliente int not null foreign key references cliente,codcomprobante int not null foreign key references tipocomprobante,fechacompra datetime not null,codtipopago int not null foreign key references tipopago)create table kardex(nkardex int primary key,codproducto int not null foreign key references producto,fechaingreso datetime not null,fechasalida datetime not null,detalleomotivo varchar(30),npago int not null foreign key references pagos,codtrabajador int not null foreign key references trabajador,)